summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorBenjamin Coddington <bcodding@redhat.com>2022-12-16 15:45:28 +0300
committerJakub Kicinski <kuba@kernel.org>2022-12-20 04:28:50 +0300
commit08f65892c5ee15806dce7259e06c384b8cd768d7 (patch)
treededc1398193582d8d52ad9142d95f5b16bd5d50c /include
parent98123866fcf3fe95a0c1b198ef122dfdbd351916 (diff)
downloadlinux-08f65892c5ee15806dce7259e06c384b8cd768d7.tar.xz
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: Benjamin Coddington <bcodding@redhat.com> Reviewed-by: Guillaume Nault <gnault@redhat.com> Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Diffstat (limited to 'include')
-rw-r--r--include/net/sock.h9
1 files changed, 2 insertions, 7 deletions
diff --git a/include/net/sock.h b/include/net/sock.h
index fefe1f4abf19..dcd72e6285b2 100644
--- a/include/net/sock.h
+++ b/include/net/sock.h
@@ -2564,19 +2564,14 @@ static inline void sk_stream_moderate_sndbuf(struct sock *sk)
* Both direct reclaim and page faults can nest inside other
* socket operations and end up recursing into sk_page_frag()
* while it's already in use: explicitly avoid task page_frag
- * usage if the caller is potentially doing any of them.
- * This assumes that page fault handlers use the GFP_NOFS flags or
- * explicitly disable sk_use_task_frag.
+ * when users disable sk_use_task_frag.
*
* Return: a per task page_frag if context allows that,
* otherwise a per socket one.
*/
static inline struct page_frag *sk_page_frag(struct sock *sk)
{
- if (sk->sk_use_task_frag &&
- (sk->sk_allocation & (__GFP_DIRECT_RECLAIM | __GFP_MEMALLOC |
- __GFP_FS)) ==
- (__GFP_DIRECT_RECLAIM | __GFP_FS))
+ if (sk->sk_use_task_frag)
return &current->task_frag;
return &sk->sk_frag;