mm, page_alloc: don't check cpuset allowed twice in fast-path
Subsystems (2)
[email protected]
maintainerPATCH 27/124 mm, page_alloc: don't check cpuset allowed twice in fast-path
From: Vlastimil Babka <[email protected]>
Subject: mm, page_alloc: don't check cpuset allowed twice in fast-path
Since 682a3385e773 ("mm, page_alloc: inline the fast path of the zonelist iterator") we replace a NULL nodemask with cpuset_current_mems_allowed in the fast path, so that get_page_from_freelist() filters nodes allowed by the cpuset via for_next_zone_zonelist_nodemask(). In that case it's pointless to additionaly check __cpuset_zone_allowed() in each iteration, which we can avoid by not adding ALLOC_CPUSET to alloc_flags in that scenario.
This saves some cycles in the allocator fast path on systems with one or more non-root cpuset configured. In the slow path, ALLOC_CPUSET is reset according to __alloc_pages_slowpath(). Without configured cpusets, this code is disabled by a static key.
---
mm/page_alloc.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
mm/page_alloc.c renamed from mm/page_alloc.c~mm-page_alloc-dont-check-cpuset-allowed-twice-in-fast-path +2 -1
@@ -3903,9 +3903,10 @@ static inline bool prepare_alloc_pages(gif (cpusets_enabled ()) { *alloc_mask |= __GFP_HARDWALL; - *alloc_flags |=ALLOC_CPUSET ;if (!ac->nodemask) ac->nodemask = &cpuset_current_mems_allowed; +else + *alloc_flags |=ALLOC_CPUSET ; }lockdep_trace_alloc (gfp_mask);
_