query_smp.c: Avoid busy looping in process_one_recv
PATCH 1/1 query_smp.c: Avoid busy looping in process_one_recv
From: Vladimir Koushnir <vladimirk-VPRAkNaXOzVWk0Htik3J/[email protected]>
Date: Thu, 16 Apr 2015 14:11:16 +0300
Today, process_one_recv calls umad_recv with zero timeout. That means umad_recv will use non-blocking read() without polling, In many cases, this causes busy loop.
In the fix, umad_recv is invoked with -1 (infinite timeout) and the read() will occur only when poll exits. Also, no longer need to check for EWOULDBLOCK.
--- libibnetdisc/src/query_smp.c | 2 +- 1 files changed, 1 insertions(+), 3 deletions(-)
libibnetdisc/src/query_smp.c +1 -3
@@ -171,9 +171,7 @@ static int process_one_recv(smp_engine_t * engine)/* wait for the next message */ if ((rc =umad_recv (engine->umad_fd, umad, &length, -0 )) <0 ) { -if (rc == -EWOULDBLOCK ) -return 0 ; +-1 )) <0 ) {IBND_ERROR ("umad_recv failed: %d\n" , rc);return -1 ; }
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
A message that is not in the archive (sent off-list or not yet received): 552FC690.1010807-LDSdmyG8hGV8YrgS2mwiifqBs+8SCbDb@public.gmane.org
Quoted 10 lines · Hal Rosenstock
From: Vladimir Koushnir <vladimirk-VPRAkNaXOzVWk0Htik3J/[email protected]>
Date: Thu, 16 Apr 2015 14:11:16 +0300Today,
process_one_recvcallsumad_recvwith zero timeout. That meansumad_recvwill use non-blockingread()without polling, In many cases, this causes busy loop.In the fix,
umad_recvis invoked with -1 (infinite timeout) and theread()will occur only when poll exits. Also, no longer need to check for EWOULDBLOCK.
Has this been tested on broken fabrics where SMAs don't respond?
I know that we should recv something (ie timed out Send) for every MAD submitted to the kernel but I seem to remember a reason we did not use a timeout. But that may have been for a previous implementation which no longer exists. I can't remember.
Ira
Quoted 12 lines
--- libibnetdisc/src/query_smp.c | 2 +- 1 files changed, 1 insertions(+), 3 deletions(-)libibnetdisc/src/query_smp.c +0
-0
libibnetdisc/src/query_smp.c static int process_one_recv(smp_engine_t * engine) · line 177
Quoted 10 lines
libibnetdisc/src/query_smp.c +1
-3@@ -171,9 +171,7 @@ static int process_one_recv(smp_engine_t * engine)/* wait for the next message */ if ((rc =umad_recv (engine->umad_fd, umad, &length, -0 )) <0 ) { -if (rc == -EWOULDBLOCK ) -return 0 ; +-1 )) <0 ) {IBND_ERROR ("umad_recv failed: %d\n" , rc);return -1 ; }
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
ira.weiny
AppliedQuoted 7 lines · Hal Rosenstock
From: Vladimir Koushnir <vladimirk-VPRAkNaXOzVWk0Htik3J/[email protected]>
Date: Thu, 16 Apr 2015 14:11:16 +0300Today,
process_one_recvcallsumad_recvwith zero timeout. That meansumad_recvwill use non-blockingread()without polling, In many cases, this causes busy loop.
Quoted 6 lines
In the fix,
umad_recvis invoked with -1 (infinite timeout) and theread()will occur only when poll exits. Also, no longer need to check for EWOULDBLOCK.
Thanks applied,
Ira
Quoted 9 lines
--- libibnetdisc/src/query_smp.c | 2 +- 1 files changed, 1 insertions(+), 3 deletions(-)libibnetdisc/src/query_smp.c +0
-0
libibnetdisc/src/query_smp.c static int process_one_recv(smp_engine_t * engine) · line 177
Quoted 10 lines
libibnetdisc/src/query_smp.c +1
-3@@ -171,9 +171,7 @@ static int process_one_recv(smp_engine_t * engine)/* wait for the next message */ if ((rc =umad_recv (engine->umad_fd, umad, &length, -0 )) <0 ) { -if (rc == -EWOULDBLOCK ) -return 0 ; +-1 )) <0 ) {IBND_ERROR ("umad_recv failed: %d\n" , rc);return -1 ; }
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html