Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

mm: change alloc_pages_vma to pass down the policy node for local policy

Currently alloc_pages_vma() always uses the local node as policy node for
the LOCAL policy. Pass this node down as an argument instead.

No behaviour change from this patch, but will be needed for followons.

Acked-by: Andrea Arcangeli <aarcange@redhat.com>
Signed-off-by: Andi Kleen <ak@linux.intel.com>
Reviewed-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

authored by

Andi Kleen and committed by
Linus Torvalds
2f5f9486 b8bc1dd3

+11 -11
+5 -4
include/linux/gfp.h
··· 332 332 return alloc_pages_current(gfp_mask, order); 333 333 } 334 334 extern struct page *alloc_pages_vma(gfp_t gfp_mask, int order, 335 - struct vm_area_struct *vma, unsigned long addr); 335 + struct vm_area_struct *vma, unsigned long addr, 336 + int node); 336 337 #else 337 338 #define alloc_pages(gfp_mask, order) \ 338 339 alloc_pages_node(numa_node_id(), gfp_mask, order) 339 - #define alloc_pages_vma(gfp_mask, order, vma, addr) \ 340 + #define alloc_pages_vma(gfp_mask, order, vma, addr, node) \ 340 341 alloc_pages(gfp_mask, order) 341 342 #endif 342 343 #define alloc_page(gfp_mask) alloc_pages(gfp_mask, 0) 343 - #define alloc_page_vma(gfp_mask, vma, addr) \ 344 - alloc_pages_vma(gfp_mask, 0, vma, addr) 344 + #define alloc_page_vma(gfp_mask, vma, addr) \ 345 + alloc_pages_vma(gfp_mask, 0, vma, addr, numa_node_id()) 345 346 346 347 extern unsigned long __get_free_pages(gfp_t gfp_mask, unsigned int order); 347 348 extern unsigned long get_zeroed_page(gfp_t gfp_mask);
+1 -1
mm/huge_memory.c
··· 653 653 unsigned long haddr) 654 654 { 655 655 return alloc_pages_vma(alloc_hugepage_gfpmask(defrag), 656 - HPAGE_PMD_ORDER, vma, haddr); 656 + HPAGE_PMD_ORDER, vma, haddr, numa_node_id()); 657 657 } 658 658 659 659 #ifndef CONFIG_NUMA
+5 -6
mm/mempolicy.c
··· 1524 1524 } 1525 1525 1526 1526 /* Return a zonelist indicated by gfp for node representing a mempolicy */ 1527 - static struct zonelist *policy_zonelist(gfp_t gfp, struct mempolicy *policy) 1527 + static struct zonelist *policy_zonelist(gfp_t gfp, struct mempolicy *policy, 1528 + int nd) 1528 1529 { 1529 - int nd = numa_node_id(); 1530 - 1531 1530 switch (policy->mode) { 1532 1531 case MPOL_PREFERRED: 1533 1532 if (!(policy->flags & MPOL_F_LOCAL)) ··· 1678 1679 zl = node_zonelist(interleave_nid(*mpol, vma, addr, 1679 1680 huge_page_shift(hstate_vma(vma))), gfp_flags); 1680 1681 } else { 1681 - zl = policy_zonelist(gfp_flags, *mpol); 1682 + zl = policy_zonelist(gfp_flags, *mpol, numa_node_id()); 1682 1683 if ((*mpol)->mode == MPOL_BIND) 1683 1684 *nodemask = &(*mpol)->v.nodes; 1684 1685 } ··· 1819 1820 */ 1820 1821 struct page * 1821 1822 alloc_pages_vma(gfp_t gfp, int order, struct vm_area_struct *vma, 1822 - unsigned long addr) 1823 + unsigned long addr, int node) 1823 1824 { 1824 1825 struct mempolicy *pol = get_vma_policy(current, vma, addr); 1825 1826 struct zonelist *zl; ··· 1835 1836 put_mems_allowed(); 1836 1837 return page; 1837 1838 } 1838 - zl = policy_zonelist(gfp, pol); 1839 + zl = policy_zonelist(gfp, pol, node); 1839 1840 if (unlikely(mpol_needs_cond_ref(pol))) { 1840 1841 /* 1841 1842 * slow path: ref counted shared policy