netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH -next] net/ipv4/tcp_metrics.c: remove superfluous header files from tcp_metrics.c
@ 2021-09-25 14:27 Mianhan Liu
  2021-09-25 16:12 ` Eric Dumazet
  0 siblings, 1 reply; 2+ messages in thread
From: Mianhan Liu @ 2021-09-25 14:27 UTC (permalink / raw)
  To: Eric Dumazet, David S. Miller, Hideaki YOSHIFUJI, David Ahern
  Cc: Jakub Kicinski, netdev, linux-kernel, Mianhan Liu

tcp_metrics.c hasn't use any macro or function declared in rcupdate.h
spinlock.h, module.h, cache.h, hash.h and vmalloc.h. Thus, these files
can be removed from tcp_metrics.c safely without affecting the compilation
of the net module.

Signed-off-by: Mianhan Liu <liumh1@shanghaitech.edu.cn>

---
 net/ipv4/tcp_metrics.c | 6 ------
 1 file changed, 6 deletions(-)

diff --git a/net/ipv4/tcp_metrics.c b/net/ipv4/tcp_metrics.c
index 0588b004d..7b819530d 100644
--- a/net/ipv4/tcp_metrics.c
+++ b/net/ipv4/tcp_metrics.c
@@ -1,15 +1,9 @@
 // SPDX-License-Identifier: GPL-2.0
-#include <linux/rcupdate.h>
-#include <linux/spinlock.h>
 #include <linux/jiffies.h>
-#include <linux/module.h>
-#include <linux/cache.h>
 #include <linux/slab.h>
 #include <linux/init.h>
 #include <linux/tcp.h>
-#include <linux/hash.h>
 #include <linux/tcp_metrics.h>
-#include <linux/vmalloc.h>
 
 #include <net/inet_connection_sock.h>
 #include <net/net_namespace.h>
-- 
2.25.1



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

* Re: [PATCH -next] net/ipv4/tcp_metrics.c: remove superfluous header files from tcp_metrics.c
  2021-09-25 14:27 [PATCH -next] net/ipv4/tcp_metrics.c: remove superfluous header files from tcp_metrics.c Mianhan Liu
@ 2021-09-25 16:12 ` Eric Dumazet
  0 siblings, 0 replies; 2+ messages in thread
From: Eric Dumazet @ 2021-09-25 16:12 UTC (permalink / raw)
  To: Mianhan Liu
  Cc: David S. Miller, Hideaki YOSHIFUJI, David Ahern, Jakub Kicinski,
	netdev, LKML

On Sat, Sep 25, 2021 at 7:27 AM Mianhan Liu <liumh1@shanghaitech.edu.cn> wrote:
>
> tcp_metrics.c hasn't use any macro or function declared in rcupdate.h
> spinlock.h, module.h, cache.h, hash.h and vmalloc.h. Thus, these files
> can be removed from tcp_metrics.c safely without affecting the compilation
> of the net module.

This seems pretty much relying on other includes.
(eg #include <linux/tcp.h> brings many things already)

We do not generally do this.


>
> Signed-off-by: Mianhan Liu <liumh1@shanghaitech.edu.cn>
>
> ---
>  net/ipv4/tcp_metrics.c | 6 ------
>  1 file changed, 6 deletions(-)
>
> diff --git a/net/ipv4/tcp_metrics.c b/net/ipv4/tcp_metrics.c
> index 0588b004d..7b819530d 100644
> --- a/net/ipv4/tcp_metrics.c
> +++ b/net/ipv4/tcp_metrics.c
> @@ -1,15 +1,9 @@
>  // SPDX-License-Identifier: GPL-2.0
> -#include <linux/rcupdate.h>

We do use rcu stuff in this file.

> -#include <linux/spinlock.h>

We do use spinlocks in tcp_metrics.c

>  #include <linux/jiffies.h>
> -#include <linux/module.h>
> -#include <linux/cache.h>
>  #include <linux/slab.h>
>  #include <linux/init.h>
>  #include <linux/tcp.h>
> -#include <linux/hash.h>
>  #include <linux/tcp_metrics.h>
> -#include <linux/vmalloc.h>

Not sure why kvzalloc() is not in linux/vmalloc.h

Honestly I do not even know why we spend time trying to reduce list of includes.

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

end of thread, other threads:[~2021-09-25 16:19 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-09-25 14:27 [PATCH -next] net/ipv4/tcp_metrics.c: remove superfluous header files from tcp_metrics.c Mianhan Liu
2021-09-25 16:12 ` Eric Dumazet

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).