Received: by 2002:a05:6a10:16a7:0:0:0:0 with SMTP id gp39csp2932240pxb; Mon, 16 Nov 2020 00:40:36 -0800 (PST) X-Google-Smtp-Source: ABdhPJwL+tUWOct17YwpLu0RmGGtQPF7U4FGYj+biSi+17UYgKTaqg4/U+wU05/nAtxCHR/YJvAW X-Received: by 2002:a05:6402:559:: with SMTP id i25mr16094246edx.128.1605516035995; Mon, 16 Nov 2020 00:40:35 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1605516035; cv=none; d=google.com; s=arc-20160816; b=EXqi/zcr6IzzHgx6Qpga34dYnEtdFNeNu4XK31Sj4hhRWfXl78qpFDe0FP9mc4m3Gh 7bPIokj39FAKwCf4vcD2KhR49JP17tVEx1T3GW726l9URlJQS0WMGwNYvdll/nUP3Wrr YWtwTM6A2NHkD2CYYB9qoJKTxOczxgcczIDeeEbchMa1MBaZQbN1VLI0J8YmipKshxxK 0Ah53Iw5NQ07CLGtKhx/yW10qNVKuH3AiZYUPaaTGamfhqQnKMW7qDPRRXGEFTQfQDkP /Q5k8rG4fQ7sFJL4scs70ZiZ39C9SNZG9+YPQVVwehNdD0Cx3dphnq7JcXX1BPhjJ2I4 TqcA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=SQYTN/rZ1aDgUQSp2jlM2eDGpSqvkEfnliWtIDeccMg=; b=YFJ06TnOEHP5kqH4r74GPNhkiOk88E1vppd89qMcTC65GRhm0JCLj+woWkmV8pvR3g W+kg2jaVKAcOT+BDYDf+aCRjgAKWCbWK+HY4juN1PqWGR7AWntVOYKC/GT9yCzC4WDj6 xJRjyKXlExG249Jn5elb41ER8gXb41xW9uSEZWBp/st7++OiMhJ/wJYMeidiCWp/tmTU ic+zo0sZUUvUSbOG7fvO1sflZuT6iwihpDHTLvfOgWqq/LUHbjPehrX5x2EZ8qskjYtC 5qtnhOCuLioQYU3f/dcwbJ49uL30OD3E3oiWq1TTQbYlC1MeV7pMpNEbw8h3Zu/xqPHd bx1A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=YK2BePID; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id us5si11476677ejb.394.2020.11.16.00.40.13; Mon, 16 Nov 2020 00:40:35 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=YK2BePID; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728078AbgKPIhT (ORCPT + 99 others); Mon, 16 Nov 2020 03:37:19 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46310 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726357AbgKPIhT (ORCPT ); Mon, 16 Nov 2020 03:37:19 -0500 Received: from mail-il1-x143.google.com (mail-il1-x143.google.com [IPv6:2607:f8b0:4864:20::143]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DFBA6C0613D2 for ; Mon, 16 Nov 2020 00:37:17 -0800 (PST) Received: by mail-il1-x143.google.com with SMTP id w10so89314ilq.5 for ; Mon, 16 Nov 2020 00:37:17 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=SQYTN/rZ1aDgUQSp2jlM2eDGpSqvkEfnliWtIDeccMg=; b=YK2BePIDJ8dNHlG3OvyUOjJpZeUB18Ep80hyvsTOLNqRu4URyDGI6sugPUfeI+JyWu SRwQevK+0Xg0DaYY+oNeKDsffA3BYHFyyDKlmU4CYgAtFvXfFPq5V1+hUS3NFFzAnbSM 29lrqn7x73zVsvOY9wylEu0hpvKfG7JrROyMfT7rtak80OmZoPPF3XeJgFLzAO/ZNphn gIxWXiJxx54o1sUNuttrMr4haR/Aq7OD4ycZXEacrllzgnAxD3kRruC9rszOUzybz/Dx LEV6EwKEa0t0JVAjIz5oJT1OGG1zps77FCfwUlcenHe17CmLoA44Za/tBXHQXr3RKpkS lpmQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=SQYTN/rZ1aDgUQSp2jlM2eDGpSqvkEfnliWtIDeccMg=; b=euTQ7WJzYrtlHyQJfF7uqE15ABfixIYckPGZoNYKuq6VU0H40LssOzbProCEUmBGQm wn815kGAXxrcXvmRXkblell62FuAx8SUdCpYQpk14Hvev+G8EszHPzdE1n0WyK/T8Cq/ oM23ImTGMRre6aBBBzV5BE4veWqs/ZuZSzr2YiIxYDU386zxCF7tR5Pq7vMJXtnDudvt 9ilCb0tQvbwyp2mgOdHsw6uPiR3qAj1Vb4/Jhr1zvzG5Wki6DEFEulTik5KvU75zqB8c VtMzLst9m+BRt2ANoLsQbbAwbd2T3zOS1x0p4kPUwb3TcswcJ33UTpb11lcPiOsroXf0 pYRg== X-Gm-Message-State: AOAM531NZhx62b6CjhPIRQEvG9LWXQcoofsvqeCsxGH+gznbrLxnGcYv 5ewW7U1qBBeUvsfEDjpMwrWI6FhWSFdgQPnWh9z90w== X-Received: by 2002:a92:6f11:: with SMTP id k17mr7809416ilc.69.1605515836891; Mon, 16 Nov 2020 00:37:16 -0800 (PST) MIME-Version: 1.0 References: <20201115201029.11903-1-dongli.zhang@oracle.com> In-Reply-To: <20201115201029.11903-1-dongli.zhang@oracle.com> From: Eric Dumazet Date: Mon, 16 Nov 2020 09:37:05 +0100 Message-ID: Subject: Re: [PATCH v3 1/1] page_frag: Recover from memory pressure To: Dongli Zhang Cc: linux-mm , netdev , Matthew Wilcox , aruna.ramakrishna@oracle.com, bert.barbe@oracle.com, rama.nichanamatlu@oracle.com, "venkat x.venkatsubra" , manjunath.b.patil@oracle.com, joe.jin@oracle.com, srinivas.eeda@oracle.com, stable@vger.kernel.org, LKML , Andrew Morton , David Miller , Vlastimil Babka Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sun, Nov 15, 2020 at 9:16 PM Dongli Zhang wrote: > > The ethernet driver may allocate skb (and skb->data) via napi_alloc_skb(). > This ends up to page_frag_alloc() to allocate skb->data from > page_frag_cache->va. > > During the memory pressure, page_frag_cache->va may be allocated as > pfmemalloc page. As a result, the skb->pfmemalloc is always true as > skb->data is from page_frag_cache->va. The skb will be dropped if the > sock (receiver) does not have SOCK_MEMALLOC. This is expected behaviour > under memory pressure. ... > References: https://lore.kernel.org/lkml/20201103193239.1807-1-dongli.zhang@oracle.com/ > References: https://lore.kernel.org/linux-mm/20201105042140.5253-1-willy@infradead.org/ > Suggested-by: Matthew Wilcox (Oracle) > Cc: Aruna Ramakrishna > Cc: Bert Barbe > Cc: Rama Nichanamatlu > Cc: Venkat Venkatsubra > Cc: Manjunath Patil > Cc: Joe Jin > Cc: SRINIVAS > Cc: stable@vger.kernel.org > Fixes: 79930f5892e ("net: do not deplete pfmemalloc reserve") > Signed-off-by: Dongli Zhang > Acked-by: Vlastimil Babka > --- > Changed since v1: > - change author from Matthew to Dongli > - Add references to all prior discussions > - Add more details to commit message > Changed since v2: > - add unlikely (suggested by Eric Dumazet) > > mm/page_alloc.c | 5 +++++ > 1 file changed, 5 insertions(+) > > diff --git a/mm/page_alloc.c b/mm/page_alloc.c > index 23f5066bd4a5..91129ce75ed4 100644 > --- a/mm/page_alloc.c > +++ b/mm/page_alloc.c > @@ -5103,6 +5103,11 @@ void *page_frag_alloc(struct page_frag_cache *nc, > if (!page_ref_sub_and_test(page, nc->pagecnt_bias)) > goto refill; > > + if (unlikely(nc->pfmemalloc)) { > + free_the_page(page, compound_order(page)); > + goto refill; > + } > + Reviewed-by: Eric Dumazet Thanks !