From patchwork Wed Nov 25 03:46:54 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthew Wilcox X-Patchwork-Id: 11930275 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=-16.6 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,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 4C1C8C5519F for ; Wed, 25 Nov 2020 03:47:10 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id EAD3A20663 for ; Wed, 25 Nov 2020 03:47:08 +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="ALPcWGlR" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org EAD3A20663 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 0E49F6B006E; Tue, 24 Nov 2020 22:47:08 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 06F126B0070; Tue, 24 Nov 2020 22:47:07 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id E7A166B0071; Tue, 24 Nov 2020 22:47:07 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0066.hostedemail.com [216.40.44.66]) by kanga.kvack.org (Postfix) with ESMTP id CD5876B006E for ; Tue, 24 Nov 2020 22:47:07 -0500 (EST) Received: from smtpin16.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id 944F03635 for ; Wed, 25 Nov 2020 03:47:07 +0000 (UTC) X-FDA: 77521554894.16.drink62_2d01a2c27373 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin16.hostedemail.com (Postfix) with ESMTP id 72B21100E690B for ; Wed, 25 Nov 2020 03:47:07 +0000 (UTC) X-HE-Tag: drink62_2d01a2c27373 X-Filterd-Recvd-Size: 2388 Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) by imf16.hostedemail.com (Postfix) with ESMTP for ; Wed, 25 Nov 2020 03:47:06 +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=J1UiKPrr/8+P5aZ4gZtZajuWCSG9DfbwTn4Phofujgs=; b=ALPcWGlR8P/1FykZVFRmz3vcFz nBGB0hnWOZWyV07ZYluhFOsA5/vXhi+JDpiY3ZX3gi15gQU0bRWK8tfZUBSElsdRJE0iHLa28cV6D yERLNmcBTFIplJT/NUd8+NrZb/IyRMpkey4AiBUmES0zpDwkLfj1YyxmNRx+dw55S8WWo7rDMnwmy YkHt2wToGxA2Bep7FEEqsNgxgbs3I1pl/Ei2xVBdUVYwakkTsCbrudfvYRCWDGR8dl6fiE4uTFafX b2wt1U1tjpYFAjfW5MbMXhz9PVsFs6StauQ3r14jkgZiz9HlXVznT030xmxafxJM5D7fpNMN0SH5S 1R4PTkgQ==; Received: from willy by casper.infradead.org with local (Exim 4.92.3 #3 (Red Hat Linux)) id 1khllg-0007E4-Mm; Wed, 25 Nov 2020 03:46:57 +0000 From: "Matthew Wilcox (Oracle)" To: akpm@linux-foundation.org Cc: "Matthew Wilcox (Oracle)" , davem@davemloft.net, rppt@kernel.org, sparclinux@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org Subject: [PATCH 1/2] sparc: Fix handling of page table constructor failure Date: Wed, 25 Nov 2020 03:46:54 +0000 Message-Id: <20201125034655.27687-1-willy@infradead.org> X-Mailer: git-send-email 2.21.3 MIME-Version: 1.0 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: The page has just been allocated, so its refcount is 1. free_unref_page() is for use on pages which have a zero refcount. Use __free_page() like the other implementations of pte_alloc_one(). Fixes: 1ae9ae5f7df7 ("sparc: handle pgtable_page_ctor() fail") Signed-off-by: Matthew Wilcox (Oracle) Reviewed-by: David Hildenbrand Reviewed-by: Mike Rapoport Acked-by: Vlastimil Babka --- arch/sparc/mm/init_64.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/sparc/mm/init_64.c b/arch/sparc/mm/init_64.c index 96edf64d4fb3..182bb7bdaa0a 100644 --- a/arch/sparc/mm/init_64.c +++ b/arch/sparc/mm/init_64.c @@ -2894,7 +2894,7 @@ pgtable_t pte_alloc_one(struct mm_struct *mm) if (!page) return NULL; if (!pgtable_pte_page_ctor(page)) { - free_unref_page(page); + __free_page(page); return NULL; } return (pte_t *) page_address(page); From patchwork Wed Nov 25 03:46:55 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthew Wilcox X-Patchwork-Id: 11930277 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=-16.6 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,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 74A61C5519F for ; Wed, 25 Nov 2020 03:47:13 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id ACB1D206F8 for ; Wed, 25 Nov 2020 03:47:12 +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="RwKPNYEq" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org ACB1D206F8 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 1F8336B0070; Tue, 24 Nov 2020 22:47:12 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 181C96B0071; Tue, 24 Nov 2020 22:47:12 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 051C16B0072; Tue, 24 Nov 2020 22:47:11 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0022.hostedemail.com [216.40.44.22]) by kanga.kvack.org (Postfix) with ESMTP id D5F2E6B0070 for ; Tue, 24 Nov 2020 22:47:11 -0500 (EST) Received: from smtpin10.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id A65D03635 for ; Wed, 25 Nov 2020 03:47:11 +0000 (UTC) X-FDA: 77521555062.10.pail87_440a97727373 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin10.hostedemail.com (Postfix) with ESMTP id 8857C16A4AA for ; Wed, 25 Nov 2020 03:47:11 +0000 (UTC) X-HE-Tag: pail87_440a97727373 X-Filterd-Recvd-Size: 3083 Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) by imf25.hostedemail.com (Postfix) with ESMTP for ; Wed, 25 Nov 2020 03:47:11 +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: References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To: Content-Type:Content-ID:Content-Description; bh=B1PQC6WJEM7TGPBmASC/1k4P2JlH4NZxClv0snmsy5s=; b=RwKPNYEq5QLhIR2aZMYoq+cj5G voHrlRyVacNfgkKFhT6XqCOVKiTAWYG7brDli+xT9QfZ4AHDRcZkG3IHXdNAT0shPCK8XFTy2dX5Q OCs+M2aWNCwW4AZoNtrRTUs6vZ9aRQ1MufP/y7EMrkmmN2hyBXpNWNFXMS0wsJZjdi/ASxeTHotSn ngzvjva2JB1E0w2VSZg5gUtcuBcdAAStV0zLJkMKxWu1EDl1E3fdoZxvihZj7VRf2X3jY905vWqt9 s8UA99h3LCmXF6SYcb5d0JUYti5KHBT6Kj90N5AlYidbKALhBhSAT+qacsFcWCcr6wv8Cwc183PKO QMBooKUA==; Received: from willy by casper.infradead.org with local (Exim 4.92.3 #3 (Red Hat Linux)) id 1khlli-0007EP-7o; Wed, 25 Nov 2020 03:46:58 +0000 From: "Matthew Wilcox (Oracle)" To: akpm@linux-foundation.org Cc: "Matthew Wilcox (Oracle)" , davem@davemloft.net, rppt@kernel.org, sparclinux@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org Subject: [PATCH 2/2] mm: Move free_unref_page to mm/internal.h Date: Wed, 25 Nov 2020 03:46:55 +0000 Message-Id: <20201125034655.27687-2-willy@infradead.org> X-Mailer: git-send-email 2.21.3 In-Reply-To: <20201125034655.27687-1-willy@infradead.org> References: <20201125034655.27687-1-willy@infradead.org> MIME-Version: 1.0 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: Code outside mm/ should not be calling free_unref_page(). Also move free_unref_page_list(). Signed-off-by: Matthew Wilcox (Oracle) Reviewed-by: David Hildenbrand Reviewed-by: Mike Rapoport Acked-by: Vlastimil Babka --- include/linux/gfp.h | 2 -- mm/internal.h | 3 +++ 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/include/linux/gfp.h b/include/linux/gfp.h index c603237e006c..6e479e9c48ce 100644 --- a/include/linux/gfp.h +++ b/include/linux/gfp.h @@ -580,8 +580,6 @@ void * __meminit alloc_pages_exact_nid(int nid, size_t size, gfp_t gfp_mask); extern void __free_pages(struct page *page, unsigned int order); extern void free_pages(unsigned long addr, unsigned int order); -extern void free_unref_page(struct page *page); -extern void free_unref_page_list(struct list_head *list); struct page_frag_cache; extern void __page_frag_cache_drain(struct page *page, unsigned int count); diff --git a/mm/internal.h b/mm/internal.h index 75ae680d0a2c..5864815947fe 100644 --- a/mm/internal.h +++ b/mm/internal.h @@ -201,6 +201,9 @@ extern void post_alloc_hook(struct page *page, unsigned int order, gfp_t gfp_flags); extern int user_min_free_kbytes; +extern void free_unref_page(struct page *page); +extern void free_unref_page_list(struct list_head *list); + extern void zone_pcp_update(struct zone *zone); extern void zone_pcp_reset(struct zone *zone); extern void zone_pcp_disable(struct zone *zone);