From patchwork Sun Sep 12 13:36:40 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mianhan Liu X-Patchwork-Id: 12486921 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.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,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 CF00DC433F5 for ; Sun, 12 Sep 2021 13:38:16 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 4BF3B610CE for ; Sun, 12 Sep 2021 13:38:16 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 4BF3B610CE Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=shanghaitech.edu.cn Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=kvack.org Received: by kanga.kvack.org (Postfix) id A91E8900002; Sun, 12 Sep 2021 09:38:15 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id A41876B0072; Sun, 12 Sep 2021 09:38:15 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 8E14C900002; Sun, 12 Sep 2021 09:38:15 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0186.hostedemail.com [216.40.44.186]) by kanga.kvack.org (Postfix) with ESMTP id 7A96B6B0071 for ; Sun, 12 Sep 2021 09:38:15 -0400 (EDT) Received: from smtpin34.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id 2D48229E09 for ; Sun, 12 Sep 2021 13:38:15 +0000 (UTC) X-FDA: 78579025350.34.DFE3207 Received: from mail.shanghaitech.edu.cn (mail.shanghaitech.edu.cn [119.78.254.11]) by imf15.hostedemail.com (Postfix) with ESMTP id EB6DBD000097 for ; Sun, 12 Sep 2021 13:38:12 +0000 (UTC) Received: from [10.15.44.216] by mail.shanghaitech.edu.cn with MESSAGESEC ESMTP id 4804012443630103; Sun, 12 Sep 2021 21:37:16 +0800 (CST) Received: from DESKTOP-U066CHB.localdomain (10.15.44.220) by smtp.shanghaitech.edu.cn (10.15.44.216) with Microsoft SMTP Server (TLS) id 14.3.399.0; Sun, 12 Sep 2021 21:37:16 +0800 From: Mianhan Liu To: Andrew Morton , Jakub Kicinski CC: Ulf Hansson , "David S . Miller" , Simon Horman , Pravin B Shelar , Vlad Yasevich , Marcelo Ricardo Leitner , , , Matthew Wilcox , Mianhan Liu Subject: [PATCH -next v3] include/linux/mm.h: move nr_free_buffer_pages from swap.h to mm.h Date: Sun, 12 Sep 2021 21:36:40 +0800 Message-ID: <20210912133640.1624-1-liumh1@shanghaitech.edu.cn> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 X-Originating-IP: [10.15.44.220] X-Rspamd-Server: rspam01 X-Rspamd-Queue-Id: EB6DBD000097 Authentication-Results: imf15.hostedemail.com; dkim=none; dmarc=pass (policy=none) header.from=shanghaitech.edu.cn; spf=pass (imf15.hostedemail.com: domain of liumh1@shanghaitech.edu.cn designates 119.78.254.11 as permitted sender) smtp.mailfrom=liumh1@shanghaitech.edu.cn X-Stat-Signature: wb6gsfnkyckjeamrtambdjdaozu6g9zb X-HE-Tag: 1631453892-84696 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: nr_free_buffer_pages could be exposed through mm.h instead of swap.h. The advantage of this change is that it can reduce the obsolete includes. For example, net/ipv4/tcp.c wouldn't need swap.h any more since it has already included mm.h. Similarly, after checking all the other files, it comes that tcp.c, udp.c meter.c ,... follow the same rule, so these files can have swap.h removed too. Moreover, after preprocessing all the files that use nr_free_buffer_pages, it turns out that those files have already included mm.h.Thus, we can move nr_free_buffer_pages from swap.h to mm.h safely. This change will not affect the compilation of other files. Signed-off-by: Mianhan Liu --- drivers/mmc/core/mmc_test.c | 1 - include/linux/mm.h | 2 +- include/linux/swap.h | 1 - net/ipv4/tcp.c | 1 - net/ipv4/udp.c | 1 - net/netfilter/ipvs/ip_vs_ctl.c | 1 - net/openvswitch/meter.c | 1 - net/sctp/protocol.c | 1 - 8 files changed, 1 insertion(+), 8 deletions(-) diff --git a/drivers/mmc/core/mmc_test.c b/drivers/mmc/core/mmc_test.c index 63524551a..e6a2fd2c6 100644 --- a/drivers/mmc/core/mmc_test.c +++ b/drivers/mmc/core/mmc_test.c @@ -10,7 +10,6 @@ #include #include -#include /* For nr_free_buffer_pages() */ #include #include diff --git a/include/linux/mm.h b/include/linux/mm.h index d0b5c5e19..d499fde70 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h @@ -869,7 +869,7 @@ void put_pages_list(struct list_head *pages); void split_page(struct page *page, unsigned int order); void folio_copy(struct folio *dst, struct folio *src); - +unsigned long nr_free_buffer_pages(void); /* * Compound pages have a destructor function. Provide a * prototype for that function and accessor functions. diff --git a/include/linux/swap.h b/include/linux/swap.h index cdf0957a8..d1ea44b31 100644 --- a/include/linux/swap.h +++ b/include/linux/swap.h @@ -341,7 +341,6 @@ void workingset_update_node(struct xa_node *node); /* linux/mm/page_alloc.c */ extern unsigned long totalreserve_pages; -extern unsigned long nr_free_buffer_pages(void); /* Definition of global_zone_page_state not available yet */ #define nr_free_pages() global_zone_page_state(NR_FREE_PAGES) diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c index e8b48df73..0109279df 100644 --- a/net/ipv4/tcp.c +++ b/net/ipv4/tcp.c @@ -260,7 +260,6 @@ #include #include #include -#include #include #include #include diff --git a/net/ipv4/udp.c b/net/ipv4/udp.c index 8851c9463..c99983b43 100644 --- a/net/ipv4/udp.c +++ b/net/ipv4/udp.c @@ -78,7 +78,6 @@ #include #include #include -#include #include #include #include diff --git a/net/netfilter/ipvs/ip_vs_ctl.c b/net/netfilter/ipvs/ip_vs_ctl.c index c25097092..034e537bb 100644 --- a/net/netfilter/ipvs/ip_vs_ctl.c +++ b/net/netfilter/ipvs/ip_vs_ctl.c @@ -24,7 +24,6 @@ #include #include #include -#include #include #include diff --git a/net/openvswitch/meter.c b/net/openvswitch/meter.c index 896b8f5bc..04a060ac7 100644 --- a/net/openvswitch/meter.c +++ b/net/openvswitch/meter.c @@ -12,7 +12,6 @@ #include #include #include -#include #include #include diff --git a/net/sctp/protocol.c b/net/sctp/protocol.c index ec0f52567..35928fefa 100644 --- a/net/sctp/protocol.c +++ b/net/sctp/protocol.c @@ -33,7 +33,6 @@ #include #include #include -#include #include #include #include