Skip to content

Commit 2153bd1

Browse files
Wen Gudavem330
Wen Gu
authored andcommitted
net/smc: Transfer remaining wait queue entries during fallback
The SMC fallback is incomplete currently. There may be some wait queue entries remaining in smc socket->wq, which should be removed to clcsocket->wq during the fallback. For example, in nginx/wrk benchmark, this issue causes an all-zeros test result: server: nginx -g 'daemon off;' client: smc_run wrk -c 1 -t 1 -d 5 http://11.200.15.93/index.html Running 5s test @ http://11.200.15.93/index.html 1 threads and 1 connections Thread Stats Avg Stdev Max ± Stdev Latency 0.00us 0.00us 0.00us -nan% Req/Sec 0.00 0.00 0.00 -nan% 0 requests in 5.00s, 0.00B read Requests/sec: 0.00 Transfer/sec: 0.00B The reason for this all-zeros result is that when wrk used SMC to replace TCP, it added an eppoll_entry into smc socket->wq and expected to be notified if epoll events like EPOLL_IN/ EPOLL_OUT occurred on the smc socket. However, once a fallback occurred, wrk switches to use clcsocket. Now it is clcsocket->wq instead of smc socket->wq which will be woken up. The eppoll_entry remaining in smc socket->wq does not work anymore and wrk stops the test. This patch fixes this issue by removing remaining wait queue entries from smc socket->wq to clcsocket->wq during the fallback. Link: https://www.spinics.net/lists/netdev/msg779769.html Signed-off-by: Wen Gu <[email protected]> Reviewed-by: Tony Lu <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent ae32bd4 commit 2153bd1

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

net/smc/af_smc.c

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -566,6 +566,10 @@ static void smc_stat_fallback(struct smc_sock *smc)
566566

567567
static void smc_switch_to_fallback(struct smc_sock *smc, int reason_code)
568568
{
569+
wait_queue_head_t *smc_wait = sk_sleep(&smc->sk);
570+
wait_queue_head_t *clc_wait = sk_sleep(smc->clcsock->sk);
571+
unsigned long flags;
572+
569573
smc->use_fallback = true;
570574
smc->fallback_rsn = reason_code;
571575
smc_stat_fallback(smc);
@@ -575,6 +579,16 @@ static void smc_switch_to_fallback(struct smc_sock *smc, int reason_code)
575579
smc->clcsock->file->private_data = smc->clcsock;
576580
smc->clcsock->wq.fasync_list =
577581
smc->sk.sk_socket->wq.fasync_list;
582+
583+
/* There may be some entries remaining in
584+
* smc socket->wq, which should be removed
585+
* to clcsocket->wq during the fallback.
586+
*/
587+
spin_lock_irqsave(&smc_wait->lock, flags);
588+
spin_lock(&clc_wait->lock);
589+
list_splice_init(&smc_wait->head, &clc_wait->head);
590+
spin_unlock(&clc_wait->lock);
591+
spin_unlock_irqrestore(&smc_wait->lock, flags);
578592
}
579593
}
580594

0 commit comments

Comments
 (0)