linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Mianhan Liu <liumh1@shanghaitech.edu.cn>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: <linux-mm@kvack.org>, <linux-kernel@vger.kernel.org>,
	Eric Dumazet <edumazet@google.com>,
	Mianhan Liu <liumh1@shanghaitech.edu.cn>
Subject: [PATCH -next v2] include/linux/mm.h: move nr_free_buffer_pages from swap.h to mm.h
Date: Sun, 15 Aug 2021 19:50:57 +0800	[thread overview]
Message-ID: <20210815115057.1511-1-liumh1@shanghaitech.edu.cn> (raw)

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.
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 <liumh1@shanghaitech.edu.cn>
---
 include/linux/mm.h   | 1 +
 include/linux/swap.h | 2 +-
 net/ipv4/tcp.c       | 1 -
 3 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/include/linux/mm.h b/include/linux/mm.h
index ce8fc0fd6..6ca7b7fba 100644
--- a/include/linux/mm.h
+++ b/include/linux/mm.h
@@ -871,6 +871,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);
 
+extern 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..22b17431a 100644
--- a/include/linux/swap.h
+++ b/include/linux/swap.h
@@ -341,7 +341,7 @@ 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 f931def63..dcdd8ebfb 100644
--- a/net/ipv4/tcp.c
+++ b/net/ipv4/tcp.c
@@ -260,7 +260,6 @@
 #include <linux/random.h>
 #include <linux/memblock.h>
 #include <linux/highmem.h>
-#include <linux/swap.h>
 #include <linux/cache.h>
 #include <linux/err.h>
 #include <linux/time.h>
-- 
2.25.1




             reply	other threads:[~2021-08-15 11:52 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-15 11:50 Mianhan Liu [this message]
2021-08-15 15:30 ` Matthew Wilcox

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210815115057.1511-1-liumh1@shanghaitech.edu.cn \
    --to=liumh1@shanghaitech.edu.cn \
    --cc=akpm@linux-foundation.org \
    --cc=edumazet@google.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox