Skip to content

Commit 73f038b

Browse files
hnaztorvalds
authored andcommitted
mm: page_alloc: exclude unreclaimable allocations from zone fairness policy
Dave Hansen noted a regression in a microbenchmark that loops around open() and close() on an 8-node NUMA machine and bisected it down to commit 81c0a2b ("mm: page_alloc: fair zone allocator policy"). That change forces the slab allocations of the file descriptor to spread out to all 8 nodes, causing remote references in the page allocator and slab. The round-robin policy is only there to provide fairness among memory allocations that are reclaimed involuntarily based on pressure in each zone. It does not make sense to apply it to unreclaimable kernel allocations that are freed manually, in this case instantly after the allocation, and incur the remote reference costs twice for no reason. Only round-robin allocations that are usually freed through page reclaim or slab shrinking. Bisected by Dave Hansen. Signed-off-by: Johannes Weiner <hannes@cmpxchg.org> Cc: Dave Hansen <dave.hansen@intel.com> Cc: Mel Gorman <mgorman@suse.de> Reviewed-by: Rik van Riel <riel@redhat.com> Cc: <stable@kernel.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
1 parent b0943d6 commit 73f038b

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

mm/page_alloc.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1920,7 +1920,8 @@ get_page_from_freelist(gfp_t gfp_mask, nodemask_t *nodemask, unsigned int order,
19201920
* back to remote zones that do not partake in the
19211921
* fairness round-robin cycle of this zonelist.
19221922
*/
1923-
if (alloc_flags & ALLOC_WMARK_LOW) {
1923+
if ((alloc_flags & ALLOC_WMARK_LOW) &&
1924+
(gfp_mask & GFP_MOVABLE_MASK)) {
19241925
if (zone_page_state(zone, NR_ALLOC_BATCH) <= 0)
19251926
continue;
19261927
if (zone_reclaim_mode &&

0 commit comments

Comments
 (0)