LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
* [PATCH -next] net/ipv4/tcp.c: remove superfluous header file in tcp.c
@ 2021-08-11 13:33 Mianhan Liu
  2021-08-11 14:19 ` Eric Dumazet
  0 siblings, 1 reply; 3+ messages in thread
From: Mianhan Liu @ 2021-08-11 13:33 UTC (permalink / raw)
  To: Eric Dumazet, David S . Miller, Hideaki YOSHIFUJI, David Ahern
  Cc: netdev, linux-kernel, Matthew, MianHan Liu

nr_free_buffer_pages could be exposed through mm.h instead of swap.h,
and then tcp.c wouldn't need swap.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
so as to reduce the obsolete includes.

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



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH -next] net/ipv4/tcp.c: remove superfluous header file in tcp.c
  2021-08-11 13:33 [PATCH -next] net/ipv4/tcp.c: remove superfluous header file in tcp.c Mianhan Liu
@ 2021-08-11 14:19 ` Eric Dumazet
  0 siblings, 0 replies; 3+ messages in thread
From: Eric Dumazet @ 2021-08-11 14:19 UTC (permalink / raw)
  To: Mianhan Liu, Eric Dumazet, David S . Miller, Hideaki YOSHIFUJI,
	David Ahern
  Cc: netdev, linux-kernel, Matthew



On 8/11/21 3:33 PM, Mianhan Liu wrote:
> nr_free_buffer_pages could be exposed through mm.h instead of swap.h,
> and then tcp.c wouldn't need swap.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
> so as to reduce the obsolete includes.
> 
> Signed-off-by: MianHan Liu <liumh1@shanghaitech.edu.cn>

Not sure why tcp gets a special treatment.
Patch title does not match changelog at all.

You should submit a pure mm patch, then eventually one networking follow up.

# git grep -n linux/swap.h -- net
net/9p/trans_virtio.c:34:#include <linux/swap.h>
net/ipv4/sysctl_net_ipv4.c:18:#include <linux/swap.h>
net/ipv4/tcp.c:263:#include <linux/swap.h>
net/ipv4/udp.c:81:#include <linux/swap.h>
net/netfilter/ipvs/ip_vs_ctl.c:27:#include <linux/swap.h>
net/openvswitch/meter.c:15:#include <linux/swap.h>
net/sctp/protocol.c:36:#include <linux/swap.h>


^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PATCH -next] net/ipv4/tcp.c: remove superfluous header file in tcp.c
@ 2021-08-11 13:56 Mianhan Liu
  0 siblings, 0 replies; 3+ messages in thread
From: Mianhan Liu @ 2021-08-11 13:56 UTC (permalink / raw)
  To: Eric Dumazet, David S . Miller, Hideaki YOSHIFUJI, David Ahern
  Cc: netdev, linux-kernel, Matthew Wilcox, MianHan Liu

nr_free_buffer_pages could be exposed through mm.h instead of swap.h,
and then tcp.c wouldn't need swap.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
so as to reduce the obsolete includes.

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



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-08-11 14:19 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-11 13:33 [PATCH -next] net/ipv4/tcp.c: remove superfluous header file in tcp.c Mianhan Liu
2021-08-11 14:19 ` Eric Dumazet
2021-08-11 13:56 Mianhan Liu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).