* [PATCH net-next] strparser: Add __strp_unpause and use it in ktls.
@ 2018-06-06 16:33 Doron Roberts-Kedes
2018-06-06 18:08 ` David Miller
0 siblings, 1 reply; 2+ messages in thread
From: Doron Roberts-Kedes @ 2018-06-06 16:33 UTC (permalink / raw)
To: David S. Miller
Cc: Dave Watson, Tom Herbert, Vakul Garg, netdev, Doron Roberts-Kedes
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>
---
include/net/strparser.h | 2 ++
net/strparser/strparser.c | 13 +++++++++++++
net/tls/tls_sw.c | 2 +-
3 files changed, 16 insertions(+), 1 deletion(-)
diff --git a/include/net/strparser.h b/include/net/strparser.h
index d96b59f..f177c87 100644
--- a/include/net/strparser.h
+++ b/include/net/strparser.h
@@ -90,6 +90,8 @@ static inline void strp_pause(struct strparser *strp)
/* May be called without holding lock for attached socket */
void strp_unpause(struct strparser *strp);
+/* Must be called with process lock held (lock_sock) */
+void __strp_unpause(struct strparser *strp);
static inline void save_strp_stats(struct strparser *strp,
struct strp_aggr_stats *agg_stats)
diff --git a/net/strparser/strparser.c b/net/strparser/strparser.c
index 092bebc..1a96951 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;
diff --git a/net/tls/tls_sw.c b/net/tls/tls_sw.c
index 839e1e1..8ca57d0 100644
--- a/net/tls/tls_sw.c
+++ b/net/tls/tls_sw.c
@@ -735,7 +735,7 @@ static bool tls_sw_advance_skb(struct sock *sk, struct sk_buff *skb,
/* Finished with message */
ctx->recv_pkt = NULL;
kfree_skb(skb);
- strp_unpause(&ctx->strp);
+ __strp_unpause(&ctx->strp);
return true;
}
--
2.9.5
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH net-next] strparser: Add __strp_unpause and use it in ktls.
2018-06-06 16:33 [PATCH net-next] strparser: Add __strp_unpause and use it in ktls Doron Roberts-Kedes
@ 2018-06-06 18:08 ` David Miller
0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2018-06-06 18:08 UTC (permalink / raw)
To: doronrk; +Cc: davejwatson, tom, vakul.garg, netdev
From: Doron Roberts-Kedes <doronrk@fb.com>
Date: Wed, 6 Jun 2018 09:33:28 -0700
> 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>
Applied, thank you.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2018-06-06 18:08 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-06-06 16:33 [PATCH net-next] strparser: Add __strp_unpause and use it in ktls Doron Roberts-Kedes
2018-06-06 18:08 ` David Miller
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).