diff mbox series

[v4,net-next,06/11] skbuff: remove __kfree_skb_flush()

Message ID 20210210162732.80467-7-alobakin@pm.me (mailing list archive)
State Superseded
Delegated to: Netdev Maintainers
Headers show
Series skbuff: introduce skbuff_heads bulking and reusing | expand

Checks

Context Check Description
netdev/cover_letter success Link
netdev/fixes_present success Link
netdev/patch_count success Link
netdev/tree_selection success Clearly marked for net-next
netdev/subject_prefix success Link
netdev/cc_maintainers warning 2 maintainers not CCed: weiwan@google.com nogikh@google.com
netdev/source_inline success Was 0 now: 0
netdev/verify_signedoff success Link
netdev/module_param success Was 0 now: 0
netdev/build_32bit fail Errors and warnings before: 8803 this patch: 8493
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/verify_fixes success Link
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 49 lines checked
netdev/build_allmodconfig_warn fail Errors and warnings before: 9201 this patch: 8888
netdev/header_inline success Link
netdev/stable success Stable not CCed

Commit Message

Alexander Lobakin Feb. 10, 2021, 4:29 p.m. UTC
This function isn't much needed as NAPI skb queue gets bulk-freed
anyway when there's no more room, and even may reduce the efficiency
of bulk operations.
It will be even less needed after reusing skb cache on allocation path,
so remove it and this way lighten network softirqs a bit.

Suggested-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: Alexander Lobakin <alobakin@pm.me>
---
 include/linux/skbuff.h |  1 -
 net/core/dev.c         |  6 +-----
 net/core/skbuff.c      | 12 ------------
 3 files changed, 1 insertion(+), 18 deletions(-)

Comments

kernel test robot Feb. 10, 2021, 8:22 p.m. UTC | #1
Hi Alexander,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on net-next/master]

url:    https://github.com/0day-ci/linux/commits/Alexander-Lobakin/skbuff-introduce-skbuff_heads-bulking-and-reusing/20210211-004041
base:   https://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next.git de1db4a6ed6241e34cab0e5059d4b56f6bae39b9
config: sh-allmodconfig (attached as .config)
compiler: sh4-linux-gcc (GCC) 9.3.0
reproduce (this is a W=1 build):
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # https://github.com/0day-ci/linux/commit/6bb224307d9f31afa154a8825f9acbd8e9f6b490
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review Alexander-Lobakin/skbuff-introduce-skbuff_heads-bulking-and-reusing/20210211-004041
        git checkout 6bb224307d9f31afa154a8825f9acbd8e9f6b490
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross ARCH=sh 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>

All errors (new ones prefixed by >>):

   net/core/dev.c: In function 'napi_threaded_poll':
>> net/core/dev.c:7012:4: error: implicit declaration of function '__kfree_skb_flush'; did you mean '__kfree_skb_defer'? [-Werror=implicit-function-declaration]
    7012 |    __kfree_skb_flush();
         |    ^~~~~~~~~~~~~~~~~
         |    __kfree_skb_defer
   cc1: some warnings being treated as errors

Kconfig warnings: (for reference only)
   WARNING: unmet direct dependencies detected for SND_ATMEL_SOC_PDC
   Depends on SOUND && !UML && SND && SND_SOC && SND_ATMEL_SOC && HAS_DMA
   Selected by
   - SND_ATMEL_SOC_SSC && SOUND && !UML && SND && SND_SOC && SND_ATMEL_SOC
   - SND_ATMEL_SOC_SSC_PDC && SOUND && !UML && SND && SND_SOC && SND_ATMEL_SOC && ATMEL_SSC


vim +7012 net/core/dev.c

