slab: correct pfmemalloc check
We checked pfmemalloc by slab unit, not page unit. You can see this in is_slab_pfmemalloc(). So other pages don't need to be set/cleared pfmemalloc. And, therefore we should check pfmemalloc in page flag of first page, but current implementation don't do that. virt_to_head_page(obj) just return 'struct page' of that object, not one of first page, since the SLAB don't use __GFP_COMP when CONFIG_MMU. To get 'struct page' of first page, we first get a slab and try to get it via virt_to_head_page(slab->s_mem). Acked-by: Andi Kleen <ak@linux.intel.com> Signed-off-by: Joonsoo Kim <iamjoonsoo.kim@lge.com> Signed-off-by: Pekka Enberg <penberg@iki.fi>
This commit is contained in:
committed by
Pekka Enberg
parent
6e4664525b
commit
73293c2f90
@@ -930,7 +930,8 @@ static void *__ac_put_obj(struct kmem_cache *cachep, struct array_cache *ac,
|
|||||||
{
|
{
|
||||||
if (unlikely(pfmemalloc_active)) {
|
if (unlikely(pfmemalloc_active)) {
|
||||||
/* Some pfmemalloc slabs exist, check if this is one */
|
/* Some pfmemalloc slabs exist, check if this is one */
|
||||||
struct page *page = virt_to_head_page(objp);
|
struct slab *slabp = virt_to_slab(objp);
|
||||||
|
struct page *page = virt_to_head_page(slabp->s_mem);
|
||||||
if (PageSlabPfmemalloc(page))
|
if (PageSlabPfmemalloc(page))
|
||||||
set_obj_pfmemalloc(&objp);
|
set_obj_pfmemalloc(&objp);
|
||||||
}
|
}
|
||||||
@@ -1776,7 +1777,7 @@ static void *kmem_getpages(struct kmem_cache *cachep, gfp_t flags, int nodeid)
|
|||||||
__SetPageSlab(page + i);
|
__SetPageSlab(page + i);
|
||||||
|
|
||||||
if (page->pfmemalloc)
|
if (page->pfmemalloc)
|
||||||
SetPageSlabPfmemalloc(page + i);
|
SetPageSlabPfmemalloc(page);
|
||||||
}
|
}
|
||||||
memcg_bind_pages(cachep, cachep->gfporder);
|
memcg_bind_pages(cachep, cachep->gfporder);
|
||||||
|
|
||||||
@@ -1809,9 +1810,10 @@ static void kmem_freepages(struct kmem_cache *cachep, void *addr)
|
|||||||
else
|
else
|
||||||
sub_zone_page_state(page_zone(page),
|
sub_zone_page_state(page_zone(page),
|
||||||
NR_SLAB_UNRECLAIMABLE, nr_freed);
|
NR_SLAB_UNRECLAIMABLE, nr_freed);
|
||||||
|
|
||||||
|
__ClearPageSlabPfmemalloc(page);
|
||||||
while (i--) {
|
while (i--) {
|
||||||
BUG_ON(!PageSlab(page));
|
BUG_ON(!PageSlab(page));
|
||||||
__ClearPageSlabPfmemalloc(page);
|
|
||||||
__ClearPageSlab(page);
|
__ClearPageSlab(page);
|
||||||
page++;
|
page++;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user