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 31FFEC433EF for ; Fri, 17 Dec 2021 09:50:56 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 878876B0071; Fri, 17 Dec 2021 04:50:45 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 827D26B0072; Fri, 17 Dec 2021 04:50:45 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 6F0DD6B0073; Fri, 17 Dec 2021 04:50:45 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0101.hostedemail.com [216.40.44.101]) by kanga.kvack.org (Postfix) with ESMTP id 610D26B0071 for ; Fri, 17 Dec 2021 04:50:45 -0500 (EST) Received: from smtpin12.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id 2522A82499B9 for ; Fri, 17 Dec 2021 09:50:35 +0000 (UTC) X-FDA: 78926816430.12.1E2A96B Received: from mail-pg1-f175.google.com (mail-pg1-f175.google.com [209.85.215.175]) by imf03.hostedemail.com (Postfix) with ESMTP id 24A7620006 for ; Fri, 17 Dec 2021 09:50:32 +0000 (UTC) Received: by mail-pg1-f175.google.com with SMTP id q16so1595397pgq.10 for ; Fri, 17 Dec 2021 01:50:32 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bytedance-com.20210112.gappssmtp.com; s=20210112; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=rypggmWj2ZAR/qBSI7OyiNkg4p9nnMtSBFRsWhsabrA=; b=eMaXZ9DNADrf6LYLKFamcJVyOxhIpEzD5wgYlnNTckyKN6ED+hY8L3FhTE4y8fdsHI Ju3yYPhoSEroXER7y14QuqbTCrF80FPNrHtPP+Xj6TsKGEy+dc9TaqAHqapB1RGQBYnL FT3QVDFvHKBEoVNw+0dZjmKyY3RAPbEpfR3s+UyTmZnMiGtnj/fmP9k3tpnWwpPctkmX wWbGw+FOnrPXvlZF/IeVFvae6JzbTTYJzDph840A+fyfbns7UFtkehiwJz1OcitgBEWR ZrYRKKn4+hJJS1tJqLBcj1b8GAaqlZ1CzdmEtELhKAiBnSB7XUXy84fwa23aS0Krthsc sRYQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=rypggmWj2ZAR/qBSI7OyiNkg4p9nnMtSBFRsWhsabrA=; b=i4jOPIMp/3O0njnFtkaz7zJ/H047KKJPDRQBYp07e7RoFGVC7LCo6nGy2NhCeiYG7R glpjKwi4Ykgr2C7uNz4+yMk4EDqWirT7/1v6eNAopOKs+1JvSInVes/Y60TsPoDRZazf LWanEYnlMqxIyNjOhc4cOIyL1QzYpXYIZufWNP5K7H/uDiGPcy+Caz45/fKWOKBP+lGP lcCj/7rhfdl3M4uTppZtmrG7MakdlrqRwl3tJIL98DCKonA96Z+GZ+e3SJw3sU6bYmRT o7uz0WjnJ52lLef9EzKaLO8owOQea6WNFWF4suIS6Rd75HNSVNrlAZ71eWTCUjtCR4Hq kX9w== X-Gm-Message-State: AOAM532wusTrvE7IQ/6xPYIbmHxOGIvML3UvbsToTG6Kl0L1PkXC5jqB Ny5Zm4LwIBRXZmlSDyMThC/1ug== X-Google-Smtp-Source: ABdhPJyXAe+mFABlJukIfX+yxy5iTzogn0nR/bdksiB/PzmFmpvw9Y1V/5Vxtri71v0ALhcbkADZlQ== X-Received: by 2002:a63:f651:: with SMTP id u17mr2148049pgj.256.1639734631784; Fri, 17 Dec 2021 01:50:31 -0800 (PST) Received: from C02CPFUZMD6M.bytedance.net ([61.120.150.71]) by smtp.gmail.com with ESMTPSA id nv12sm8759229pjb.49.2021.12.17.01.50.28 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Fri, 17 Dec 2021 01:50:31 -0800 (PST) From: Ting Liu To: akpm@linux-foundation.org Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, vbabka@suse.cz, shakeelb@google.com, willy@infradead.org, sjpark@amazon.de, "liuting.0x7c00" Subject: [PATCH] mm: make some vars and functions static or __init Date: Fri, 17 Dec 2021 17:50:23 +0800 Message-Id: <20211217095023.67293-1-liuting.0x7c00@bytedance.com> X-Mailer: git-send-email 2.30.1 (Apple Git-130) MIME-Version: 1.0 X-Rspamd-Queue-Id: 24A7620006 X-Stat-Signature: 3ou5r35wdpayfw8canbkoz4pyzndqy4o Authentication-Results: imf03.hostedemail.com; dkim=pass header.d=bytedance-com.20210112.gappssmtp.com header.s=20210112 header.b=eMaXZ9DN; dmarc=pass (policy=none) header.from=bytedance.com; spf=pass (imf03.hostedemail.com: domain of liuting.0x7c00@bytedance.com designates 209.85.215.175 as permitted sender) smtp.mailfrom=liuting.0x7c00@bytedance.com X-Rspamd-Server: rspam02 X-HE-Tag: 1639734632-808976 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: From: "liuting.0x7c00" "page_idle_ops" as a global var, but its scope of use within this document. So it should be static. "page_ext_ops" is a var used in the kernel initial phase. And other functions are aslo used in the kernel initial phase. So they should be __init or __initdata to reclaim memory. Signed-off-by: liuting.0x7c00 Signed-off-by: Ting Liu --- include/linux/page_idle.h | 1 - mm/page_ext.c | 4 ++-- mm/page_owner.c | 4 ++-- 3 files changed, 4 insertions(+), 5 deletions(-) diff --git a/include/linux/page_idle.h b/include/linux/page_idle.h index 83abf95e9fa7..4663dfed1293 100644 --- a/include/linux/page_idle.h +++ b/include/linux/page_idle.h @@ -13,7 +13,6 @@ * If there is not enough space to store Idle and Young bits in page fla= gs, use * page ext flags instead. */ -extern struct page_ext_operations page_idle_ops; =20 static inline bool folio_test_young(struct folio *folio) { diff --git a/mm/page_ext.c b/mm/page_ext.c index 6242afb24d84..eecd7221143d 100644 --- a/mm/page_ext.c +++ b/mm/page_ext.c @@ -63,12 +63,12 @@ static bool need_page_idle(void) { return true; } -struct page_ext_operations page_idle_ops =3D { +static struct page_ext_operations page_idle_ops __initdata =3D { .need =3D need_page_idle, }; #endif =20 -static struct page_ext_operations *page_ext_ops[] =3D { +static struct page_ext_operations *page_ext_ops[] __initdata =3D { #ifdef CONFIG_PAGE_OWNER &page_owner_ops, #endif diff --git a/mm/page_owner.c b/mm/page_owner.c index 4f924957ce7a..5eea061bb1e5 100644 --- a/mm/page_owner.c +++ b/mm/page_owner.c @@ -46,7 +46,7 @@ static int __init early_page_owner_param(char *buf) } early_param("page_owner", early_page_owner_param); =20 -static bool need_page_owner(void) +static __init bool need_page_owner(void) { return page_owner_enabled; } @@ -75,7 +75,7 @@ static noinline void register_early_stack(void) early_handle =3D create_dummy_stack(); } =20 -static void init_page_owner(void) +static __init void init_page_owner(void) { if (!page_owner_enabled) return; --=20 2.20.1