summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexander Duyck <alexander.h.duyck@intel.com>2017-01-10 19:58:06 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2017-01-10 21:31:55 -0500
commit8c2dd3e4a4bae78093c4a5cee6494877651be3c9 (patch)
treed615ea6a6e65bbe9fba82d7c944ad3e762bd1f8d
parentb4536f0c829c8586544c94735c343f9b5070bd01 (diff)
mm: rename __alloc_page_frag to page_frag_alloc and __free_page_frag to page_frag_free
Patch series "Page fragment updates", v4. This patch series takes care of a few cleanups for the page fragments API. First we do some renames so that things are much more consistent. First we move the page_frag_ portion of the name to the front of the functions names. Secondly we split out the cache specific functions from the other page fragment functions by adding the word "cache" to the name. Finally I added a bit of documentation that will hopefully help to explain some of this. I plan to revisit this later as we get things more ironed out in the near future with the changes planned for the DMA setup to support eXpress Data Path. This patch (of 3): 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. Link: http://lkml.kernel.org/r/20170104023854.13451.67390.stgit@localhost.localdomain Signed-off-by: Alexander Duyck <alexander.h.duyck@intel.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
-rw-r--r--include/linux/gfp.h6
-rw-r--r--include/linux/skbuff.h2
-rw-r--r--mm/page_alloc.c10
-rw-r--r--net/core/skbuff.c8
4 files changed, 13 insertions, 13 deletions
diff --git a/include/linux/gfp.h b/include/linux/gfp.h
index 7806a8f80abc..ed77a86fbbb0 100644
--- a/include/linux/gfp.h
+++ b/include/linux/gfp.h
@@ -501,9 +501,9 @@ extern void free_hot_cold_page_list(struct list_head *list, bool cold);
501struct page_frag_cache; 501struct page_frag_cache;
502extern void __page_frag_drain(struct page *page, unsigned int order, 502extern void __page_frag_drain(struct page *page, unsigned int order,
503 unsigned int count); 503 unsigned int count);
504extern void *__alloc_page_frag(struct page_frag_cache *nc, 504extern void *page_frag_alloc(struct page_frag_cache *nc,
505 unsigned int fragsz, gfp_t gfp_mask); 505 unsigned int fragsz, gfp_t gfp_mask);
506extern void __free_page_frag(void *addr); 506extern void page_frag_free(void *addr);
507 507
508#define __free_page(page) __free_pages((page), 0) 508#define __free_page(page) __free_pages((page), 0)
509#define free_page(addr) free_pages((addr), 0) 509#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,
2480 2480
2481static inline void skb_free_frag(void *addr) 2481static inline void skb_free_frag(void *addr)
2482{ 2482{
2483 __free_page_frag(addr); 2483 page_frag_free(addr);
2484} 2484}
2485 2485
2486void *napi_alloc_frag(unsigned int fragsz); 2486void *napi_alloc_frag(unsigned int fragsz);
diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index 74afdb4177cb..097893ffe194 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -3931,8 +3931,8 @@ void __page_frag_drain(struct page *page, unsigned int order,
3931} 3931}
3932EXPORT_SYMBOL(__page_frag_drain); 3932EXPORT_SYMBOL(__page_frag_drain);
3933 3933
3934void *__alloc_page_frag(struct page_frag_cache *nc, 3934void *page_frag_alloc(struct page_frag_cache *nc,
3935 unsigned int fragsz, gfp_t gfp_mask) 3935 unsigned int fragsz, gfp_t gfp_mask)
3936{ 3936{
3937 unsigned int size = PAGE_SIZE; 3937 unsigned int size = PAGE_SIZE;
3938 struct page *page; 3938 struct page *page;
@@ -3983,19 +3983,19 @@ refill:
3983 3983
3984 return nc->va + offset; 3984 return nc->va + offset;
3985} 3985}
3986EXPORT_SYMBOL(__alloc_page_frag); 3986EXPORT_SYMBOL(page_frag_alloc);
3987 3987
3988/* 3988/*
3989 * Frees a page fragment allocated out of either a compound or order 0 page. 3989 * Frees a page fragment allocated out of either a compound or order 0 page.
3990 */ 3990 */
3991void __free_page_frag(void *addr) 3991void page_frag_free(void *addr)
3992{ 3992{
3993 struct page *page = virt_to_head_page(addr); 3993 struct page *page = virt_to_head_page(addr);
3994 3994
3995 if (unlikely(put_page_testzero(page))) 3995 if (unlikely(put_page_testzero(page)))
3996 __free_pages_ok(page, compound_order(page)); 3996 __free_pages_ok(page, compound_order(page));
3997} 3997}
3998EXPORT_SYMBOL(__free_page_frag); 3998EXPORT_SYMBOL(page_frag_free);
3999 3999
4000static void *make_alloc_exact(unsigned long addr, unsigned int order, 4000static void *make_alloc_exact(unsigned long addr, unsigned int order,
4001 size_t size) 4001 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)
369 369
370 local_irq_save(flags); 370 local_irq_save(flags);
371 nc = this_cpu_ptr(&netdev_alloc_cache); 371 nc = this_cpu_ptr(&netdev_alloc_cache);
372 data = __alloc_page_frag(nc, fragsz, gfp_mask); 372 data = page_frag_alloc(nc, fragsz, gfp_mask);
373 local_irq_restore(flags); 373 local_irq_restore(flags);
374 return data; 374 return data;
375} 375}
@@ -391,7 +391,7 @@ static void *__napi_alloc_frag(unsigned int fragsz, gfp_t gfp_mask)
391{ 391{
392 struct napi_alloc_cache *nc = this_cpu_ptr(&napi_alloc_cache); 392 struct napi_alloc_cache *nc = this_cpu_ptr(&napi_alloc_cache);
393 393
394 return __alloc_page_frag(&nc->page, fragsz, gfp_mask); 394 return page_frag_alloc(&nc->page, fragsz, gfp_mask);
395} 395}
396 396
397void *napi_alloc_frag(unsigned int fragsz) 397void *napi_alloc_frag(unsigned int fragsz)
@@ -441,7 +441,7 @@ struct sk_buff *__netdev_alloc_skb(struct net_device *dev, unsigned int len,
441 local_irq_save(flags); 441 local_irq_save(flags);
442 442
443 nc = this_cpu_ptr(&netdev_alloc_cache); 443 nc = this_cpu_ptr(&netdev_alloc_cache);
444 data = __alloc_page_frag(nc, len, gfp_mask); 444 data = page_frag_alloc(nc, len, gfp_mask);
445 pfmemalloc = nc->pfmemalloc; 445 pfmemalloc = nc->pfmemalloc;
446 446
447 local_irq_restore(flags); 447 local_irq_restore(flags);
@@ -505,7 +505,7 @@ struct sk_buff *__napi_alloc_skb(struct napi_struct *napi, unsigned int len,
505 if (sk_memalloc_socks()) 505 if (sk_memalloc_socks())
506 gfp_mask |= __GFP_MEMALLOC; 506 gfp_mask |= __GFP_MEMALLOC;
507 507
508 data = __alloc_page_frag(&nc->page, len, gfp_mask); 508 data = page_frag_alloc(&nc->page, len, gfp_mask);
509 if (unlikely(!data)) 509 if (unlikely(!data))
510 return NULL; 510 return NULL;
511 511