Skip to content

Commit 08f6589

Browse files
bcodding-rhkuba-moo
authored andcommitted
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 <[email protected]> Reviewed-by: Guillaume Nault <[email protected]> Signed-off-by: Jakub Kicinski <[email protected]>
1 parent 9812386 commit 08f6589

File tree

1 file changed

+2
-7
lines changed

1 file changed

+2
-7
lines changed

include/net/sock.h

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2564,19 +2564,14 @@ static inline void sk_stream_moderate_sndbuf(struct sock *sk)
25642564
* Both direct reclaim and page faults can nest inside other
25652565
* socket operations and end up recursing into sk_page_frag()
25662566
* while it's already in use: explicitly avoid task page_frag
2567-
* usage if the caller is potentially doing any of them.
2568-
* This assumes that page fault handlers use the GFP_NOFS flags or
2569-
* explicitly disable sk_use_task_frag.
2567+
* when users disable sk_use_task_frag.
25702568
*
25712569
* Return: a per task page_frag if context allows that,
25722570
* otherwise a per socket one.
25732571
*/
25742572
static inline struct page_frag *sk_page_frag(struct sock *sk)
25752573
{
2576-
if (sk->sk_use_task_frag &&
2577-
(sk->sk_allocation & (__GFP_DIRECT_RECLAIM | __GFP_MEMALLOC |
2578-
__GFP_FS)) ==
2579-
(__GFP_DIRECT_RECLAIM | __GFP_FS))
2574+
if (sk->sk_use_task_frag)
25802575
return &current->task_frag;
25812576

25822577
return &sk->sk_frag;

0 commit comments

Comments
 (0)