diff mbox

[next,v3,1/3] mm: Rename __alloc_page_frag to page_frag_alloc and __free_page_frag to page_frag_free

Message ID 20170103171024.5144.17036.stgit@localhost.localdomain
State Awaiting Upstream
Headers show

Commit Message

Alexander H Duyck Jan. 3, 2017, 5:11 p.m. UTC
From: Alexander Duyck <alexander.h.duyck@intel.com>

This patch renames the page frag functions to be more consistent with other
APIs.  Specifically we place the name page_frag first in the name and then
have either an alloc or free call name that we append as the suffix.  This
makes it a bit clearer in terms of naming.

In addition we drop the leading double underscores since we are technically
no longer a backing interface and instead the front end that is called from
the networking APIs.

Signed-off-by: Alexander Duyck <alexander.h.duyck@intel.com>
---

v2: Fixed a comparison between a void* and 0 due to copy/paste from free_pages
v3: Dropped changes to function and make this a rename patch only.
    This fixes a small performance regression I saw in some tests.

 include/linux/gfp.h    |    2 +-
 include/linux/skbuff.h |    2 +-
 mm/page_alloc.c        |   10 +++++-----
 net/core/skbuff.c      |    8 ++++----
 4 files changed, 11 insertions(+), 11 deletions(-)

Comments

kernel test robot Jan. 4, 2017, 12:58 a.m. UTC | #1
Hi Alexander,

[auto build test ERROR on mmotm/master]
[also build test ERROR on v4.10-rc2 next-20170103]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url:    https://github.com/0day-ci/linux/commits/Alexander-Duyck/Page-fragment-updates/20170104-080239
base:   git://git.cmpxchg.org/linux-mmotm.git master
config: i386-randconfig-x003-201701 (attached as .config)
compiler: gcc-6 (Debian 6.2.0-3) 6.2.0 20160901
reproduce:
        # save the attached .config to linux build tree
        make ARCH=i386 

Note: the linux-review/Alexander-Duyck/Page-fragment-updates/20170104-080239 HEAD 81fa8f8a69c1b7187ae789eb536cdfcb3263d366 builds fine.
      It only hurts bisectibility.

All error/warnings (new ones prefixed by >>):

   net/core/skbuff.c: In function '__netdev_alloc_frag':
>> net/core/skbuff.c:372:9: error: implicit declaration of function 'page_frag_alloc' [-Werror=implicit-function-declaration]
     data = page_frag_alloc(nc, fragsz, gfp_mask);
            ^~~~~~~~~~~~~~~
>> net/core/skbuff.c:372:7: warning: assignment makes pointer from integer without a cast [-Wint-conversion]
     data = page_frag_alloc(nc, fragsz, gfp_mask);
          ^
   net/core/skbuff.c: In function '__napi_alloc_frag':
>> net/core/skbuff.c:394:9: warning: return makes pointer from integer without a cast [-Wint-conversion]
     return page_frag_alloc(&nc->page, fragsz, gfp_mask);
            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   net/core/skbuff.c: In function '__netdev_alloc_skb':
   net/core/skbuff.c:444:7: warning: assignment makes pointer from integer without a cast [-Wint-conversion]
     data = page_frag_alloc(nc, len, gfp_mask);
          ^
   net/core/skbuff.c: In function '__napi_alloc_skb':
   net/core/skbuff.c:508:7: warning: assignment makes pointer from integer without a cast [-Wint-conversion]
     data = page_frag_alloc(&nc->page, len, gfp_mask);
          ^
   cc1: some warnings being treated as errors

vim +/page_frag_alloc +372 net/core/skbuff.c

   366		struct page_frag_cache *nc;
   367		unsigned long flags;
   368		void *data;
   369	
   370		local_irq_save(flags);
   371		nc = this_cpu_ptr(&netdev_alloc_cache);
 > 372		data = page_frag_alloc(nc, fragsz, gfp_mask);
   373		local_irq_restore(flags);
   374		return data;
   375	}
   376	
   377	/**
   378	 * netdev_alloc_frag - allocate a page fragment
   379	 * @fragsz: fragment size
   380	 *
   381	 * Allocates a frag from a page for receive buffer.
   382	 * Uses GFP_ATOMIC allocations.
   383	 */
   384	void *netdev_alloc_frag(unsigned int fragsz)
   385	{
   386		return __netdev_alloc_frag(fragsz, GFP_ATOMIC | __GFP_COLD);
   387	}
   388	EXPORT_SYMBOL(netdev_alloc_frag);
   389	
   390	static void *__napi_alloc_frag(unsigned int fragsz, gfp_t gfp_mask)
   391	{
   392		struct napi_alloc_cache *nc = this_cpu_ptr(&napi_alloc_cache);
   393	
 > 394		return page_frag_alloc(&nc->page, fragsz, gfp_mask);
   395	}
   396	
   397	void *napi_alloc_frag(unsigned int fragsz)

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation
diff mbox

