diff options
| author | Mel Gorman <[email protected]> | 2012-09-17 21:09:03 +0000 |
|---|---|---|
| committer | Linus Torvalds <[email protected]> | 2012-09-17 22:00:38 +0000 |
| commit | 30c29bea6af2d3b6ffc8865864de7fc08cadb5df (patch) | |
| tree | b01c1ad1f07cfe5d2a7b0b6b2704358c70994899 | |
| parent | nbd: clear waiting_queue on shutdown (diff) | |
| download | kernel-30c29bea6af2d3b6ffc8865864de7fc08cadb5df.tar.gz kernel-30c29bea6af2d3b6ffc8865864de7fc08cadb5df.zip | |
slab: do ClearSlabPfmemalloc() for all pages of slab
Right now, we call ClearSlabPfmemalloc() for first page of slab when we
clear SlabPfmemalloc flag. This is fine for most swap-over-network use
cases as it is expected that order-0 pages are in use. Unfortunately it
is possible that that __ac_put_obj() checks SlabPfmemalloc on a tail
page and while this is harmless, it is sloppy. This patch ensures that
the head page is always used.
This problem was originally identified by Joonsoo Kim.
[[email protected]: Original implementation and problem identification]
Signed-off-by: Mel Gorman <[email protected]>
Cc: David Miller <[email protected]>
Cc: Chuck Lever <[email protected]>
Cc: Joonsoo Kim <[email protected]>
Cc: David Rientjes <[email protected]>
Cc: Pekka Enberg <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
| -rw-r--r-- | mm/slab.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/mm/slab.c b/mm/slab.c index 811af03a14ef..d34a9034f929 100644 --- a/mm/slab.c +++ b/mm/slab.c @@ -1000,7 +1000,7 @@ static void *__ac_get_obj(struct kmem_cache *cachep, struct array_cache *ac, l3 = cachep->nodelists[numa_mem_id()]; if (!list_empty(&l3->slabs_free) && force_refill) { struct slab *slabp = virt_to_slab(objp); - ClearPageSlabPfmemalloc(virt_to_page(slabp->s_mem)); + ClearPageSlabPfmemalloc(virt_to_head_page(slabp->s_mem)); clear_obj_pfmemalloc(&objp); recheck_pfmemalloc_active(cachep, ac); return objp; @@ -1032,7 +1032,7 @@ static void *__ac_put_obj(struct kmem_cache *cachep, struct array_cache *ac, { if (unlikely(pfmemalloc_active)) { /* Some pfmemalloc slabs exist, check if this is one */ - struct page *page = virt_to_page(objp); + struct page *page = virt_to_head_page(objp); if (PageSlabPfmemalloc(page)) set_obj_pfmemalloc(&objp); } |
