Commit 08f65892 authored by Benjamin Coddington's avatar Benjamin Coddington Committed by Jakub Kicinski

net: simplify sk_page_frag

Now that in-kernel socket users that may recurse during reclaim have benn
converted to sk_use_task_frag = false, we can have sk_page_frag() simply
check that value.
Signed-off-by: default avatarBenjamin Coddington <bcodding@redhat.com>
Reviewed-by: default avatarGuillaume Nault <gnault@redhat.com>
Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parent 98123866
...@@ -2564,19 +2564,14 @@ static inline void sk_stream_moderate_sndbuf(struct sock *sk) ...@@ -2564,19 +2564,14 @@ static inline void sk_stream_moderate_sndbuf(struct sock *sk)
* Both direct reclaim and page faults can nest inside other * Both direct reclaim and page faults can nest inside other
* socket operations and end up recursing into sk_page_frag() * socket operations and end up recursing into sk_page_frag()
* while it's already in use: explicitly avoid task page_frag * while it's already in use: explicitly avoid task page_frag
* usage if the caller is potentially doing any of them. * when users disable sk_use_task_frag.
* This assumes that page fault handlers use the GFP_NOFS flags or
* explicitly disable sk_use_task_frag.
* *
* Return: a per task page_frag if context allows that, * Return: a per task page_frag if context allows that,
* otherwise a per socket one. * otherwise a per socket one.
*/ */
static inline struct page_frag *sk_page_frag(struct sock *sk) static inline struct page_frag *sk_page_frag(struct sock *sk)
{ {
if (sk->sk_use_task_frag && if (sk->sk_use_task_frag)
(sk->sk_allocation & (__GFP_DIRECT_RECLAIM | __GFP_MEMALLOC |
__GFP_FS)) ==
(__GFP_DIRECT_RECLAIM | __GFP_FS))
return &current->task_frag; return &current->task_frag;
return &sk->sk_frag; return &sk->sk_frag;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment