Skip to content

Commit 182f3d7

Browse files
Muchun Songtorvalds
authored andcommitted
mm/page_alloc.c: skip setting nodemask when we are in interrupt
When we are in the interrupt context, it is irrelevant to the current task context. If we use current task's mems_allowed, we can be fair to alloc pages in the fast path and fall back to slow path memory allocation when the current node(which is the current task mems_allowed) does not have enough memory to allocate. In this case, it slows down the memory allocation speed of interrupt context. So we can skip setting the nodemask to allow any node to allocate memory, so that fast path allocation can success. Signed-off-by: Muchun Song <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Reviewed-by: Pekka Enberg <[email protected]> Cc: David Hildenbrand <[email protected]> Link: http://lkml.kernel.org/r/[email protected] Signed-off-by: Linus Torvalds <[email protected]>
1 parent da41566 commit 182f3d7

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

mm/page_alloc.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4788,7 +4788,11 @@ static inline bool prepare_alloc_pages(gfp_t gfp_mask, unsigned int order,
47884788

47894789
if (cpusets_enabled()) {
47904790
*alloc_mask |= __GFP_HARDWALL;
4791-
if (!ac->nodemask)
4791+
/*
4792+
* When we are in the interrupt context, it is irrelevant
4793+
* to the current task context. It means that any node ok.
4794+
*/
4795+
if (!in_interrupt() && !ac->nodemask)
47924796
ac->nodemask = &cpuset_current_mems_allowed;
47934797
else
47944798
*alloc_flags |= ALLOC_CPUSET;

0 commit comments

Comments
 (0)