From patchwork Sun Mar 19 21:59:55 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Rapoport X-Patchwork-Id: 13180631 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 C3142C76195 for ; Sun, 19 Mar 2023 22:00:34 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 52D9D900005; Sun, 19 Mar 2023 18:00:34 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 4DDBC900002; Sun, 19 Mar 2023 18:00:34 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 3A5E5900005; Sun, 19 Mar 2023 18:00:34 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id 2B39A900002 for ; Sun, 19 Mar 2023 18:00:34 -0400 (EDT) Received: from smtpin19.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay05.hostedemail.com (Postfix) with ESMTP id C18C340460 for ; Sun, 19 Mar 2023 22:00:33 +0000 (UTC) X-FDA: 80587017546.19.F3877D1 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by imf29.hostedemail.com (Postfix) with ESMTP id E5B07120013 for ; Sun, 19 Mar 2023 22:00:31 +0000 (UTC) Authentication-Results: imf29.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=oXkUKnzy; spf=pass (imf29.hostedemail.com: domain of rppt@kernel.org designates 145.40.68.75 as permitted sender) smtp.mailfrom=rppt@kernel.org; dmarc=pass (policy=none) header.from=kernel.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1679263232; 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=26pZEosbU4xGB6qgXEMEJK0JR82wYmZqc6u/6bp3w5o=; b=DwPGz+spF2RKtYgpR74VZcMPBMmzpK7BvVLjR4MsKy6TgCRU+/aYLoFHkleiHrxmlWbn9o f6d+SMO1PtIMva779WaA8jEkS6vqu6uLy8wQqQze/feAtLNfQg5BmlOZ7vuzO5Dliz7ANf McnpAF8CUdzdrpj/RDIOsQ3kZQiR6vM= ARC-Authentication-Results: i=1; imf29.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=oXkUKnzy; spf=pass (imf29.hostedemail.com: domain of rppt@kernel.org designates 145.40.68.75 as permitted sender) smtp.mailfrom=rppt@kernel.org; dmarc=pass (policy=none) header.from=kernel.org ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1679263232; a=rsa-sha256; cv=none; b=0Tp/qH1JKlzaglOJjsLUp4fhoPAJEkhV6eKDwSIY3n3o2hdBhBFd/1XSfXN6sMYVV7+7qQ S9bLQEP4dO9gnKTugokFqIaeNWti1GzLJDRPpRJMluLxtRPikZLiOMS+gTS5dkwq9S+avR 2istSXYtqB+oWgVw4zW92MsOHe45sDA= Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 8C56CB80D28; Sun, 19 Mar 2023 22:00:30 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4C11FC433A0; Sun, 19 Mar 2023 22:00:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1679263229; bh=zekLhry5fbzdsyyFVJESg5+PbdXiqA638EXDFWo0PPs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=oXkUKnzydDJ71mPtZtGDkbDpHakn4+vm9e5hsj9ZXIp26esqmpKA0HKya3tWcGwU9 hHaJ6/V57EkzRpGi8lnjrEYAjO5VItMs/Md0bbdadjwge+a9/WTyHI1abD1pUrKKYQ h9K7yRauBXU7Tw8Mq2jgvBEw9AE21CER4YwrQv5CWjBxfQ9UHdb/tQXfSG95r6LaJQ vBhjliYse44G7HvTmgehhaqQXcvX1kGezbx65UwsYMW0fffJYTYM3h1pRApRzerWw0 c/X95FgbZkXr+iJhGJ6iUvnfoAIV/WrZXrD5FY4iZUFuWW7Tdw/Lw0s9FGHu1TLONU lRE/6FdnqUlYQ== From: Mike Rapoport To: Andrew Morton Cc: David Hildenbrand , Matthew Wilcox , Mel Gorman , Michal Hocko , Mike Rapoport , Thomas Bogendoerfer , Vlastimil Babka , linux-kernel@vger.kernel.org, linux-mips@vger.kernel.org, linux-mm@kvack.org Subject: [PATCH 02/15] mm/cma: move init_cma_reserved_pages() to cma.c and make it static Date: Sun, 19 Mar 2023 23:59:55 +0200 Message-Id: <20230319220008.2138576-3-rppt@kernel.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20230319220008.2138576-1-rppt@kernel.org> References: <20230319220008.2138576-1-rppt@kernel.org> MIME-Version: 1.0 X-Rspamd-Queue-Id: E5B07120013 X-Stat-Signature: n85d3eqo7q1qsesdz88uuypcgspt7xhy X-Rspam-User: X-Rspamd-Server: rspam08 X-HE-Tag: 1679263231-637754 X-HE-Meta: U2FsdGVkX18czncFOtjsoBLwgdGVitvFGyuTHHqkNreLV6W+cCI9/uRwHhC8HGPWTPjJHMdaNaze5tR72765KItwISveK1mP7RNqvUKSGorDSssT0Lz0oycd4+Io78ajemZRDnRZOKwDgIJDY28z2tMTRcgluvzBGCJVWXti3a0XRGcFqINIhMlQkTnW8zGsKiZMz/33F3HZIOGkn8X6n0GYarfjLu2hGG7MW8YKcb3C1KxViIBO5AwcXczK2L4wkTFxhNX118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UNLp6acpAr7TykY8mBM5XdHE+Pov9Y+jF9+QvNf+zyVzsp/x509q2GzgCE8ZW9EshUg5CIr9O+w== 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: From: "Mike Rapoport (IBM)" init_cma_reserved_pages() only used in cma.c, no point of having it in page_alloc.c. Move init_cma_reserved_pages() to cma.c and make it static. Signed-off-by: Mike Rapoport (IBM) --- include/linux/gfp.h | 5 ----- mm/cma.c | 21 +++++++++++++++++++++ mm/page_alloc.c | 21 --------------------- 3 files changed, 21 insertions(+), 26 deletions(-) diff --git a/include/linux/gfp.h b/include/linux/gfp.h index 65a78773dcca..7c554e4bd49f 100644 --- a/include/linux/gfp.h +++ b/include/linux/gfp.h @@ -361,9 +361,4 @@ extern struct page *alloc_contig_pages(unsigned long nr_pages, gfp_t gfp_mask, #endif void free_contig_range(unsigned long pfn, unsigned long nr_pages); -#ifdef CONFIG_CMA -/* CMA stuff */ -extern void init_cma_reserved_pageblock(struct page *page); -#endif - #endif /* __LINUX_GFP_H */ diff --git a/mm/cma.c b/mm/cma.c index a7263aa02c92..ce08fb9825b4 100644 --- a/mm/cma.c +++ b/mm/cma.c @@ -31,8 +31,10 @@ #include #include #include +#include #include +#include "internal.h" #include "cma.h" struct cma cma_areas[MAX_CMA_AREAS]; @@ -93,6 +95,25 @@ static void cma_clear_bitmap(struct cma *cma, unsigned long pfn, spin_unlock_irqrestore(&cma->lock, flags); } +/* Free whole pageblock and set its migration type to MIGRATE_CMA. */ +static void init_cma_reserved_pageblock(struct page *page) +{ + unsigned i = pageblock_nr_pages; + struct page *p = page; + + do { + __ClearPageReserved(p); + set_page_count(p, 0); + } while (++p, --i); + + set_pageblock_migratetype(page, MIGRATE_CMA); + set_page_refcounted(page); + __free_pages(page, pageblock_order); + + adjust_managed_page_count(page, pageblock_nr_pages); + page_zone(page)->cma_pages += pageblock_nr_pages; +} + static void __init cma_activate_area(struct cma *cma) { unsigned long base_pfn = cma->base_pfn, pfn; diff --git a/mm/page_alloc.c b/mm/page_alloc.c index 87d760236dba..22e3da842e3f 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c @@ -2280,27 +2280,6 @@ void __init page_alloc_init_late(void) set_zone_contiguous(zone); } -#ifdef CONFIG_CMA -/* Free whole pageblock and set its migration type to MIGRATE_CMA. */ -void __init init_cma_reserved_pageblock(struct page *page) -{ - unsigned i = pageblock_nr_pages; - struct page *p = page; - - do { - __ClearPageReserved(p); - set_page_count(p, 0); - } while (++p, --i); - - set_pageblock_migratetype(page, MIGRATE_CMA); - set_page_refcounted(page); - __free_pages(page, pageblock_order); - - adjust_managed_page_count(page, pageblock_nr_pages); - page_zone(page)->cma_pages += pageblock_nr_pages; -} -#endif - /* * The order of subdivision here is critical for the IO subsystem. * Please do not alter this order without good reasons and regression