diff options
author | Doron Roberts-Kedes <doronrk@fb.com> | 2018-06-06 18:33:28 +0200 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2018-06-06 20:07:53 +0200 |
commit | 7170e6045a6a8b33f4fa5753589dc77b16198e2d (patch) | |
tree | d0b3c5b6035ce9ca8ef2fbfc01964221be142441 /net/strparser | |
parent | rxrpc: Fix terminal retransmission connection ID to include the channel (diff) | |
download | linux-7170e6045a6a8b33f4fa5753589dc77b16198e2d.tar.xz linux-7170e6045a6a8b33f4fa5753589dc77b16198e2d.zip |
strparser: Add __strp_unpause and use it in ktls.
strp_unpause queues strp_work in order to parse any messages that
arrived while the strparser was paused. However, the process invoking
strp_unpause could eagerly parse a buffered message itself if it held
the sock lock.
__strp_unpause is an alternative to strp_pause that avoids the scheduling
overhead that results when a receiving thread unpauses the strparser
and waits for the next message to be delivered by the workqueue thread.
This patch more than doubled the IOPS achieved in a benchmark of NBD
traffic encrypted using ktls.
Signed-off-by: Doron Roberts-Kedes <doronrk@fb.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/strparser')
-rw-r--r-- | net/strparser/strparser.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/net/strparser/strparser.c b/net/strparser/strparser.c index 092bebc70048..1a9695183599 100644 --- a/net/strparser/strparser.c +++ b/net/strparser/strparser.c @@ -512,6 +512,19 @@ int strp_init(struct strparser *strp, struct sock *sk, } EXPORT_SYMBOL_GPL(strp_init); +/* Sock process lock held (lock_sock) */ +void __strp_unpause(struct strparser *strp) +{ + strp->paused = 0; + + if (strp->need_bytes) { + if (strp_peek_len(strp) < strp->need_bytes) + return; + } + strp_read_sock(strp); +} +EXPORT_SYMBOL_GPL(__strp_unpause); + void strp_unpause(struct strparser *strp) { strp->paused = 0; |