mm: correct page->pfmemalloc to fix deactivate_slab regression
Subsystems (2)
PATCH 1/1 mm: correct page->pfmemalloc to fix deactivate_slab regression
commit cfd19c5a9ec (mm: only set page->pfmemalloc when ALLOC_NO_WATERMARKS was used) try to narrow down page->pfmemalloc setting, but it missed some places the pfmemalloc should be set.
So, in __slab_alloc, the unalignment pfmemalloc and ALLOC_NO_WATERMARKS cause incorrect deactivate_slab() on our core2 server:
64.73% fio [kernel.kallsyms] [k] _raw_spin_lock
|
--- _raw_spin_lock
|
|---0.34%-- deactivate_slab
| __slab_alloc
| kmem_cache_alloc
| |That causes our fio sync write performance has 40% regression.
This patch move the checking in get_page_from_freelist, that resolved this issue.
--- mm/page_alloc.c | 21 +++++++++++---------- 1 files changed, 11 insertions(+), 10 deletions(-)
mm/page_alloc.c +11 -10
@@ -1928,6 +1928,17 @@ this_zone_full: zlc_active =0 ; goto zonelist_scan; } + +if (page) +/* +* page->pfmemalloc is set when ALLOC_NO_WATERMARKS was +* necessary to allocate the page. The expectation is +* that the caller is taking steps that will free more +* memory. The caller should avoid the page being used +* for !PFMEMALLOC purposes. +*/ + page->pfmemalloc = !!(alloc_flags &ALLOC_NO_WATERMARKS ); +return page; }
@@ -2389,14 +2400,6 @@ rebalance: zonelist, high_zoneidx, nodemask, preferred_zone, migratetype);if (page) { -/* -* page->pfmemalloc is set when ALLOC_NO_WATERMARKS was -* necessary to allocate the page. The expectation is -* that the caller is taking steps that will free more -* memory. The caller should avoid the page being used -* for !PFMEMALLOC purposes. -*/ - page->pfmemalloc = true; goto got_pg; } }
@@ -2569,8 +2572,6 @@ retry_cpuset: page =__alloc_pages_slowpath (gfp_mask, order, zonelist, high_zoneidx, nodemask, preferred_zone, migratetype); - else - page->pfmemalloc = false;trace_mm_page_alloc (page, order, gfp_mask, migratetype);
Signature · 1 line
1.7.5.4
Quoted 16 lines · Alex Shi
commit
cfd19c5a9ec(mm: only setpage->pfmemallocwhenALLOC_NO_WATERMARKSwas used) try to narrow downpage->pfmemallocsetting, but it missed some places the pfmemalloc should be set.So, in
__slab_alloc, the unalignment pfmemalloc andALLOC_NO_WATERMARKScause incorrectdeactivate_slab()on our core2 server:64.73% fio [kernel.kallsyms] [k] _raw_spin_lock | --- _raw_spin_lock | |---0.34%-- deactivate_slab | __slab_alloc | kmem_cache_alloc | |
Quoted 6 lines
That causes our fio sync write performance has 40% regression.
This patch move the checking in
get_page_from_freelist, that resolved this issue.Signed-off-by Alex Shi <[email protected]>
Signature · 2 lines
Mel Gorman SUSE Labs