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 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7CE90C25B07 for ; Tue, 9 Aug 2022 17:19:07 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 643988E000B; Tue, 9 Aug 2022 13:19:03 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id E352C8E0002; Tue, 9 Aug 2022 13:19:02 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 9EE368E000B; Tue, 9 Aug 2022 13:19:02 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id 536458E0003 for ; Tue, 9 Aug 2022 13:19:02 -0400 (EDT) Received: from smtpin16.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay05.hostedemail.com (Postfix) with ESMTP id 30E5D4018B for ; Tue, 9 Aug 2022 17:19:02 +0000 (UTC) X-FDA: 79780714524.16.F18BB11 Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) by imf13.hostedemail.com (Postfix) with ESMTP id 0DD9F2005B for ; Tue, 9 Aug 2022 17:19:00 +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=BowTi8Whxz8B8+J+oC83B5WKyDoi0QndQPuny7emV90=; b=tUyHqzcrDoCP2HXSdw/iukyJx+ lOqijvEX6HZepbgwU5bvJdOJOiqPQhhBDyiYi8RjUk5aXHgEOo2Z8ldJ6HUA9s9wM377Ix//nbPUw iVbs4XOzAik64yeFaErZJVvDDC63jncwLP4A6nyJrWVvobKCDmfjgOqKI2fwesJuQKd97nUWGbzcg edBXBLmdBBCAqkFzlTHetbrcazWkYzGWVXB0CPxPxHWXxkPPNqp+wS3f0sTFJRUtELUaEwckwawzW 8D4aa5BMz4eUoF+LFkF1AwVBfUPb2cwPyJtyD8FKiM2LKnO3hjOHHw25RA7e54QCo70aoEizb4Cyb 7mP4qz5Q==; Received: from willy by casper.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1oLSsc-00FdEv-Ti; Tue, 09 Aug 2022 17:18:58 +0000 From: "Matthew Wilcox (Oracle)" To: linux-mm@kvack.org Cc: "Matthew Wilcox (Oracle)" , David Hildenbrand , William Kucharski Subject: [PATCH v2 03/16] mm/page_alloc: Export free_frozen_pages() instead of free_unref_page() Date: Tue, 9 Aug 2022 18:18:41 +0100 Message-Id: <20220809171854.3725722-4-willy@infradead.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220809171854.3725722-1-willy@infradead.org> References: <20220809171854.3725722-1-willy@infradead.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1660065541; a=rsa-sha256; cv=none; b=WAI3C3NHU0sgN9agCA73vk/GLRZ9pAkP2Fm3UQbgbGxdxcf1c1dgqeuZy921mbOCwEW2lS /3nqdSui8WqKQ0x1imvw0bzRsNcJp6/FbjTYvtjP9eaBPpTYId7LyKyAuKydC30sLhcMgU 3FLOV/OvF78+oLryzE7XPfAa0byBTn0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1660065541; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=BowTi8Whxz8B8+J+oC83B5WKyDoi0QndQPuny7emV90=; b=pC6TVl6RsfLh5G5bPxqV6jIYSDJ71mpfNXYbmSLebh0mF+2sWpVC2VLEtS0a8xDC80rqof /XUyp0m1jnUBqifbfI9wwn3hCNs30a/t+JcfvF5C+psebknNZ4QzYicB6MzkQGV8moJNRw Qi96RkRq2cO/U7EOX7joH53Rh2hrL0Y= ARC-Authentication-Results: i=1; imf13.hostedemail.com; dkim=pass header.d=infradead.org header.s=casper.20170209 header.b=tUyHqzcr; spf=none (imf13.hostedemail.com: domain of willy@infradead.org has no SPF policy when checking 90.155.50.34) smtp.mailfrom=willy@infradead.org; dmarc=none X-Stat-Signature: d7jeirjoxjqaeema844umb53itpjceyy X-Rspam-User: X-Rspamd-Server: rspam04 X-Rspamd-Queue-Id: 0DD9F2005B Authentication-Results: imf13.hostedemail.com; dkim=pass header.d=infradead.org header.s=casper.20170209 header.b=tUyHqzcr; spf=none (imf13.hostedemail.com: domain of willy@infradead.org has no SPF policy when checking 90.155.50.34) smtp.mailfrom=willy@infradead.org; dmarc=none X-HE-Tag: 1660065540-780251 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: This API makes more sense for slab to use and it works perfectly well for swap. Signed-off-by: Matthew Wilcox (Oracle) Reviewed-by: David Hildenbrand Reviewed-by: William Kucharski --- mm/internal.h | 4 ++-- mm/page_alloc.c | 18 +++++++++--------- mm/swap.c | 2 +- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/mm/internal.h b/mm/internal.h index 785409805ed7..08d0881223cf 100644 --- a/mm/internal.h +++ b/mm/internal.h @@ -362,8 +362,8 @@ 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, unsigned int order); -extern void free_unref_page_list(struct list_head *list); +void free_frozen_pages(struct page *, unsigned int order); +void free_unref_page_list(struct list_head *list); extern void zone_pcp_update(struct zone *zone, int cpu_online); extern void zone_pcp_reset(struct zone *zone); diff --git a/mm/page_alloc.c b/mm/page_alloc.c index 04260b5a7699..30e7a5974d39 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c @@ -761,14 +761,6 @@ static inline bool pcp_allowed_order(unsigned int order) return false; } -static inline void free_frozen_pages(struct page *page, unsigned int order) -{ - if (pcp_allowed_order(order)) /* Via pcp? */ - free_unref_page(page, order); - else - __free_pages_ok(page, order, FPI_NONE); -} - /* * Higher-order pages are called "compound pages". They are structured thusly: * @@ -3464,7 +3456,7 @@ static void free_unref_page_commit(struct zone *zone, struct per_cpu_pages *pcp, /* * Free a pcp page */ -void free_unref_page(struct page *page, unsigned int order) +static void free_unref_page(struct page *page, unsigned int order) { unsigned long flags; unsigned long __maybe_unused UP_flags; @@ -3504,6 +3496,14 @@ void free_unref_page(struct page *page, unsigned int order) pcp_trylock_finish(UP_flags); } +void free_frozen_pages(struct page *page, unsigned int order) +{ + if (pcp_allowed_order(order)) /* Via pcp? */ + free_unref_page(page, order); + else + __free_pages_ok(page, order, FPI_NONE); +} + /* * Free a list of 0-order pages */ diff --git a/mm/swap.c b/mm/swap.c index 6525011b715e..647f6f77193f 100644 --- a/mm/swap.c +++ b/mm/swap.c @@ -102,7 +102,7 @@ static void __folio_put_small(struct folio *folio) { __page_cache_release(folio); mem_cgroup_uncharge(folio); - free_unref_page(&folio->page, 0); + free_frozen_pages(&folio->page, 0); } static void __folio_put_large(struct folio *folio) -- 2.35.1