Unverified Commit fec67c41 authored by openeuler-ci-bot's avatar openeuler-ci-bot Committed by Gitee
Browse files
parents 931ac8ed ff3f2c8f
Loading
Loading
Loading
Loading
+8 −5
Original line number Diff line number Diff line
@@ -2333,16 +2333,19 @@ struct sk_buff *sk_stream_alloc_skb(struct sock *sk, int size, gfp_t gfp,
 * @sk: socket
 *
 * Use the per task page_frag instead of the per socket one for
 * optimization when we know that we're in the normal context and owns
 * optimization when we know that we're in process context and own
 * everything that's associated with %current.
 *
 * gfpflags_allow_blocking() isn't enough here as direct reclaim may nest
 * inside other socket operations and end up recursing into sk_page_frag()
 * while it's already in use.
 * 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.
 */
static inline struct page_frag *sk_page_frag(struct sock *sk)
{
	if (gfpflags_normal_context(sk->sk_allocation))
	if ((sk->sk_allocation & (__GFP_DIRECT_RECLAIM | __GFP_MEMALLOC | __GFP_FS)) ==
	    (__GFP_DIRECT_RECLAIM | __GFP_FS))
		return &current->task_frag;

	return &sk->sk_frag;