From: Vakul Garg Date: Wed, 20 Jun 2018 21:59:49 +0000 (+0530) Subject: strparser: Don't schedule in workqueue in paused state X-Git-Tag: v5.15~8538^2~29 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=456488cd952c23d451b0bdc5b5226b0707db80f7;p=platform%2Fkernel%2Flinux-starfive.git strparser: Don't schedule in workqueue in paused state In function strp_data_ready(), it is useless to call queue_work if the state of strparser is already paused. The state checking should be done before calling queue_work. The change reduces the context switches and improves the ktls-rx throughput by approx 20% (measured on cortex-a53 based platform). Signed-off-by: Vakul Garg Acked-by: Dave Watson Signed-off-by: David S. Miller --- diff --git a/net/strparser/strparser.c b/net/strparser/strparser.c index 1a96951..37383661 100644 --- a/net/strparser/strparser.c +++ b/net/strparser/strparser.c @@ -392,7 +392,7 @@ static int strp_read_sock(struct strparser *strp) /* Lower sock lock held */ void strp_data_ready(struct strparser *strp) { - if (unlikely(strp->stopped)) + if (unlikely(strp->stopped) || strp->paused) return; /* This check is needed to synchronize with do_strp_work. @@ -407,9 +407,6 @@ void strp_data_ready(struct strparser *strp) return; } - if (strp->paused) - return; - if (strp->need_bytes) { if (strp_peek_len(strp) < strp->need_bytes) return;