29863d41bb6e1d Wei Wang 2021-02-08  6996  
29863d41bb6e1d Wei Wang 2021-02-08  6997  static int napi_threaded_poll(void *data)
29863d41bb6e1d Wei Wang 2021-02-08  6998  {
29863d41bb6e1d Wei Wang 2021-02-08  6999  	struct napi_struct *napi = data;
29863d41bb6e1d Wei Wang 2021-02-08  7000  	void *have;
29863d41bb6e1d Wei Wang 2021-02-08  7001  
29863d41bb6e1d Wei Wang 2021-02-08  7002  	while (!napi_thread_wait(napi)) {
29863d41bb6e1d Wei Wang 2021-02-08  7003  		for (;;) {
29863d41bb6e1d Wei Wang 2021-02-08  7004  			bool repoll = false;
29863d41bb6e1d Wei Wang 2021-02-08  7005  
29863d41bb6e1d Wei Wang 2021-02-08  7006  			local_bh_disable();
29863d41bb6e1d Wei Wang 2021-02-08  7007  
29863d41bb6e1d Wei Wang 2021-02-08  7008  			have = netpoll_poll_lock(napi);
29863d41bb6e1d Wei Wang 2021-02-08  7009  			__napi_poll(napi, &repoll);
29863d41bb6e1d Wei Wang 2021-02-08  7010  			netpoll_poll_unlock(have);
29863d41bb6e1d Wei Wang 2021-02-08  7011  
29863d41bb6e1d Wei Wang 2021-02-08 @7012  			__kfree_skb_flush();
29863d41bb6e1d Wei Wang 2021-02-08  7013  			local_bh_enable();
29863d41bb6e1d Wei Wang 2021-02-08  7014  
29863d41bb6e1d Wei Wang 2021-02-08  7015  			if (!repoll)
29863d41bb6e1d Wei Wang 2021-02-08  7016  				break;
29863d41bb6e1d Wei Wang 2021-02-08  7017  
29863d41bb6e1d Wei Wang 2021-02-08  7018  			cond_resched();
29863d41bb6e1d Wei Wang 2021-02-08  7019  		}
29863d41bb6e1d Wei Wang 2021-02-08  7020  	}
29863d41bb6e1d Wei Wang 2021-02-08  7021  	return 0;
29863d41bb6e1d Wei Wang 2021-02-08  7022  }
29863d41bb6e1d Wei Wang 2021-02-08  7023  

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
kernel test robot Feb. 11, 2021, 12:19 a.m. UTC | #2
Hi Alexander,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on net-next/master]

