kernel: bump 4.9 to 4.9.160
[openwrt/openwrt.git] / target / linux / generic / backport-4.9 / 041-mm-rename-__alloc_page_frag-to-page_frag_alloc-and-_.patch
1 From: Alexander Duyck <alexander.h.duyck@intel.com>
2 Date: Tue, 10 Jan 2017 16:58:06 -0800
3 Subject: [PATCH] mm: rename __alloc_page_frag to page_frag_alloc and
4 __free_page_frag to page_frag_free
5
6 Patch series "Page fragment updates", v4.
7
8 This patch series takes care of a few cleanups for the page fragments
9 API.
10
11 First we do some renames so that things are much more consistent. First
12 we move the page_frag_ portion of the name to the front of the functions
13 names. Secondly we split out the cache specific functions from the
14 other page fragment functions by adding the word "cache" to the name.
15
16 Finally I added a bit of documentation that will hopefully help to
17 explain some of this. I plan to revisit this later as we get things
18 more ironed out in the near future with the changes planned for the DMA
19 setup to support eXpress Data Path.
20
21 This patch (of 3):
22
23 This patch renames the page frag functions to be more consistent with
24 other APIs. Specifically we place the name page_frag first in the name
25 and then have either an alloc or free call name that we append as the
26 suffix. This makes it a bit clearer in terms of naming.
27
28 In addition we drop the leading double underscores since we are
29 technically no longer a backing interface and instead the front end that
30 is called from the networking APIs.
31
32 Link: http://lkml.kernel.org/r/20170104023854.13451.67390.stgit@localhost.localdomain
33 Signed-off-by: Alexander Duyck <alexander.h.duyck@intel.com>
34 Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
35 Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
36 ---
37
38 --- a/include/linux/gfp.h
39 +++ b/include/linux/gfp.h
40 @@ -508,9 +508,9 @@ extern void free_hot_cold_page_list(stru
41 struct page_frag_cache;
42 extern void __page_frag_drain(struct page *page, unsigned int order,
43 unsigned int count);
44 -extern void *__alloc_page_frag(struct page_frag_cache *nc,
45 - unsigned int fragsz, gfp_t gfp_mask);
46 -extern void __free_page_frag(void *addr);
47 +extern void *page_frag_alloc(struct page_frag_cache *nc,
48 + unsigned int fragsz, gfp_t gfp_mask);
49 +extern void page_frag_free(void *addr);
50
51 #define __free_page(page) __free_pages((page), 0)
52 #define free_page(addr) free_pages((addr), 0)
53 --- a/include/linux/skbuff.h
54 +++ b/include/linux/skbuff.h
55 @@ -2476,7 +2476,7 @@ static inline struct sk_buff *netdev_all
56
57 static inline void skb_free_frag(void *addr)
58 {
59 - __free_page_frag(addr);
60 + page_frag_free(addr);
61 }
62
63 void *napi_alloc_frag(unsigned int fragsz);
64 --- a/mm/page_alloc.c
65 +++ b/mm/page_alloc.c
66 @@ -3949,8 +3949,8 @@ void __page_frag_drain(struct page *page
67 }
68 EXPORT_SYMBOL(__page_frag_drain);
69
70 -void *__alloc_page_frag(struct page_frag_cache *nc,
71 - unsigned int fragsz, gfp_t gfp_mask)
72 +void *page_frag_alloc(struct page_frag_cache *nc,
73 + unsigned int fragsz, gfp_t gfp_mask)
74 {
75 unsigned int size = PAGE_SIZE;
76 struct page *page;
77 @@ -4001,19 +4001,19 @@ refill:
78
79 return nc->va + offset;
80 }
81 -EXPORT_SYMBOL(__alloc_page_frag);
82 +EXPORT_SYMBOL(page_frag_alloc);
83
84 /*
85 * Frees a page fragment allocated out of either a compound or order 0 page.
86 */
87 -void __free_page_frag(void *addr)
88 +void page_frag_free(void *addr)
89 {
90 struct page *page = virt_to_head_page(addr);
91
92 if (unlikely(put_page_testzero(page)))
93 __free_pages_ok(page, compound_order(page));
94 }
95 -EXPORT_SYMBOL(__free_page_frag);
96 +EXPORT_SYMBOL(page_frag_free);
97
98 static void *make_alloc_exact(unsigned long addr, unsigned int order,
99 size_t size)
100 --- a/net/core/skbuff.c
101 +++ b/net/core/skbuff.c
102 @@ -369,7 +369,7 @@ static void *__netdev_alloc_frag(unsigne
103
104 local_irq_save(flags);
105 nc = this_cpu_ptr(&netdev_alloc_cache);
106 - data = __alloc_page_frag(nc, fragsz, gfp_mask);
107 + data = page_frag_alloc(nc, fragsz, gfp_mask);
108 local_irq_restore(flags);
109 return data;
110 }
111 @@ -393,7 +393,7 @@ static void *__napi_alloc_frag(unsigned
112 {
113 struct napi_alloc_cache *nc = this_cpu_ptr(&napi_alloc_cache);
114
115 - return __alloc_page_frag(&nc->page, fragsz, gfp_mask);
116 + return page_frag_alloc(&nc->page, fragsz, gfp_mask);
117 }
118
119 void *napi_alloc_frag(unsigned int fragsz)
120 @@ -445,7 +445,7 @@ struct sk_buff *__netdev_alloc_skb(struc
121 local_irq_save(flags);
122
123 nc = this_cpu_ptr(&netdev_alloc_cache);
124 - data = __alloc_page_frag(nc, len, gfp_mask);
125 + data = page_frag_alloc(nc, len, gfp_mask);
126 pfmemalloc = nc->pfmemalloc;
127
128 local_irq_restore(flags);
129 @@ -509,7 +509,7 @@ struct sk_buff *__napi_alloc_skb(struct
130 if (sk_memalloc_socks())
131 gfp_mask |= __GFP_MEMALLOC;
132
133 - data = __alloc_page_frag(&nc->page, len, gfp_mask);
134 + data = page_frag_alloc(&nc->page, len, gfp_mask);
135 if (unlikely(!data))
136 return NULL;
137