History

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.

Muchun Song committed 6 years ago

Commit 182f3d71 parent da415661 file · +5 −1Browse files

Unified · Split

mm/page_alloc.c+5−1
@@ -4788,7 +4788,11 @@ static inline bool prepare_alloc_pages(gfp_t gfp_mask, unsigned int order, · 4787 unmodified lines
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;

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t