Skip to content

Commit

Permalink
include/linux/mm.h: move nr_free_buffer_pages from swap.h to mm.h
Browse files Browse the repository at this point in the history
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.

Link: https://lkml.kernel.org/r/[email protected]
Signed-off-by: Mianhan Liu <[email protected]>
Cc: Jakub Kicinski <[email protected]>
CC: Ulf Hansson <[email protected]>
Cc: "David S . Miller" <[email protected]>
Cc: Simon Horman <[email protected]>
Cc: Pravin B Shelar <[email protected]>
Cc: Vlad Yasevich <[email protected]>
Cc: Marcelo Ricardo Leitner <[email protected]>
Cc: Matthew Wilcox <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
  • Loading branch information
oscarliu2019 authored and torvalds committed Nov 6, 2021
1 parent 53944f1 commit a1554c0
Show file tree
Hide file tree
Showing 8 changed files with 2 additions and 7 deletions.
1 change: 0 additions & 1 deletion drivers/mmc/core/mmc_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
#include <linux/slab.h>

#include <linux/scatterlist.h>
#include <linux/swap.h> /* For nr_free_buffer_pages() */
#include <linux/list.h>

#include <linux/debugfs.h>
Expand Down
2 changes: 2 additions & 0 deletions include/linux/mm.h
Original file line number Diff line number Diff line change
Expand Up @@ -875,6 +875,8 @@ void put_pages_list(struct list_head *pages);
void split_page(struct page *page, unsigned int order);
void copy_huge_page(struct page *dst, struct page *src);

unsigned long nr_free_buffer_pages(void);

/*
* Compound pages have a destructor function. Provide a
* prototype for that function and accessor functions.
Expand Down
1 change: 0 additions & 1 deletion include/linux/swap.h
Original file line number Diff line number Diff line change
Expand Up @@ -335,7 +335,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)
Expand Down
1 change: 0 additions & 1 deletion net/ipv4/tcp.c
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down
1 change: 0 additions & 1 deletion net/ipv4/udp.c
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,6 @@
#include <asm/ioctls.h>
#include <linux/memblock.h>
#include <linux/highmem.h>
#include <linux/swap.h>
#include <linux/types.h>
#include <linux/fcntl.h>
#include <linux/module.h>
Expand Down
1 change: 0 additions & 1 deletion net/netfilter/ipvs/ip_vs_ctl.c
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
#include <linux/sysctl.h>
#include <linux/proc_fs.h>
#include <linux/workqueue.h>
#include <linux/swap.h>
#include <linux/seq_file.h>
#include <linux/slab.h>

Expand Down
1 change: 0 additions & 1 deletion net/openvswitch/meter.c
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
#include <linux/openvswitch.h>
#include <linux/netlink.h>
#include <linux/rculist.h>
#include <linux/swap.h>

#include <net/netlink.h>
#include <net/genetlink.h>
Expand Down
1 change: 0 additions & 1 deletion net/sctp/protocol.c
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@
#include <linux/seq_file.h>
#include <linux/memblock.h>
#include <linux/highmem.h>
#include <linux/swap.h>
#include <linux/slab.h>
#include <net/net_namespace.h>
#include <net/protocol.h>
Expand Down

0 comments on commit a1554c0

Please sign in to comment.