1 From: Alexander Duyck <alexander.h.duyck@intel.com>
2 Date: Tue, 10 Jan 2017 16:58:09 -0800
3 Subject: [PATCH] mm: rename __page_frag functions to __page_frag_cache, drop
6 This patch does two things.
8 First it goes through and renames the __page_frag prefixed functions to
9 __page_frag_cache so that we can be clear that we are draining or
10 refilling the cache, not the frags themselves.
12 Second we drop the order parameter from __page_frag_cache_drain since we
13 don't actually need to pass it since all fragments are either order 0 or
14 must be a compound page.
16 Link: http://lkml.kernel.org/r/20170104023954.13451.5678.stgit@localhost.localdomain
17 Signed-off-by: Alexander Duyck <alexander.h.duyck@intel.com>
18 Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
19 Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
22 --- a/include/linux/gfp.h
23 +++ b/include/linux/gfp.h
24 @@ -506,8 +506,7 @@ extern void free_hot_cold_page(struct pa
25 extern void free_hot_cold_page_list(struct list_head *list, bool cold);
27 struct page_frag_cache;
28 -extern void __page_frag_drain(struct page *page, unsigned int order,
29 - unsigned int count);
30 +extern void __page_frag_cache_drain(struct page *page, unsigned int count);
31 extern void *page_frag_alloc(struct page_frag_cache *nc,
32 unsigned int fragsz, gfp_t gfp_mask);
33 extern void page_frag_free(void *addr);
36 @@ -3924,8 +3924,8 @@ EXPORT_SYMBOL(free_pages);
37 * drivers to provide a backing region of memory for use as either an
38 * sk_buff->head, or to be used in the "frags" portion of skb_shared_info.
40 -static struct page *__page_frag_refill(struct page_frag_cache *nc,
42 +static struct page *__page_frag_cache_refill(struct page_frag_cache *nc,
45 struct page *page = NULL;
47 @@ -3945,19 +3945,20 @@ static struct page *__page_frag_refill(s
51 -void __page_frag_drain(struct page *page, unsigned int order,
53 +void __page_frag_cache_drain(struct page *page, unsigned int count)
55 VM_BUG_ON_PAGE(page_ref_count(page) == 0, page);
57 if (page_ref_sub_and_test(page, count)) {
58 + unsigned int order = compound_order(page);
61 free_hot_cold_page(page, false);
63 __free_pages_ok(page, order);
66 -EXPORT_SYMBOL(__page_frag_drain);
67 +EXPORT_SYMBOL(__page_frag_cache_drain);
69 void *page_frag_alloc(struct page_frag_cache *nc,
70 unsigned int fragsz, gfp_t gfp_mask)
71 @@ -3968,7 +3969,7 @@ void *page_frag_alloc(struct page_frag_c
73 if (unlikely(!nc->va)) {
75 - page = __page_frag_refill(nc, gfp_mask);
76 + page = __page_frag_cache_refill(nc, gfp_mask);