url:    https://github.com/0day-ci/linux/commits/Alexander-Lobakin/skbuff-introduce-skbuff_heads-bulking-and-reusing/20210211-004041
base:   https://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next.git de1db4a6ed6241e34cab0e5059d4b56f6bae39b9
config: s390-randconfig-r025-20210209 (attached as .config)
compiler: clang version 12.0.0 (https://github.com/llvm/llvm-project c9439ca36342fb6013187d0a69aef92736951476)
reproduce (this is a W=1 build):
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # install s390 cross compiling tool for clang build
        # apt-get install binutils-s390x-linux-gnu
        # https://github.com/0day-ci/linux/commit/6bb224307d9f31afa154a8825f9acbd8e9f6b490
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review Alexander-Lobakin/skbuff-introduce-skbuff_heads-bulking-and-reusing/20210211-004041
        git checkout 6bb224307d9f31afa154a8825f9acbd8e9f6b490
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=s390 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>

All errors (new ones prefixed by >>):

   In file included from include/linux/skbuff.h:31:
   In file included from include/linux/dma-mapping.h:10:
   In file included from include/linux/scatterlist.h:9:
   In file included from arch/s390/include/asm/io.h:80:
   include/asm-generic/io.h:490:61: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
           val = __le32_to_cpu((__le32 __force)__raw_readl(PCI_IOBASE + addr));
                                                           ~~~~~~~~~~ ^
   include/uapi/linux/byteorder/big_endian.h:34:59: note: expanded from macro '__le32_to_cpu'
   #define __le32_to_cpu(x) __swab32((__force __u32)(__le32)(x))
                                                             ^
   include/uapi/linux/swab.h:119:21: note: expanded from macro '__swab32'
           ___constant_swab32(x) :                 \
                              ^
   include/uapi/linux/swab.h:20:12: note: expanded from macro '___constant_swab32'
           (((__u32)(x) & (__u32)0x0000ff00UL) <<  8) |            \
                     ^
   In file included from net/core/dev.c:89:
   In file included from include/linux/if_ether.h:19:
   In file included from include/linux/skbuff.h:31:
   In file included from include/linux/dma-mapping.h:10:
   In file included from include/linux/scatterlist.h:9:
   In file included from arch/s390/include/asm/io.h:80:
   include/asm-generic/io.h:490:61: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
           val = __le32_to_cpu((__le32 __force)__raw_readl(PCI_IOBASE + addr));
                                                           ~~~~~~~~~~ ^
   include/uapi/linux/byteorder/big_endian.h:34:59: note: expanded from macro '__le32_to_cpu'
   #define __le32_to_cpu(x) __swab32((__force __u32)(__le32)(x))
                                                             ^
   include/uapi/linux/swab.h:119:21: note: expanded from macro '__swab32'
           ___constant_swab32(x) :                 \
                              ^
   include/uapi/linux/swab.h:21:12: note: expanded from macro '___constant_swab32'
           (((__u32)(x) & (__u32)0x00ff0000UL) >>  8) |            \
                     ^
   In file included from net/core/dev.c:89:
   In file included from include/linux/if_ether.h:19:
   In file included from include/linux/skbuff.h:31:
   In file included from include/linux/dma-mapping.h:10:
   In file included from include/linux/scatterlist.h:9:
   In file included from arch/s390/include/asm/io.h:80:
   include/asm-generic/io.h:490:61: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
           val = __le32_to_cpu((__le32 __force)__raw_readl(PCI_IOBASE + addr));
                                                           ~~~~~~~~~~ ^
   include/uapi/linux/byteorder/big_endian.h:34:59: note: expanded from macro '__le32_to_cpu'
   #define __le32_to_cpu(x) __swab32((__force __u32)(__le32)(x))
                                                             ^
   include/uapi/linux/swab.h:119:21: note: expanded from macro '__swab32'
           ___constant_swab32(x) :                 \
                              ^
   include/uapi/linux/swab.h:22:12: note: expanded from macro '___constant_swab32'
           (((__u32)(x) & (__u32)0xff000000UL) >> 24)))
                     ^
   In file included from net/core/dev.c:89:
   In file included from include/linux/if_ether.h:19:
   In file included from include/linux/skbuff.h:31:
   In file included from include/linux/dma-mapping.h:10:
   In file included from include/linux/scatterlist.h:9:
   In file included from arch/s390/include/asm/io.h:80:
   include/asm-generic/io.h:490:61: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
           val = __le32_to_cpu((__le32 __force)__raw_readl(PCI_IOBASE + addr));
                                                           ~~~~~~~~~~ ^
   include/uapi/linux/byteorder/big_endian.h:34:59: note: expanded from macro '__le32_to_cpu'
   #define __le32_to_cpu(x) __swab32((__force __u32)(__le32)(x))
                                                             ^
   include/uapi/linux/swab.h:120:12: note: expanded from macro '__swab32'
           __fswab32(x))
                     ^
   In file included from net/core/dev.c:89:
   In file included from include/linux/if_ether.h:19:
   In file included from include/linux/skbuff.h:31:
   In file included from include/linux/dma-mapping.h:10:
   In file included from include/linux/scatterlist.h:9:
   In file included from arch/s390/include/asm/io.h:80:
   include/asm-generic/io.h:501:33: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
           __raw_writeb(value, PCI_IOBASE + addr);
                               ~~~~~~~~~~ ^
   include/asm-generic/io.h:511:59: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
           __raw_writew((u16 __force)cpu_to_le16(value), PCI_IOBASE + addr);
                                                         ~~~~~~~~~~ ^
   include/asm-generic/io.h:521:59: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
           __raw_writel((u32 __force)cpu_to_le32(value), PCI_IOBASE + addr);
                                                         ~~~~~~~~~~ ^
   include/asm-generic/io.h:609:20: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
           readsb(PCI_IOBASE + addr, buffer, count);
                  ~~~~~~~~~~ ^
   include/asm-generic/io.h:617:20: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
           readsw(PCI_IOBASE + addr, buffer, count);
                  ~~~~~~~~~~ ^
   include/asm-generic/io.h:625:20: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
           readsl(PCI_IOBASE + addr, buffer, count);
                  ~~~~~~~~~~ ^
   include/asm-generic/io.h:634:21: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
           writesb(PCI_IOBASE + addr, buffer, count);
                   ~~~~~~~~~~ ^
   include/asm-generic/io.h:643:21: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
           writesw(PCI_IOBASE + addr, buffer, count);
                   ~~~~~~~~~~ ^
   include/asm-generic/io.h:652:21: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
           writesl(PCI_IOBASE + addr, buffer, count);
                   ~~~~~~~~~~ ^
>> net/core/dev.c:7012:4: error: implicit declaration of function '__kfree_skb_flush' [-Werror,-Wimplicit-function-declaration]
                           __kfree_skb_flush();
                           ^
   20 warnings and 1 error generated.


vim +/__kfree_skb_flush +7012 net/core/dev.c

