diff options
author | Dave Hansen <dave.hansen@linux.intel.com> | 2014-04-08 16:44:27 -0400 |
---|---|---|
committer | Pekka Enberg <penberg@kernel.org> | 2014-04-11 03:06:06 -0400 |
commit | 34bf6ef94a835a8f1d8abd3e7d38c6c08d205867 (patch) | |
tree | a5e285e441036ed1d78033192b7eaf74300f4984 /mm | |
parent | 5f0985bb1123b48bbfc632006bdbe76d3dfea76b (diff) |
mm: slab/slub: use page->list consistently instead of page->lru
'struct page' has two list_head fields: 'lru' and 'list'. Conveniently,
they are unioned together. This means that code can use them
interchangably, which gets horribly confusing like with this nugget from
slab.c:
> list_del(&page->lru);
> if (page->active == cachep->num)
> list_add(&page->list, &n->slabs_full);
This patch makes the slab and slub code use page->lru universally instead
of mixing ->list and ->lru.
So, the new rule is: page->lru is what the you use if you want to keep
your page on a list. Don't like the fact that it's not called ->list?
Too bad.
Signed-off-by: Dave Hansen <dave.hansen@linux.intel.com>
Acked-by: Christoph Lameter <cl@linux.com>
Acked-by: David Rientjes <rientjes@google.com>
Cc: Pekka Enberg <penberg@kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
Diffstat (limited to 'mm')
-rw-r--r-- | mm/slab.c | 4 | ||||
-rw-r--r-- | mm/slob.c | 10 |
2 files changed, 7 insertions, 7 deletions
@@ -2922,9 +2922,9 @@ retry: | |||
2922 | /* move slabp to correct slabp list: */ | 2922 | /* move slabp to correct slabp list: */ |
2923 | list_del(&page->lru); | 2923 | list_del(&page->lru); |
2924 | if (page->active == cachep->num) | 2924 | if (page->active == cachep->num) |
2925 | list_add(&page->list, &n->slabs_full); | 2925 | list_add(&page->lru, &n->slabs_full); |
2926 | else | 2926 | else |
2927 | list_add(&page->list, &n->slabs_partial); | 2927 | list_add(&page->lru, &n->slabs_partial); |
2928 | } | 2928 | } |
2929 | 2929 | ||
2930 | must_grow: | 2930 | must_grow: |
@@ -111,13 +111,13 @@ static inline int slob_page_free(struct page *sp) | |||
111 | 111 | ||
112 | static void set_slob_page_free(struct page *sp, struct list_head *list) | 112 | static void set_slob_page_free(struct page *sp, struct list_head *list) |
113 | { | 113 | { |
114 | list_add(&sp->list, list); | 114 | list_add(&sp->lru, list); |
115 | __SetPageSlobFree(sp); | 115 | __SetPageSlobFree(sp); |
116 | } | 116 | } |
117 | 117 | ||
118 | static inline void clear_slob_page_free(struct page *sp) | 118 | static inline void clear_slob_page_free(struct page *sp) |
119 | { | 119 | { |
120 | list_del(&sp->list); | 120 | list_del(&sp->lru); |
121 | __ClearPageSlobFree(sp); | 121 | __ClearPageSlobFree(sp); |
122 | } | 122 | } |
123 | 123 | ||
@@ -282,7 +282,7 @@ static void *slob_alloc(size_t size, gfp_t gfp, int align, int node) | |||
282 | 282 | ||
283 | spin_lock_irqsave(&slob_lock, flags); | 283 | spin_lock_irqsave(&slob_lock, flags); |
284 | /* Iterate through each partially free page, try to find room */ | 284 | /* Iterate through each partially free page, try to find room */ |
285 | list_for_each_entry(sp, slob_list, list) { | 285 | list_for_each_entry(sp, slob_list, lru) { |
286 | #ifdef CONFIG_NUMA | 286 | #ifdef CONFIG_NUMA |
287 | /* | 287 | /* |
288 | * If there's a node specification, search for a partial | 288 | * If there's a node specification, search for a partial |
@@ -296,7 +296,7 @@ static void *slob_alloc(size_t size, gfp_t gfp, int align, int node) | |||
296 | continue; | 296 | continue; |
297 | 297 | ||
298 | /* Attempt to alloc */ | 298 | /* Attempt to alloc */ |
299 | prev = sp->list.prev; | 299 | prev = sp->lru.prev; |
300 | b = slob_page_alloc(sp, size, align); | 300 | b = slob_page_alloc(sp, size, align); |
301 | if (!b) | 301 | if (!b) |
302 | continue; | 302 | continue; |
@@ -322,7 +322,7 @@ static void *slob_alloc(size_t size, gfp_t gfp, int align, int node) | |||
322 | spin_lock_irqsave(&slob_lock, flags); | 322 | spin_lock_irqsave(&slob_lock, flags); |
323 | sp->units = SLOB_UNITS(PAGE_SIZE); | 323 | sp->units = SLOB_UNITS(PAGE_SIZE); |
324 | sp->freelist = b; | 324 | sp->freelist = b; |
325 | INIT_LIST_HEAD(&sp->list); | 325 | INIT_LIST_HEAD(&sp->lru); |
326 | set_slob(b, SLOB_UNITS(PAGE_SIZE), b + SLOB_UNITS(PAGE_SIZE)); | 326 | set_slob(b, SLOB_UNITS(PAGE_SIZE), b + SLOB_UNITS(PAGE_SIZE)); |
327 | set_slob_page_free(sp, slob_list); | 327 | set_slob_page_free(sp, slob_list); |
328 | b = slob_page_alloc(sp, size, align); | 328 | b = slob_page_alloc(sp, size, align); |