From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-11.1 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,NICE_REPLY_A, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id A928EC00A89 for ; Thu, 5 Nov 2020 13:21:32 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 09683206CB for ; Thu, 5 Nov 2020 13:21:31 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="aeF/jsaU" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 09683206CB Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 54ECD6B0114; Thu, 5 Nov 2020 08:21:31 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 4FDB06B0115; Thu, 5 Nov 2020 08:21:31 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 3ED9B6B0116; Thu, 5 Nov 2020 08:21:31 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0141.hostedemail.com [216.40.44.141]) by kanga.kvack.org (Postfix) with ESMTP id 0E7776B0114 for ; Thu, 5 Nov 2020 08:21:31 -0500 (EST) Received: from smtpin22.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id 92EF23621 for ; Thu, 5 Nov 2020 13:21:30 +0000 (UTC) X-FDA: 77450426340.22.gate42_330a3c7272ca Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin22.hostedemail.com (Postfix) with ESMTP id 4E0CF18038E6B for ; Thu, 5 Nov 2020 13:21:30 +0000 (UTC) X-HE-Tag: gate42_330a3c7272ca X-Filterd-Recvd-Size: 5519 Received: from mail-wr1-f67.google.com (mail-wr1-f67.google.com [209.85.221.67]) by imf22.hostedemail.com (Postfix) with ESMTP for ; Thu, 5 Nov 2020 13:21:29 +0000 (UTC) Received: by mail-wr1-f67.google.com with SMTP id b8so1750121wrn.0 for ; Thu, 05 Nov 2020 05:21:29 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=a85H8wm4BS7+KUS0Jz6qx8lLSyd4auBcG9TW/HwKEug=; b=aeF/jsaUOlIaNhiby87PypQOR8fPBdYt6vbGRdvx+s8k5v2cJZ9rQ+jE7jKmLjNdAA ioTCfboogO1GvNTEsH01Bnj0Oisz1hQGdagdX8QnfXWzQxHao1kJBIpIP0Nax7+SX/qo K3pVhT371L3dq66UUcgDHq8VvDIY7xd6U4M+QywgVb7JaSiEy/j9FAnFiIwpUO9E/DOG mWDQPTPNcGsozaFvvcxIuGfBLQJDaGlc1SfKrEl3e95lKOSPDohId1ANJ1YAfoG4NPsE sAeEte5Atrh0hGCrNYAbLkL8vClMhsJ0JsUjwSc184r4AMwxV/B6y1Uc+U8mUQGIEp85 EEGg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=a85H8wm4BS7+KUS0Jz6qx8lLSyd4auBcG9TW/HwKEug=; b=qxxGYo0+PomdIzjXNbxM4oq0XMBrBlfDoVsrt9JfDDhyd+bUCQm1M1uBgYm7yxrtHF c/W/mN7ujDmGqK9qz8JWVTUfLteujFY2F42rpeIPefmznAqBJK2ZtpEsPqtYIvtEaqO5 HuF2WzeSK3e2YL1ejztQUVVNVWfKkeCkJgL9/OeSn9vSBjCA2CmqntUD0L3CtvvTILh+ NjL3puEjvAR3vqjyciHB+kBm40LGRcSBueeES9yKckk4t6uzA7SmjYvtq2pWlHS9UWqd YYlKvXcrtWFJA5pDikmsqw6Cs2QXowPBxBEm/gRyxV+y35S9kev3u9Hb/yfq2IO5Pkd4 KtkQ== X-Gm-Message-State: AOAM533+Nh+tD+WS4DQ53FiW6LuQ3YLsXYAL5yrmVmNrvQu6pNCNU3vM Zj8b8d49AWUS/Tk4HzP5F5s= X-Google-Smtp-Source: ABdhPJzcPPmmQDOsAh46XusNjbHTKhW2hIOclIddxmjAM48WnAbH+DI7CPvSr06zoOWPP54SqXkXzA== X-Received: by 2002:a5d:5387:: with SMTP id d7mr2899491wrv.224.1604582488598; Thu, 05 Nov 2020 05:21:28 -0800 (PST) Received: from [192.168.8.114] ([37.172.191.42]) by smtp.gmail.com with ESMTPSA id 89sm2699678wrp.58.2020.11.05.05.21.26 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 05 Nov 2020 05:21:27 -0800 (PST) Subject: Re: [PATCH] page_frag: Recover from memory pressure To: "Matthew Wilcox (Oracle)" , linux-mm@kvack.org, netdev@vger.kernel.org, Dongli Zhang Cc: Aruna Ramakrishna , Bert Barbe , Rama Nichanamatlu , Venkat Venkatsubra , Manjunath Patil , Joe Jin , SRINIVAS , stable@vger.kernel.org References: <20201105042140.5253-1-willy@infradead.org> From: Eric Dumazet Message-ID: Date: Thu, 5 Nov 2020 14:21:25 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.3.1 MIME-Version: 1.0 In-Reply-To: <20201105042140.5253-1-willy@infradead.org> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On 11/5/20 5:21 AM, Matthew Wilcox (Oracle) wrote: > When the machine is under extreme memory pressure, the page_frag allocator > signals this to the networking stack by marking allocations with the > 'pfmemalloc' flag, which causes non-essential packets to be dropped. > Unfortunately, even after the machine recovers from the low memory > condition, the page continues to be used by the page_frag allocator, > so all allocations from this page will continue to be dropped. > > Fix this by freeing and re-allocating the page instead of recycling it. > > Reported-by: Dongli Zhang > 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") Your patch looks fine, although this Fixes: tag seems incorrect. 79930f5892e ("net: do not deplete pfmemalloc reserve") was propagating the page pfmemalloc status into the skb, and seems correct to me. The bug was the page_frag_alloc() was keeping a problematic page for an arbitrary period of time ? > Signed-off-by: Matthew Wilcox (Oracle) > --- > mm/page_alloc.c | 4 ++++ > 1 file changed, 4 insertions(+) > > diff --git a/mm/page_alloc.c b/mm/page_alloc.c > index 778e815130a6..631546ae1c53 100644 > --- a/mm/page_alloc.c > +++ b/mm/page_alloc.c > @@ -5139,6 +5139,10 @@ void *page_frag_alloc(struct page_frag_cache *nc, > > if (!page_ref_sub_and_test(page, nc->pagecnt_bias)) > goto refill; > + if (nc->pfmemalloc) { if (unlikely(nc->pfmemalloc)) { > + free_the_page(page, compound_order(page)); > + goto refill; > + } > > #if (PAGE_SIZE < PAGE_FRAG_CACHE_MAX_SIZE) > /* if size can vary use size else just use PAGE_SIZE */ >