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.
Unified · Split
| @@ -4788,7 +4788,11 @@ static inline bool prepare_alloc_pages(gfp_t gfp_mask, unsigned int order, · 4787 unmodified lines | ||
| 4788 | 4788 | |
| 4789 | 4789 | if (cpusets_enabled()) { |
| 4790 | 4790 | *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) | |
| 4792 | 4796 | ac->nodemask = &cpuset_current_mems_allowed; |
| 4793 | 4797 | else |
| 4794 | 4798 | *alloc_flags |= ALLOC_CPUSET; |