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=-12.5 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT 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 4824BC55179 for ; Thu, 5 Nov 2020 04:22:00 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 74A2520795 for ; Thu, 5 Nov 2020 04:21:59 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="C5cSq7gY" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 74A2520795 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 5BA4F6B0087; Wed, 4 Nov 2020 23:21:58 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 56BAA6B0088; Wed, 4 Nov 2020 23:21:58 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 458516B0089; Wed, 4 Nov 2020 23:21:58 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0042.hostedemail.com [216.40.44.42]) by kanga.kvack.org (Postfix) with ESMTP id 0F7C26B0087 for ; Wed, 4 Nov 2020 23:21:58 -0500 (EST) Received: from smtpin08.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id 986B41EE6 for ; Thu, 5 Nov 2020 04:21:57 +0000 (UTC) X-FDA: 77449066674.08.grade18_4f0eac1272c7 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin08.hostedemail.com (Postfix) with ESMTP id 7FB831819E772 for ; Thu, 5 Nov 2020 04:21:57 +0000 (UTC) X-HE-Tag: grade18_4f0eac1272c7 X-Filterd-Recvd-Size: 3413 Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) by imf41.hostedemail.com (Postfix) with ESMTP for ; Thu, 5 Nov 2020 04:21:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=Content-Transfer-Encoding:MIME-Version: Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To:Content-Type:Content-ID: Content-Description:In-Reply-To:References; bh=9ie5em9LXiMFXgTgzhppNmSXBdOqoNkKv8pDhuYEZHw=; b=C5cSq7gYnujcAB6HxXPvl/9R/s 4JQLaO07G1uAQ/rDCGm+CWGy5w7Zrey4c6FAidhR16KqE2uXmWLZtgfv5HpzjZE9mkaJfWjEErAjh DprLKAqRijFyWewLIhB5Q741ZdPjRtrAkLLehal4n6V3CpLu5eT/Rd0qNbH7gZKbwAqzp2Sy6PgeP TE5Rk3wnLE5D5TNDdFn4hSifYGswqJrCcF8XNqT7FKzhbMs0aAhM8sgkiN67T23QY9FpW4MBBrXHH BDrVbyKyUSHWuTtiHtFCcyMuXWwEWOK6Q3LRIdzHHX315ty5zOgObkllVxhu8e4tXuMHDpwuD40h2 tbfUlj3w==; Received: from willy by casper.infradead.org with local (Exim 4.92.3 #3 (Red Hat Linux)) id 1kaWmW-0001Od-60; Thu, 05 Nov 2020 04:21:52 +0000 From: "Matthew Wilcox (Oracle)" To: linux-mm@kvack.org, netdev@vger.kernel.org, Dongli Zhang Cc: "Matthew Wilcox (Oracle)" , Aruna Ramakrishna , Bert Barbe , Rama Nichanamatlu , Venkat Venkatsubra , Manjunath Patil , Joe Jin , SRINIVAS , stable@vger.kernel.org Subject: [PATCH] page_frag: Recover from memory pressure Date: Thu, 5 Nov 2020 04:21:40 +0000 Message-Id: <20201105042140.5253-1-willy@infradead.org> X-Mailer: git-send-email 2.21.3 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable 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: When the machine is under extreme memory pressure, the page_frag allocato= r 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") 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, =20 if (!page_ref_sub_and_test(page, nc->pagecnt_bias)) goto refill; + if (nc->pfmemalloc) { + free_the_page(page, compound_order(page)); + goto refill; + } =20 #if (PAGE_SIZE < PAGE_FRAG_CACHE_MAX_SIZE) /* if size can vary use size else just use PAGE_SIZE */ --=20 2.28.0