29863d41bb6e1d Wei Wang 2021-02-08  6996  
29863d41bb6e1d Wei Wang 2021-02-08  6997  static int napi_threaded_poll(void *data)
29863d41bb6e1d Wei Wang 2021-02-08  6998  {
29863d41bb6e1d Wei Wang 2021-02-08  6999  	struct napi_struct *napi = data;
29863d41bb6e1d Wei Wang 2021-02-08  7000  	void *have;
29863d41bb6e1d Wei Wang 2021-02-08  7001  
29863d41bb6e1d Wei Wang 2021-02-08  7002  	while (!napi_thread_wait(napi)) {
29863d41bb6e1d Wei Wang 2021-02-08  7003  		for (;;) {
29863d41bb6e1d Wei Wang 2021-02-08  7004  			bool repoll = false;
29863d41bb6e1d Wei Wang 2021-02-08  7005  
29863d41bb6e1d Wei Wang 2021-02-08  7006  			local_bh_disable();
29863d41bb6e1d Wei Wang 2021-02-08  7007  
29863d41bb6e1d Wei Wang 2021-02-08  7008  			have = netpoll_poll_lock(napi);
29863d41bb6e1d Wei Wang 2021-02-08  7009  			__napi_poll(napi, &repoll);
29863d41bb6e1d Wei Wang 2021-02-08  7010  			netpoll_poll_unlock(have);
29863d41bb6e1d Wei Wang 2021-02-08  7011  
29863d41bb6e1d Wei Wang 2021-02-08 @7012  			__kfree_skb_flush();
29863d41bb6e1d Wei Wang 2021-02-08  7013  			local_bh_enable();
29863d41bb6e1d Wei Wang 2021-02-08  7014  
29863d41bb6e1d Wei Wang 2021-02-08  7015  			if (!repoll)
29863d41bb6e1d Wei Wang 2021-02-08  7016  				break;
29863d41bb6e1d Wei Wang 2021-02-08  7017  
29863d41bb6e1d Wei Wang 2021-02-08  7018  			cond_resched();
29863d41bb6e1d Wei Wang 2021-02-08  7019  		}
29863d41bb6e1d Wei Wang 2021-02-08  7020  	}
29863d41bb6e1d Wei Wang 2021-02-08  7021  	return 0;
29863d41bb6e1d Wei Wang 2021-02-08  7022  }
29863d41bb6e1d Wei Wang 2021-02-08  7023  

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
diff mbox series

Patch

diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h
index 0a4e91a2f873..0e0707296098 100644
--- a/include/linux/skbuff.h
+++ b/include/linux/skbuff.h
@@ -2919,7 +2919,6 @@  static inline struct sk_buff *napi_alloc_skb(struct napi_struct *napi,
 }
 void napi_consume_skb(struct sk_buff *skb, int budget);
 
-void __kfree_skb_flush(void);
 void __kfree_skb_defer(struct sk_buff *skb);
 
 /**
diff --git a/net/core/dev.c b/net/core/dev.c
index 7647278e46f0..7134ae2fc0db 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -4944,8 +4944,6 @@  static __latent_entropy void net_tx_action(struct softirq_action *h)
 			else
 				__kfree_skb_defer(skb);
 		}
-
-		__kfree_skb_flush();
 	}
 
 	if (sd->output_queue) {
@@ -7041,7 +7039,7 @@  static __latent_entropy void net_rx_action(struct softirq_action *h)
 
 		if (list_empty(&list)) {
 			if (!sd_has_rps_ipi_waiting(sd) && list_empty(&repoll))
-				goto out;
+				return;
 			break;
 		}
 
@@ -7068,8 +7066,6 @@  static __latent_entropy void net_rx_action(struct softirq_action *h)
 		__raise_softirq_irqoff(NET_RX_SOFTIRQ);
 
 	net_rps_action_and_irq_enable(sd);
-out:
-	__kfree_skb_flush();
 }
 
 struct netdev_adjacent {
diff --git a/net/core/skbuff.c b/net/core/skbuff.c
index 1c6f6ef70339..4be2bb969535 100644
--- a/net/core/skbuff.c
+++ b/net/core/skbuff.c
@@ -838,18 +838,6 @@  void __consume_stateless_skb(struct sk_buff *skb)
 	kfree_skbmem(skb);
 }
 
-void __kfree_skb_flush(void)
-{
-	struct napi_alloc_cache *nc = this_cpu_ptr(&napi_alloc_cache);
-
-	/* flush skb_cache if containing objects */
-	if (nc->skb_count) {
-		kmem_cache_free_bulk(skbuff_head_cache, nc->skb_count,
-				     nc->skb_cache);
-		nc->skb_count = 0;
-	}
-}
-
 static inline void _kfree_skb_defer(struct sk_buff *skb)
 {
 	struct napi_alloc_cache *nc = this_cpu_ptr(&napi_alloc_cache);