Patch

diff --git a/include/linux/gfp.h b/include/linux/gfp.h
index 4175dca4ac39..19621300fa53 100644
--- a/include/linux/gfp.h
+++ b/include/linux/gfp.h
@@ -510,7 +510,7 @@  extern void __page_frag_drain(struct page *page, unsigned int order,
 			      unsigned int count);
 extern void *__alloc_page_frag(struct page_frag_cache *nc,
 			       unsigned int fragsz, gfp_t gfp_mask);
-extern void __free_page_frag(void *addr);
+extern void page_frag_free(void *addr);
 
 #define __free_page(page) __free_pages((page), 0)
 #define free_page(addr) free_pages((addr), 0)
diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h
index b53c0cfd417e..a410715bbef8 100644
--- a/include/linux/skbuff.h
+++ b/include/linux/skbuff.h
@@ -2480,7 +2480,7 @@  static inline struct sk_buff *netdev_alloc_skb_ip_align(struct net_device *dev,
 
 static inline void skb_free_frag(void *addr)
 {
-	__free_page_frag(addr);
+	page_frag_free(addr);
 }
 
 void *napi_alloc_frag(unsigned int fragsz);
diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index 2c6d5f64feca..9534e44308b2 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -3939,8 +3939,8 @@  void __page_frag_drain(struct page *page, unsigned int order,
 }
 EXPORT_SYMBOL(__page_frag_drain);
 
-void *__alloc_page_frag(struct page_frag_cache *nc,
-			unsigned int fragsz, gfp_t gfp_mask)
+void *page_frag_alloc(struct page_frag_cache *nc,
+		      unsigned int fragsz, gfp_t gfp_mask)
 {
 	unsigned int size = PAGE_SIZE;
 	struct page *page;
@@ -3991,19 +3991,19 @@  void *__alloc_page_frag(struct page_frag_cache *nc,
 
 	return nc->va + offset;
 }
-EXPORT_SYMBOL(__alloc_page_frag);
+EXPORT_SYMBOL(page_frag_alloc);
 
 /*
  * Frees a page fragment allocated out of either a compound or order 0 page.
  */
-void __free_page_frag(void *addr)
+void page_frag_free(void *addr)
 {
 	struct page *page = virt_to_head_page(addr);
 
 	if (unlikely(put_page_testzero(page)))
 		__free_pages_ok(page, compound_order(page));
 }
-EXPORT_SYMBOL(__free_page_frag);
+EXPORT_SYMBOL(page_frag_free);
 
 static void *make_alloc_exact(unsigned long addr, unsigned int order,
 		size_t size)
diff --git a/net/core/skbuff.c b/net/core/skbuff.c
index 5a03730fbc1a..734c71468b01 100644
--- a/net/core/skbuff.c
+++ b/net/core/skbuff.c
@@ -369,7 +369,7 @@  static void *__netdev_alloc_frag(unsigned int fragsz, gfp_t gfp_mask)
 
 	local_irq_save(flags);
 	nc = this_cpu_ptr(&netdev_alloc_cache);
-	data = __alloc_page_frag(nc, fragsz, gfp_mask);
+	data = page_frag_alloc(nc, fragsz, gfp_mask);
 	local_irq_restore(flags);
 	return data;
 }
@@ -391,7 +391,7 @@  static void *__napi_alloc_frag(unsigned int fragsz, gfp_t gfp_mask)
 {
 	struct napi_alloc_cache *nc = this_cpu_ptr(&napi_alloc_cache);
 
-	return __alloc_page_frag(&nc->page, fragsz, gfp_mask);
+	return page_frag_alloc(&nc->page, fragsz, gfp_mask);
 }
 
 void *napi_alloc_frag(unsigned int fragsz)
@@ -441,7 +441,7 @@  struct sk_buff *__netdev_alloc_skb(struct net_device *dev, unsigned int len,
 	local_irq_save(flags);
 
 	nc = this_cpu_ptr(&netdev_alloc_cache);
-	data = __alloc_page_frag(nc, len, gfp_mask);
+	data = page_frag_alloc(nc, len, gfp_mask);
 	pfmemalloc = nc->pfmemalloc;
 
 	local_irq_restore(flags);
@@ -505,7 +505,7 @@  struct sk_buff *__napi_alloc_skb(struct napi_struct *napi, unsigned int len,
 	if (sk_memalloc_socks())
 		gfp_mask |= __GFP_MEMALLOC;
 
-	data = __alloc_page_frag(&nc->page, len, gfp_mask);
+	data = page_frag_alloc(&nc->page, len, gfp_mask);
 	if (unlikely(!data))
 		return NULL;