A RPC's affinity shouldn't be set from a workqueue worker in case of
RPC_AFFINITY_RETENT mode, otherwise the RPC could be stuck to one cpu
forever. When multiple rpcs are stuck to the same cpu overall performance
degrades significantly.

Fixes: #VSTOR-109481
https://virtuozzo.atlassian.net/browse/VSTOR-109481

Signed-off-by: Liu Kui <kui....@virtuozzo.com>
---
 fs/fuse/kio/pcs/pcs_rpc.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/fs/fuse/kio/pcs/pcs_rpc.c b/fs/fuse/kio/pcs/pcs_rpc.c
index f15d0c3fb7cd..c7d387568b95 100644
--- a/fs/fuse/kio/pcs/pcs_rpc.c
+++ b/fs/fuse/kio/pcs/pcs_rpc.c
@@ -877,6 +877,10 @@ static void pcs_rpc_affinity(struct pcs_rpc *ep, bool 
was_idle)
                                pcs_rpc_cpu_select(ep);
                        break;
                case RPC_AFFINITY_RETENT:
+                       /* Do not set rpc affinity from a workequeue worker */
+                       if (current->flags & PF_WQ_WORKER)
+                               break;
+
                        /* Naive socket-to-cpu binding approach */
                        if (ep->cpu == WORK_CPU_UNBOUND ||
                            (time_is_before_jiffies(ep->cpu_stamp) && 
was_idle)) {
-- 
2.39.5 (Apple Git-154)

_______________________________________________
Devel mailing list
Devel@openvz.org
https://lists.openvz.org/mailman/listinfo/devel

Reply via email to