Skip to contentSkip to conversation

mm: add new syscall set_mempolicy_home_node

PATCH Superseded Aneesh Kumar K.V 4 participants 22 messages Nov 16, 2021 – Dec 1, 2021

Subsystems (23)

v5 of 6 Superseded Latest is v6 →

lore
Share & tools
lore
#0 lore raw

v5 cover mm: add new syscall set_mempolicy_home_node

Changes from v4:
* Add flags == 0 check
* Make sure the home node is online before updating memory policy.

Changes from v3:
* Fix build warning reported by kernel test robot

Changes from RFC v2:
* Rebase to latest kernel
* Update numa_memory_policy.rst

Aneesh Kumar K.V (3):
mm/mempolicy: use policy_node helper with MPOL_PREFERRED_MANY mm/mempolicy: add set_mempolicy_home_node syscall mm/mempolicy: wire up syscall set_mempolicy_home_node

 .../admin-guide/mm/numa_memory_policy.rst     | 14 +++-
 arch/alpha/kernel/syscalls/syscall.tbl        |  2 +
 arch/arm/tools/syscall.tbl                    |  1 +
 arch/arm64/include/asm/unistd.h               |  2 +-
 arch/arm64/include/asm/unistd32.h             |  2 +
 arch/ia64/kernel/syscalls/syscall.tbl         |  2 +
 arch/m68k/kernel/syscalls/syscall.tbl         |  2 +
 arch/microblaze/kernel/syscalls/syscall.tbl   |  2 +
 arch/mips/kernel/syscalls/syscall_n32.tbl     |  2 +
 arch/mips/kernel/syscalls/syscall_n64.tbl     |  2 +
 arch/mips/kernel/syscalls/syscall_o32.tbl     |  2 +
 arch/parisc/kernel/syscalls/syscall.tbl       |  2 +
 arch/powerpc/kernel/syscalls/syscall.tbl      |  2 +
 arch/s390/kernel/syscalls/syscall.tbl         |  2 +
 arch/sh/kernel/syscalls/syscall.tbl           |  2 +
 arch/sparc/kernel/syscalls/syscall.tbl        |  2 +
 arch/x86/entry/syscalls/syscall_32.tbl        |  1 +
 arch/x86/entry/syscalls/syscall_64.tbl        |  1 +
 arch/xtensa/kernel/syscalls/syscall.tbl       |  2 +
 include/linux/mempolicy.h                     |  1 +
 include/linux/syscalls.h                      |  3 +
 include/uapi/asm-generic/unistd.h             |  5 +-
 kernel/sys_ni.c                               |  1 +
 mm/mempolicy.c                                | 67 ++++++++++++++++++-
 24 files changed, 119 insertions(+), 5 deletions(-)
Signature · 1 line
2.31.1
#1 lore raw

PATCH v5 1/3 mm/mempolicy: use policy_node helper with MPOL_PREFERRED_MANY

A followup patch will enable setting a home node with MPOL_PREFERRED_MANY memory policy. To facilitate that switch to using policy_node helper. There is no functional change in this patch.

Cc Ben Widawsky <[email protected]>
Cc Dave Hansen <[email protected]>
Cc Feng Tang <[email protected]>
Cc Michal Hocko <[email protected]>
Cc Andrea Arcangeli <[email protected]>
Cc Mel Gorman <[email protected]>
Cc Mike Kravetz <[email protected]>
Cc Randy Dunlap <[email protected]>
Cc Vlastimil Babka <[email protected]>
Cc Andi Kleen <[email protected]>
Cc Dan Williams <[email protected]>
Cc Huang Ying <[email protected]>
---
 mm/mempolicy.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
mm/mempolicy.c +3 -2
index 10e9c87260ed..673b5fb13346 100644
@@ -2061,7 +2061,7 @@ static struct page *alloc_pages_preferred_many(gfp_t gfp, unsigned int order,
 	preferred_gfp &= ~(__GFP_DIRECT_RECLAIM | __GFP_NOFAIL);
 	page = __alloc_pages(preferred_gfp, order, nid, &pol->nodes);
 	if (!page)
-		page = __alloc_pages(gfp, order, numa_node_id(), NULL);
+		page = __alloc_pages(gfp, order, nid, NULL);
 
 	return page;
 }
@@ -2102,6 +2102,7 @@ struct page *alloc_pages_vma(gfp_t gfp, int order, struct vm_area_struct *vma,
 	}
 
 	if (pol->mode == MPOL_PREFERRED_MANY) {
+		node = policy_node(gfp, pol, node);
 		page = alloc_pages_preferred_many(gfp, order, node, pol);
 		mpol_cond_put(pol);
 		goto out;
@@ -2186,7 +2187,7 @@ struct page *alloc_pages(gfp_t gfp, unsigned order)
 		page = alloc_page_interleave(gfp, order, interleave_nodes(pol));
 	else if (pol->mode == MPOL_PREFERRED_MANY)
 		page = alloc_pages_preferred_many(gfp, order,
-				numa_node_id(), pol);
+				  policy_node(gfp, pol, numa_node_id()), pol);
 	else
 		page = __alloc_pages(gfp, order,
 				policy_node(gfp, pol, numa_node_id()),
Signature · 1 line
2.31.1
reviewer Acked-by on v5 1/3
#2 lore raw

Re: [PATCH v5 1/3] mm/mempolicy: use policy_node helper with MPOL_PREFERRED_MANY

Quoted 4 lines · Aneesh Kumar K.V

A followup patch will enable setting a home node with MPOL_PREFERRED_MANY memory policy. To facilitate that switch to using policy_node helper. There is no functional change in this patch.

Quoted 14 lines
Cc Ben Widawsky <[email protected]>
Cc Dave Hansen <[email protected]>
Cc Feng Tang <[email protected]>
Cc Michal Hocko <[email protected]>
Cc Andrea Arcangeli <[email protected]>
Cc Mel Gorman <[email protected]>
Cc Mike Kravetz <[email protected]>
Cc Randy Dunlap <[email protected]>
Cc Vlastimil Babka <[email protected]>
Cc Andi Kleen <[email protected]>
Cc Dan Williams <[email protected]>
Cc Huang Ying <[email protected]>

alloc_pages_vma doesn't really need a node parameter. I will send a follow up patch based on this series as a reply.

Signature · 2 lines
Michal Hocko
SUSE Labs
reviewer
#3 lore raw

[PATCH 4/3] mm: drop node from alloc_pages_vma

In reply to Aneesh Kumar K.V

alloc_pages_vma is meant to allocate a page with a vma specific memory policy. The initial node parameter is always a local node so it is pointless to waste a function argument for this. Drop the parameter.

include/linux/gfp.h +4 -4
index b976c4177299..2ffca4f65687 100644
@@ -598,9 +598,9 @@ struct page *alloc_pages(gfp_t gfp, unsigned int order);
 struct folio *folio_alloc(gfp_t gfp, unsigned order);
 extern struct page *alloc_pages_vma(gfp_t gfp_mask, int order,
 			struct vm_area_struct *vma, unsigned long addr,
-			int node, bool hugepage);
+			bool hugepage);
 #define alloc_hugepage_vma(gfp_mask, vma, addr, order) \
-	alloc_pages_vma(gfp_mask, order, vma, addr, numa_node_id(), true)
+	alloc_pages_vma(gfp_mask, order, vma, addr, true)
 #else
 static inline struct page *alloc_pages(gfp_t gfp_mask, unsigned int order)
 {
@@ -610,14 +610,14 @@ static inline struct folio *folio_alloc(gfp_t gfp, unsigned int order)
 {
 	return __folio_alloc_node(gfp, order, numa_node_id());
 }
-#define alloc_pages_vma(gfp_mask, order, vma, addr, node, false)\
+#define alloc_pages_vma(gfp_mask, order, vma, addr, false)\
 	alloc_pages(gfp_mask, order)
 #define alloc_hugepage_vma(gfp_mask, vma, addr, order) \
 	alloc_pages(gfp_mask, order)
 #endif
 #define alloc_page(gfp_mask) alloc_pages(gfp_mask, 0)
 #define alloc_page_vma(gfp_mask, vma, addr)			\
-	alloc_pages_vma(gfp_mask, 0, vma, addr, numa_node_id(), false)
+	alloc_pages_vma(gfp_mask, 0, vma, addr, false)
 
 extern unsigned long __get_free_pages(gfp_t gfp_mask, unsigned int order);
 extern unsigned long get_zeroed_page(gfp_t gfp_mask);
mm/mempolicy.c +2 -1
index cdd6430932d1..b66e9bdfed66 100644
@@ -2143,9 +2143,10 @@ static struct page *alloc_pages_preferred_many(gfp_t gfp, unsigned int order,
  * Return: The page on success or NULL if allocation fails.
  */
 struct page *alloc_pages_vma(gfp_t gfp, int order, struct vm_area_struct *vma,
-		unsigned long addr, int node, bool hugepage)
+		unsigned long addr, bool hugepage)
 {
 	struct mempolicy *pol;
+	int node = numa_node_id();
 	struct page *page;
 	int preferred_nid;
 	nodemask_t *nmask;
mm/shmem.c +1 -2
index dc038ce78700..2d81f8d512d5 100644
@@ -1559,8 +1559,7 @@ static struct page *shmem_alloc_hugepage(gfp_t gfp,
 		return NULL;
 
 	shmem_pseudo_vma_init(&pvma, info, hindex);
-	page = alloc_pages_vma(gfp, HPAGE_PMD_ORDER, &pvma, 0, numa_node_id(),
-			       true);
+	page = alloc_pages_vma(gfp, HPAGE_PMD_ORDER, &pvma, 0, true);
 	shmem_pseudo_vma_destroy(&pvma);
 	if (page)
 		prep_transhuge_page(page);
Signature · 2 lines
Michal Hocko
SUSE Labs
#4 lore raw

PATCH v5 2/3 mm/mempolicy: add set_mempolicy_home_node syscall

In reply to Aneesh Kumar K.V

This syscall can be used to set a home node for the MPOL_BIND and MPOL_PREFERRED_MANY memory policy. Users should use this syscall after setting up a memory policy for the specified range as shown below.

mbind(p, nr_pages * page_size, MPOL_BIND, new_nodes->maskp,

	    new_nodes->size + 1, 0);
sys_set_mempolicy_home_node((unsigned long)p, nr_pages * page_size,
				  home_node, 0);

The syscall allows specifying a home node/preferred node from which kernel will fulfill memory allocation requests first.

For address range with MPOL_BIND memory policy, if nodemask specifies more than one node, page allocations will come from the node in the nodemask with sufficient free memory that is closest to the home node/preferred node.

For MPOL_PREFERRED_MANY if the nodemask specifies more than one node, page allocation will come from the node in the nodemask with sufficient free memory that is closest to the home node/preferred node. If there is not enough memory in all the nodes specified in the nodemask, the allocation will be attempted from the closest numa node to the home node in the system.

This helps applications to hint at a memory allocation preference node and fallback to _only_ a set of nodes if the memory is not available on the preferred node. Fallback allocation is attempted from the node which is nearest to the preferred node.

This helps applications to have control on memory allocation numa nodes and avoids default fallback to slow memory NUMA nodes. For example a system with NUMA nodes 1,2 and 3 with DRAM memory and 10, 11 and 12 of slow memory

new_nodes = numa_bitmask_alloc(nr_nodes);

numa_bitmask_setbit(new_nodes, 1);
numa_bitmask_setbit(new_nodes, 2);
numa_bitmask_setbit(new_nodes, 3);

p = mmap(NULL, nr_pages * page_size, protflag, mapflag, -1, 0); mbind(p, nr_pages * page_size, MPOL_BIND, new_nodes->maskp, new_nodes->size + 1, 0);

sys_set_mempolicy_home_node(p, nr_pages * page_size, 2, 0);

This will allocate from nodes closer to node 2 and will make sure kernel will only allocate from nodes 1, 2 and3. Memory will not be allocated from slow memory nodes 10, 11 and 12

With MPOL_PREFERRED_MANY on the other hand will first try to allocate from the closest node to node 2 from the node list 1, 2 and 3. If those nodes don't have enough memory, kernel will allocate from slow memory node 10, 11 and 12 which ever is closer to node 2.

Cc Ben Widawsky <[email protected]>
Cc Dave Hansen <[email protected]>
Cc Feng Tang <[email protected]>
Cc Michal Hocko <[email protected]>
Cc Andrea Arcangeli <[email protected]>
Cc Mel Gorman <[email protected]>
Cc Mike Kravetz <[email protected]>
Cc Randy Dunlap <[email protected]>
Cc Vlastimil Babka <[email protected]>
Cc Andi Kleen <[email protected]>
Cc Dan Williams <[email protected]>
Cc Huang Ying <[email protected]>
---
 .../admin-guide/mm/numa_memory_policy.rst     | 14 ++++-
 include/linux/mempolicy.h                     |  1 +
 mm/mempolicy.c                                | 62 +++++++++++++++++++
 3 files changed, 76 insertions(+), 1 deletion(-)
Documentation/admin-guide/mm/numa_memory_policy.rst +13 -1
index 64fd0ba0d057..6eab52d4c3b2 100644
@@ -408,7 +408,7 @@ follows:
 Memory Policy APIs
 ==================
 
-Linux supports 3 system calls for controlling memory policy.  These APIS
+Linux supports 4 system calls for controlling memory policy.  These APIS
 always affect only the calling task, the calling task's address space, or
 some shared object mapped into the calling task's address space.
 
@@ -460,6 +460,18 @@ requested via the 'flags' argument.
 
 See the mbind(2) man page for more details.
 
+Set home node for a Range of Task's Address Spacec::
+
+	long sys_set_mempolicy_home_node(unsigned long start, unsigned long len,
+  					 unsigned long home_node,
+					 unsigned long flags);
+
+sys_set_mempolicy_home_node set the home node for a VMA policy present in the
+task's address range. The system call updates the home node only for the existing
+mempolicy range. Other address ranges are ignored. A home node is the NUMA node
+closest to which page allocation will come from.
+
+
 Memory Policy Command Line Interface
 ====================================
 
include/linux/mempolicy.h +1 -0
index 3c7595e81150..668389b4b53d 100644
@@ -46,6 +46,7 @@ struct mempolicy {
 	unsigned short mode; 	/* See MPOL_* above */
 	unsigned short flags;	/* See set_mempolicy() MPOL_F_* above */
 	nodemask_t nodes;	/* interleave/bind/perfer */
+	int home_node;		/* Home node to use for MPOL_BIND and MPOL_PREFERRED_MANY */
 
 	union {
 		nodemask_t cpuset_mems_allowed;	/* relative to these nodes */
mm/mempolicy.c +62 -0

86 lines not on this page · raw message

Signature · 1 line
2.31.1
reviewer
#5 lore raw

Re: [PATCH v5 2/3] mm/mempolicy: add set_mempolicy_home_node syscall

Quoted 38 lines · Aneesh Kumar K.V

This syscall can be used to set a home node for the MPOL_BIND and MPOL_PREFERRED_MANY memory policy. Users should use this syscall after setting up a memory policy for the specified range as shown below.

mbind(p, nr_pages * page_size, MPOL_BIND, new_nodes->maskp,

	    new_nodes->size + 1, 0);
sys_set_mempolicy_home_node((unsigned long)p, nr_pages * page_size,
				  home_node, 0);

The syscall allows specifying a home node/preferred node from which kernel will fulfill memory allocation requests first.

For address range with MPOL_BIND memory policy, if nodemask specifies more than one node, page allocations will come from the node in the nodemask with sufficient free memory that is closest to the home node/preferred node.

For MPOL_PREFERRED_MANY if the nodemask specifies more than one node, page allocation will come from the node in the nodemask with sufficient free memory that is closest to the home node/preferred node. If there is not enough memory in all the nodes specified in the nodemask, the allocation will be attempted from the closest numa node to the home node in the system.

This helps applications to hint at a memory allocation preference node and fallback to _only_ a set of nodes if the memory is not available on the preferred node. Fallback allocation is attempted from the node which is nearest to the preferred node.

This helps applications to have control on memory allocation numa nodes and avoids default fallback to slow memory NUMA nodes. For example a system with NUMA nodes 1,2 and 3 with DRAM memory and 10, 11 and 12 of slow memory

new_nodes = numa_bitmask_alloc(nr_nodes);

numa_bitmask_setbit(new_nodes, 1);
numa_bitmask_setbit(new_nodes, 2);
numa_bitmask_setbit(new_nodes, 3);

Quoted 8 lines

p = mmap(NULL, nr_pages * page_size, protflag, mapflag, -1, 0); mbind(p, nr_pages * page_size, MPOL_BIND, new_nodes->maskp, new_nodes->size + 1, 0);

sys_set_mempolicy_home_node(p, nr_pages * page_size, 2, 0);

This will allocate from nodes closer to node 2 and will make sure kernel will only allocate from nodes 1, 2 and3. Memory will not be allocated from slow memory nodes 10, 11 and 12

I think you are not really explaining why the home node is really needed for that usecase. You can limit memory access to those nodes even without the home node. Why the defaulot local node is insufficient is really a missing part in the explanation.

One usecase would be cpu less nodes and their preference for the allocation. If there are others make sure to mention them in the changelog.

Quoted 52 lines

With MPOL_PREFERRED_MANY on the other hand will first try to allocate from the closest node to node 2 from the node list 1, 2 and 3. If those nodes don't have enough memory, kernel will allocate from slow memory node 10, 11 and 12 which ever is closer to node 2.

Cc Ben Widawsky <[email protected]>
Cc Dave Hansen <[email protected]>
Cc Feng Tang <[email protected]>
Cc Michal Hocko <[email protected]>
Cc Andrea Arcangeli <[email protected]>
Cc Mel Gorman <[email protected]>
Cc Mike Kravetz <[email protected]>
Cc Randy Dunlap <[email protected]>
Cc Vlastimil Babka <[email protected]>
Cc Andi Kleen <[email protected]>
Cc Dan Williams <[email protected]>
Cc Huang Ying <[email protected]>
---
 .../admin-guide/mm/numa_memory_policy.rst     | 14 ++++-
 include/linux/mempolicy.h                     |  1 +
 mm/mempolicy.c                                | 62 +++++++++++++++++++
 3 files changed, 76 insertions(+), 1 deletion(-)
Documentation/admin-guide/mm/numa_memory_policy.rst +10 -1
index 64fd0ba0d057..6eab52d4c3b2 100644
@@ -408,7 +408,7 @@ follows:
 Memory Policy APIs
 ==================
 
-Linux supports 3 system calls for controlling memory policy.  These APIS
+Linux supports 4 system calls for controlling memory policy.  These APIS
 always affect only the calling task, the calling task's address space, or
 some shared object mapped into the calling task's address space.
 
@@ -460,6 +460,18 @@ requested via the 'flags' argument.
 
 See the mbind(2) man page for more details.
 
+Set home node for a Range of Task's Address Spacec::
+
+	long sys_set_mempolicy_home_node(unsigned long start, unsigned long len,
+  					 unsigned long home_node,
+					 unsigned long flags);
+
+sys_set_mempolicy_home_node set the home node for a VMA policy present in the
+task's address range. The system call updates the home node only for the existing
+mempolicy range. Other address ranges are ignored.
 
Quoted 2 lines

A home node is the NUMA node
+closest to which page allocation will come from.

I woudl repgrase
The home node override the default allocation policy to allocate memory close to the local node for an executing CPU.

[...]

Quoted 11 lines
Documentation/admin-guide/mm/numa_memory_policy.rst +11 -0
+SYSCALL_DEFINE4(set_mempolicy_home_node, unsigned long, start, unsigned long, len,
+		unsigned long, home_node, unsigned long, flags)
+{
+	struct mm_struct *mm = current->mm;
+	struct vm_area_struct *vma;
+	struct mempolicy *new;
+	unsigned long vmstart;
+	unsigned long vmend;
+	unsigned long end;
+	int err = -ENOENT;
+

Documentation/admin-guide/mm/numa_memory_policy.rst

Quoted 10 lines
Documentation/admin-guide/mm/numa_memory_policy.rst +10 -0
+	if (start & ~PAGE_MASK)
+		return -EINVAL;
+	/*
+	 * flags is used for future extension if any.
+	 */
+	if (flags != 0)
+		return -EINVAL;
+
+	if (!node_online(home_node))
+		return -EINVAL;

You really want to check the home_node before dereferencing the mask.

Quoted 14 lines
Documentation/admin-guide/mm/numa_memory_policy.rst +14 -0
+
+	len = (len + PAGE_SIZE - 1) & PAGE_MASK;
+	end = start + len;
+
+	if (end < start)
+		return -EINVAL;
+	if (end == start)
+		return 0;
+	mmap_write_lock(mm);
+	vma = find_vma(mm, start);
+	for (; vma && vma->vm_start < end;  vma = vma->vm_next) {
+
+		vmstart = max(start, vma->vm_start);
+		vmend   = min(end, vma->vm_end);

Documentation/admin-guide/mm/numa_memory_policy.rst

Quoted 10 lines
Documentation/admin-guide/mm/numa_memory_policy.rst +10 -0
+		new = mpol_dup(vma_policy(vma));
+		if (IS_ERR(new)) {
+			err = PTR_ERR(new);
+			break;
+		}
+		/*
+		 * Only update home node if there is an existing vma policy
+		 */
+		if (!new)
+			continue;

Your changelog only mentions MPOL_BIND and MPOL_PREFERRED_MANY as supported but you seem to be applying the home node to all existing policies

Documentation/admin-guide/mm/numa_memory_policy.rst

Quoted 9 lines
Documentation/admin-guide/mm/numa_memory_policy.rst +9 -0
+		new->home_node = home_node;
+		err = mbind_range(mm, vmstart, vmend, new);
+		if (err)
+			break;
+	}
+	mmap_write_unlock(mm);
+	return err;
+}
+

Other than that I do not see any major issues.

Signature · 2 lines
Michal Hocko
SUSE Labs
#6 lore raw

Re: [PATCH v5 2/3] mm/mempolicy: add set_mempolicy_home_node syscall

Quoted 48 lines · Michal Hocko
Quoted 38 lines · Aneesh Kumar K.V

This syscall can be used to set a home node for the MPOL_BIND and MPOL_PREFERRED_MANY memory policy. Users should use this syscall after setting up a memory policy for the specified range as shown below.

mbind(p, nr_pages * page_size, MPOL_BIND, new_nodes->maskp,

	    new_nodes->size + 1, 0);
sys_set_mempolicy_home_node((unsigned long)p, nr_pages * page_size,
				  home_node, 0);

The syscall allows specifying a home node/preferred node from which kernel will fulfill memory allocation requests first.

For address range with MPOL_BIND memory policy, if nodemask specifies more than one node, page allocations will come from the node in the nodemask with sufficient free memory that is closest to the home node/preferred node.

For MPOL_PREFERRED_MANY if the nodemask specifies more than one node, page allocation will come from the node in the nodemask with sufficient free memory that is closest to the home node/preferred node. If there is not enough memory in all the nodes specified in the nodemask, the allocation will be attempted from the closest numa node to the home node in the system.

This helps applications to hint at a memory allocation preference node and fallback to _only_ a set of nodes if the memory is not available on the preferred node. Fallback allocation is attempted from the node which is nearest to the preferred node.

This helps applications to have control on memory allocation numa nodes and avoids default fallback to slow memory NUMA nodes. For example a system with NUMA nodes 1,2 and 3 with DRAM memory and 10, 11 and 12 of slow memory

new_nodes = numa_bitmask_alloc(nr_nodes);

numa_bitmask_setbit(new_nodes, 1);
numa_bitmask_setbit(new_nodes, 2);
numa_bitmask_setbit(new_nodes, 3);

Quoted 8 lines

p = mmap(NULL, nr_pages * page_size, protflag, mapflag, -1, 0); mbind(p, nr_pages * page_size, MPOL_BIND, new_nodes->maskp, new_nodes->size + 1, 0);

sys_set_mempolicy_home_node(p, nr_pages * page_size, 2, 0);

This will allocate from nodes closer to node 2 and will make sure kernel will only allocate from nodes 1, 2 and3. Memory will not be allocated from slow memory nodes 10, 11 and 12

Quoted 8 lines

I think you are not really explaining why the home node is really needed for that usecase. You can limit memory access to those nodes even without the home node. Why the defaulot local node is insufficient is really a missing part in the explanation.

One usecase would be cpu less nodes and their preference for the allocation. If there are others make sure to mention them in the changelog.

Will add this.

Quoted 53 lines
Quoted 52 lines

With MPOL_PREFERRED_MANY on the other hand will first try to allocate from the closest node to node 2 from the node list 1, 2 and 3. If those nodes don't have enough memory, kernel will allocate from slow memory node 10, 11 and 12 which ever is closer to node 2.

Cc Ben Widawsky <[email protected]>
Cc Dave Hansen <[email protected]>
Cc Feng Tang <[email protected]>
Cc Michal Hocko <[email protected]>
Cc Andrea Arcangeli <[email protected]>
Cc Mel Gorman <[email protected]>
Cc Mike Kravetz <[email protected]>
Cc Randy Dunlap <[email protected]>
Cc Vlastimil Babka <[email protected]>
Cc Andi Kleen <[email protected]>
Cc Dan Williams <[email protected]>
Cc Huang Ying <[email protected]>
---
 .../admin-guide/mm/numa_memory_policy.rst     | 14 ++++-
 include/linux/mempolicy.h                     |  1 +
 mm/mempolicy.c                                | 62 +++++++++++++++++++
 3 files changed, 76 insertions(+), 1 deletion(-)
Documentation/admin-guide/mm/numa_memory_policy.rst +10 -1
index 64fd0ba0d057..6eab52d4c3b2 100644
@@ -408,7 +408,7 @@ follows:
 Memory Policy APIs
 ==================
 
-Linux supports 3 system calls for controlling memory policy.  These APIS
+Linux supports 4 system calls for controlling memory policy.  These APIS
 always affect only the calling task, the calling task's address space, or
 some shared object mapped into the calling task's address space.
 
@@ -460,6 +460,18 @@ requested via the 'flags' argument.
 
 See the mbind(2) man page for more details.
 
+Set home node for a Range of Task's Address Spacec::
+
+	long sys_set_mempolicy_home_node(unsigned long start, unsigned long len,
+  					 unsigned long home_node,
+					 unsigned long flags);
+
+sys_set_mempolicy_home_node set the home node for a VMA policy present in the
+task's address range. The system call updates the home node only for the existing
+mempolicy range. Other address ranges are ignored.
Quoted 7 lines
Quoted 2 lines

A home node is the NUMA node
+closest to which page allocation will come from.

I woudl repgrase
The home node override the default allocation policy to allocate memory close to the local node for an executing CPU.

ok

Quoted 17 lines

[...]

Quoted 15 lines
Documentation/admin-guide/mm/numa_memory_policy.rst +15 -0
+SYSCALL_DEFINE4(set_mempolicy_home_node, unsigned long, start, unsigned long, len,
+		unsigned long, home_node, unsigned long, flags)
+{
+	struct mm_struct *mm = current->mm;
+	struct vm_area_struct *vma;
+	struct mempolicy *new;
+	unsigned long vmstart;
+	unsigned long vmend;
+	unsigned long end;
+	int err = -ENOENT;
+
+	if (start & ~PAGE_MASK)
+		return -EINVAL;
+	/*
+	 * flags is used for future extension if any.
Quoted 9 lines

Documentation/admin-guide/mm/numa_memory_policy.rst

Quoted 6 lines
Documentation/admin-guide/mm/numa_memory_policy.rst +6 -0
+	 */
+	if (flags != 0)
+		return -EINVAL;
+
+	if (!node_online(home_node))
+		return -EINVAL;

You really want to check the home_node before dereferencing the mask.

Any reason why we want to check for home node first?

Quoted 20 lines
Quoted 20 lines
Documentation/admin-guide/mm/numa_memory_policy.rst +20 -0
+
+	len = (len + PAGE_SIZE - 1) & PAGE_MASK;
+	end = start + len;
+
+	if (end < start)
+		return -EINVAL;
+	if (end == start)
+		return 0;
+	mmap_write_lock(mm);
+	vma = find_vma(mm, start);
+	for (; vma && vma->vm_start < end;  vma = vma->vm_next) {
+
+		vmstart = max(start, vma->vm_start);
+		vmend   = min(end, vma->vm_end);
+		new = mpol_dup(vma_policy(vma));
+		if (IS_ERR(new)) {
+			err = PTR_ERR(new);
+			break;
+		}
+		/*
Quoted 8 lines

Documentation/admin-guide/mm/numa_memory_policy.rst

Quoted 4 lines
Documentation/admin-guide/mm/numa_memory_policy.rst +4 -0
+		 * Only update home node if there is an existing vma policy
+		 */
+		if (!new)
+			continue;

Your changelog only mentions MPOL_BIND and MPOL_PREFERRED_MANY as supported but you seem to be applying the home node to all existing policieso

The restriction is done in policy_node.

@@ -1801,6 +1856,11 @@ static int policy_node(gfp_t gfp, struct mempolicy *policy, int nd)

		WARN_ON_ONCE(policy->mode == MPOL_BIND && (gfp & __GFP_THISNODE));
	}

+ if ((policy->mode == MPOL_BIND ||
+ policy->mode == MPOL_PREFERRED_MANY) &&
+ policy->home_node != NUMA_NO_NODE)
+ return policy->home_node;
+

	return nd;

}

Quoted 15 lines

Documentation/admin-guide/mm/numa_memory_policy.rst

Quoted 10 lines
Documentation/admin-guide/mm/numa_memory_policy.rst +9 -0
+		new->home_node = home_node;
+		err = mbind_range(mm, vmstart, vmend, new);
+		if (err)
+			break;
+	}
+	mmap_write_unlock(mm);
+	return err;
+}
+

Other than that I do not see any major issues.

Signature · 2 lines
Michal Hocko
SUSE Labs

-aneesh

reviewer
#7 lore raw

Re: [PATCH v5 2/3] mm/mempolicy: add set_mempolicy_home_node syscall

Quoted 3 lines · Aneesh Kumar K.V
Quoted 1 line · Michal Hocko

On Tue 16-11-21 12:12:37, Aneesh Kumar K.V wrote:

[...]

Quoted 25 lines
Quoted 15 lines
Quoted 15 lines
mm/mempolicy.c +15 -0
+SYSCALL_DEFINE4(set_mempolicy_home_node, unsigned long, start, unsigned long, len,
+		unsigned long, home_node, unsigned long, flags)
+{
+	struct mm_struct *mm = current->mm;
+	struct vm_area_struct *vma;
+	struct mempolicy *new;
+	unsigned long vmstart;
+	unsigned long vmend;
+	unsigned long end;
+	int err = -ENOENT;
+
+	if (start & ~PAGE_MASK)
+		return -EINVAL;
+	/*
+	 * flags is used for future extension if any.
Quoted 9 lines

mm/mempolicy.c static long kernel_mbind(unsigned long start, unsigned long len, · line 1501

Quoted 6 lines
mm/mempolicy.c +6 -0
+	 */
+	if (flags != 0)
+		return -EINVAL;
+
+	if (!node_online(home_node))
+		return -EINVAL;

You really want to check the home_node before dereferencing the mask.

Quoted 1 line

Any reason why we want to check for home node first?

Because the given node is an index to node_states[N_ONLINE] bitmap. I do not think we do range checking there.

Quoted 32 lines
Quoted 19 lines
Quoted 19 lines
mm/mempolicy.c +19 -0
+	len = (len + PAGE_SIZE - 1) & PAGE_MASK;
+	end = start + len;
+
+	if (end < start)
+		return -EINVAL;
+	if (end == start)
+		return 0;
+	mmap_write_lock(mm);
+	vma = find_vma(mm, start);
+	for (; vma && vma->vm_start < end;  vma = vma->vm_next) {
+
+		vmstart = max(start, vma->vm_start);
+		vmend   = min(end, vma->vm_end);
+		new = mpol_dup(vma_policy(vma));
+		if (IS_ERR(new)) {
+			err = PTR_ERR(new);
+			break;
+		}
+		/*
Quoted 8 lines

mm/mempolicy.c static long kernel_mbind(unsigned long start, unsigned long len, · line 1525

Quoted 4 lines
mm/mempolicy.c +4 -0
+		 * Only update home node if there is an existing vma policy
+		 */
+		if (!new)
+			continue;

Your changelog only mentions MPOL_BIND and MPOL_PREFERRED_MANY as supported but you seem to be applying the home node to all existing policieso

The restriction is done in policy_node.

mm/mempolicy.c static int policy_node(gfp_t gfp, struct mempolicy *policy, int nd) · line 1865

Quoted 10 lines
mm/mempolicy.c +5 -0
@@ -1801,6 +1856,11 @@ static int policy_node(gfp_t gfp, struct mempolicy *policy, int nd)
 		WARN_ON_ONCE(policy->mode == MPOL_BIND && (gfp & __GFP_THISNODE));
 	}
 
+	if ((policy->mode == MPOL_BIND ||
+	     policy->mode == MPOL_PREFERRED_MANY) &&
+	    policy->home_node != NUMA_NO_NODE)
+		return policy->home_node;
+
 	return nd;
 }

But you do allow to set the home node also for other policies and that means that a default MPOL_INTERLEAVE would be different from the one with home_node set up even though they behave exactly the same.

Signature · 2 lines
Michal Hocko
SUSE Labs
#8 lore raw

Re: [PATCH v5 2/3] mm/mempolicy: add set_mempolicy_home_node syscall

Quoted 30 lines · Michal Hocko
Quoted 3 lines · Aneesh Kumar K.V
Quoted 1 line · Michal Hocko

On Tue 16-11-21 12:12:37, Aneesh Kumar K.V wrote:

[...]

Quoted 25 lines
Quoted 24 lines
Quoted 11 lines
mm/mempolicy.c +11 -0
+SYSCALL_DEFINE4(set_mempolicy_home_node, unsigned long, start, unsigned long, len,
+		unsigned long, home_node, unsigned long, flags)
+{
+	struct mm_struct *mm = current->mm;
+	struct vm_area_struct *vma;
+	struct mempolicy *new;
+	unsigned long vmstart;
+	unsigned long vmend;
+	unsigned long end;
+	int err = -ENOENT;
+

mm/mempolicy.c static long kernel_mbind(unsigned long start, unsigned long len, · line 1501

Quoted 10 lines
mm/mempolicy.c +10 -0
+	if (start & ~PAGE_MASK)
+		return -EINVAL;
+	/*
+	 * flags is used for future extension if any.
+	 */
+	if (flags != 0)
+		return -EINVAL;
+
+	if (!node_online(home_node))
+		return -EINVAL;

You really want to check the home_node before dereferencing the mask.

Quoted 4 lines
Quoted 1 line

Any reason why we want to check for home node first?

Because the given node is an index to node_states[N_ONLINE] bitmap. I do not think we do range checking there.

Will add this

	if (home_node >= MAX_NUMNODES || !node_online(home_node))
		return -EINVAL;
Quoted 36 lines
Quoted 36 lines
Quoted 20 lines
Quoted 20 lines
mm/mempolicy.c +19 -0
+	len = (len + PAGE_SIZE - 1) & PAGE_MASK;
+	end = start + len;
+
+	if (end < start)
+		return -EINVAL;
+	if (end == start)
+		return 0;
+	mmap_write_lock(mm);
+	vma = find_vma(mm, start);
+	for (; vma && vma->vm_start < end;  vma = vma->vm_next) {
+
+		vmstart = max(start, vma->vm_start);
+		vmend   = min(end, vma->vm_end);
+		new = mpol_dup(vma_policy(vma));
+		if (IS_ERR(new)) {
+			err = PTR_ERR(new);
+			break;
+		}
+		/*
Quoted 8 lines

mm/mempolicy.c static long kernel_mbind(unsigned long start, unsigned long len, · line 1525

Quoted 4 lines
mm/mempolicy.c +4 -0
+		 * Only update home node if there is an existing vma policy
+		 */
+		if (!new)
+			continue;

Your changelog only mentions MPOL_BIND and MPOL_PREFERRED_MANY as supported but you seem to be applying the home node to all existing policieso

The restriction is done in policy_node.

mm/mempolicy.c +0 -0
@@ -1801,6 +1856,11 @@ static int policy_node(gfp_t gfp, struct mempolicy *policy, int nd)
 		WARN_ON_ONCE(policy->mode == MPOL_BIND && (gfp & __GFP_THISNODE));
 	}
 
Quoted 11 lines

mm/mempolicy.c static int policy_node(gfp_t gfp, struct mempolicy *policy, int nd) · line 1865

Quoted 7 lines
mm/mempolicy.c +5 -0
+	if ((policy->mode == MPOL_BIND ||
+	     policy->mode == MPOL_PREFERRED_MANY) &&
+	    policy->home_node != NUMA_NO_NODE)
+		return policy->home_node;
+
 	return nd;
 }

But you do allow to set the home node also for other policies and that means that a default MPOL_INTERLEAVE would be different from the one with home_node set up even though they behave exactly the same.

I agree that there is no error returned if we try to set the home_node for other memory policies. But there should not be any behaviour differences. We ignore home_node for policies other than BIND and PREFERRED_MANY.

The reason I avoided erroring out for other policies was to simplify the error handling. For example, for a range of addr with a mix of memory policy MPOLD_BIND and MPOL_INTERLEAVE what should be the state after the above system call? We could say, we ignore setting home_node for vma with policy MPOL_INTERLEAVE and leave the home node set for vma with policy MPOL_BIND. Or should we make the system call return error also undoing the changes done for vmas for which we have set the home_node?

-aneesh

reviewer
#9 lore raw

Re: [PATCH v5 2/3] mm/mempolicy: add set_mempolicy_home_node syscall

Quoted 1 line · Aneesh Kumar K.V

Michal Hocko <[email protected]> writes:

[...]

Quoted 11 lines
Quoted 3 lines

But you do allow to set the home node also for other policies and that means that a default MPOL_INTERLEAVE would be different from the one with home_node set up even though they behave exactly the same.

I agree that there is no error returned if we try to set the home_node for other memory policies. But there should not be any behaviour differences. We ignore home_node for policies other than BIND and PREFERRED_MANY.

The reason I avoided erroring out for other policies was to simplify the error handling.

But this leads to a future extensions problems. How do you tell whether a specific policy has a support for home node?

Quoted 3 lines

For example, for a range of addr with a mix of memory
policy MPOLD_BIND and MPOL_INTERLEAVE what should be the state after the above system call?

Do we even allow to combinate different memory policies?

Quoted 4 lines

We could say, we ignore setting home_node for vma
with policy MPOL_INTERLEAVE and leave the home node set for vma with policy MPOL_BIND. Or should we make the system call return error also undoing the changes done for vmas for which we have set the home_node?

The error behavior is really nasty with the existing behavior. The caller has no way to tell which vmas have been updated. The only way is to query the state. So if we return an error because of an incompatible mempolicy in place we are not much worse than now. If the "error" is silent then we establish a dependency on the specific implementation.

Signature · 2 lines
Michal Hocko
SUSE Labs
#10 lore raw

Re: [PATCH v5 2/3] mm/mempolicy: add set_mempolicy_home_node syscall

Quoted 29 lines · Michal Hocko
Quoted 1 line · Aneesh Kumar K.V

Michal Hocko <[email protected]> writes:

[...]

Quoted 11 lines
Quoted 3 lines

But you do allow to set the home node also for other policies and that means that a default MPOL_INTERLEAVE would be different from the one with home_node set up even though they behave exactly the same.

I agree that there is no error returned if we try to set the home_node for other memory policies. But there should not be any behaviour differences. We ignore home_node for policies other than BIND and PREFERRED_MANY.

The reason I avoided erroring out for other policies was to simplify the error handling.

But this leads to a future extensions problems. How do you tell whether a specific policy has a support for home node?

Quoted 3 lines

For example, for a range of addr with a mix of memory
policy MPOLD_BIND and MPOL_INTERLEAVE what should be the state after the above system call?

Do we even allow to combinate different memory policies?

Quoted 4 lines

We could say, we ignore setting home_node for vma
with policy MPOL_INTERLEAVE and leave the home node set for vma with policy MPOL_BIND. Or should we make the system call return error also undoing the changes done for vmas for which we have set the home_node?

Quoted 5 lines

The error behavior is really nasty with the existing behavior. The caller has no way to tell which vmas have been updated. The only way is to query the state. So if we return an error because of an incompatible mempolicy in place we are not much worse than now. If the "error" is silent then we establish a dependency on the specific implementation.

How about

	for (; vma && vma->vm_start < end;  vma = vma->vm_next) {

		vmstart = max(start, vma->vm_start);
		vmend   = min(end, vma->vm_end);
		new = mpol_dup(vma_policy(vma));
		if (IS_ERR(new)) {
			err = PTR_ERR(new);
			break;
		}
		/*
		 * Only update home node if there is an existing vma policy
		 */
		if (!new)
			continue;

		/*
		 * If any vma in the range got policy other than MPOL_BIND
		 * or MPOL_PREFERRED_MANY we return error. We don't reset
		 * the home node for vmas we already updated before.
		 */
		if (new->mode != MPOL_BIND && new->mode != MPOL_PREFERRED_MANY) {
			err = -EINVAL;
			break;
		}

....

reviewer
#11 lore raw

Re: [PATCH v5 2/3] mm/mempolicy: add set_mempolicy_home_node syscall

Quoted 54 lines · Aneesh Kumar K.V
Quoted 29 lines · Michal Hocko
Quoted 1 line · Aneesh Kumar K.V

Michal Hocko <[email protected]> writes:

[...]

Quoted 11 lines
Quoted 3 lines

But you do allow to set the home node also for other policies and that means that a default MPOL_INTERLEAVE would be different from the one with home_node set up even though they behave exactly the same.

I agree that there is no error returned if we try to set the home_node for other memory policies. But there should not be any behaviour differences. We ignore home_node for policies other than BIND and PREFERRED_MANY.

The reason I avoided erroring out for other policies was to simplify the error handling.

But this leads to a future extensions problems. How do you tell whether a specific policy has a support for home node?

Quoted 3 lines

For example, for a range of addr with a mix of memory
policy MPOLD_BIND and MPOL_INTERLEAVE what should be the state after the above system call?

Do we even allow to combinate different memory policies?

Quoted 4 lines

We could say, we ignore setting home_node for vma
with policy MPOL_INTERLEAVE and leave the home node set for vma with policy MPOL_BIND. Or should we make the system call return error also undoing the changes done for vmas for which we have set the home_node?

Quoted 5 lines

The error behavior is really nasty with the existing behavior. The caller has no way to tell which vmas have been updated. The only way is to query the state. So if we return an error because of an incompatible mempolicy in place we are not much worse than now. If the "error" is silent then we establish a dependency on the specific implementation.

How about

	for (; vma && vma->vm_start < end;  vma = vma->vm_next) {

		vmstart = max(start, vma->vm_start);
		vmend   = min(end, vma->vm_end);
		new = mpol_dup(vma_policy(vma));
		if (IS_ERR(new)) {
			err = PTR_ERR(new);
			break;
		}
		/*
		 * Only update home node if there is an existing vma policy
		 */
		if (!new)
			continue;

		/*
Quoted 8 lines
		 * If any vma in the range got policy other than MPOL_BIND
		 * or MPOL_PREFERRED_MANY we return error. We don't reset
		 * the home node for vmas we already updated before.
		 */
		if (new->mode != MPOL_BIND && new->mode != MPOL_PREFERRED_MANY) {
			err = -EINVAL;
			break;
		}

Maybe ENOSUPP to make the error handling slightly easier.

Signature · 2 lines
Michal Hocko
SUSE Labs
maintainer
#12 lore raw

Re: [PATCH v5 2/3] mm/mempolicy: add set_mempolicy_home_node syscall

In reply to Aneesh Kumar K.V
Quoted 69 lines · On Tue, 16 Nov 2021 12:12:37 +0530 "Aneesh Kumar K.V"…

This syscall can be used to set a home node for the MPOL_BIND and MPOL_PREFERRED_MANY memory policy. Users should use this syscall after setting up a memory policy for the specified range as shown below.

mbind(p, nr_pages * page_size, MPOL_BIND, new_nodes->maskp,

	    new_nodes->size + 1, 0);
sys_set_mempolicy_home_node((unsigned long)p, nr_pages * page_size,
				  home_node, 0);

The syscall allows specifying a home node/preferred node from which kernel will fulfill memory allocation requests first.

For address range with MPOL_BIND memory policy, if nodemask specifies more than one node, page allocations will come from the node in the nodemask with sufficient free memory that is closest to the home node/preferred node.

For MPOL_PREFERRED_MANY if the nodemask specifies more than one node, page allocation will come from the node in the nodemask with sufficient free memory that is closest to the home node/preferred node. If there is not enough memory in all the nodes specified in the nodemask, the allocation will be attempted from the closest numa node to the home node in the system.

This helps applications to hint at a memory allocation preference node and fallback to _only_ a set of nodes if the memory is not available on the preferred node. Fallback allocation is attempted from the node which is nearest to the preferred node.

This helps applications to have control on memory allocation numa nodes and avoids default fallback to slow memory NUMA nodes. For example a system with NUMA nodes 1,2 and 3 with DRAM memory and 10, 11 and 12 of slow memory

new_nodes = numa_bitmask_alloc(nr_nodes);

numa_bitmask_setbit(new_nodes, 1);
numa_bitmask_setbit(new_nodes, 2);
numa_bitmask_setbit(new_nodes, 3);

p = mmap(NULL, nr_pages * page_size, protflag, mapflag, -1, 0); mbind(p, nr_pages * page_size, MPOL_BIND, new_nodes->maskp, new_nodes->size + 1, 0);

sys_set_mempolicy_home_node(p, nr_pages * page_size, 2, 0);

This will allocate from nodes closer to node 2 and will make sure kernel will only allocate from nodes 1, 2 and3. Memory will not be allocated from slow memory nodes 10, 11 and 12

With MPOL_PREFERRED_MANY on the other hand will first try to allocate from the closest node to node 2 from the node list 1, 2 and 3. If those nodes don't have enough memory, kernel will allocate from slow memory node 10, 11 and 12 which ever is closer to node 2.

...

mm/mempolicy.c +11 -0
@@ -1477,6 +1478,60 @@ static long kernel_mbind(unsigned long start, unsigned long len,
 	return do_mbind(start, len, lmode, mode_flags, &nodes, flags);
 }
 
+SYSCALL_DEFINE4(set_mempolicy_home_node, unsigned long, start, unsigned long, len,
+		unsigned long, home_node, unsigned long, flags)
+{
+	struct mm_struct *mm = current->mm;
+	struct vm_area_struct *vma;
+	struct mempolicy *new;
+	unsigned long vmstart;
+	unsigned long vmend;
+	unsigned long end;
+	int err = -ENOENT;
+

mm/mempolicy.c static long kernel_mbind(unsigned long start, unsigned long len, · line 1501

Quoted 10 lines
mm/mempolicy.c +10 -0
+	if (start & ~PAGE_MASK)
+		return -EINVAL;
+	/*
+	 * flags is used for future extension if any.
+	 */
+	if (flags != 0)
+		return -EINVAL;
+
+	if (!node_online(home_node))
+		return -EINVAL;

What's the thinking here? The node can later be offlined and the kernel takes no action to reset home nodes, so why not permit setting a presently-offline node as the home node? Checking here seems rather arbitrary?

#13 lore raw

Re: [PATCH v5 2/3] mm/mempolicy: add set_mempolicy_home_node syscall

Quoted 78 lines · Andrew Morton
Quoted 76 lines · On Tue, 16 Nov 2021 12:12:37 +0530 "Aneesh Kumar K.V"…

This syscall can be used to set a home node for the MPOL_BIND and MPOL_PREFERRED_MANY memory policy. Users should use this syscall after setting up a memory policy for the specified range as shown below.

mbind(p, nr_pages * page_size, MPOL_BIND, new_nodes->maskp,

	    new_nodes->size + 1, 0);
sys_set_mempolicy_home_node((unsigned long)p, nr_pages * page_size,
				  home_node, 0);

The syscall allows specifying a home node/preferred node from which kernel will fulfill memory allocation requests first.

For address range with MPOL_BIND memory policy, if nodemask specifies more than one node, page allocations will come from the node in the nodemask with sufficient free memory that is closest to the home node/preferred node.

For MPOL_PREFERRED_MANY if the nodemask specifies more than one node, page allocation will come from the node in the nodemask with sufficient free memory that is closest to the home node/preferred node. If there is not enough memory in all the nodes specified in the nodemask, the allocation will be attempted from the closest numa node to the home node in the system.

This helps applications to hint at a memory allocation preference node and fallback to _only_ a set of nodes if the memory is not available on the preferred node. Fallback allocation is attempted from the node which is nearest to the preferred node.

This helps applications to have control on memory allocation numa nodes and avoids default fallback to slow memory NUMA nodes. For example a system with NUMA nodes 1,2 and 3 with DRAM memory and 10, 11 and 12 of slow memory

new_nodes = numa_bitmask_alloc(nr_nodes);

numa_bitmask_setbit(new_nodes, 1);
numa_bitmask_setbit(new_nodes, 2);
numa_bitmask_setbit(new_nodes, 3);

p = mmap(NULL, nr_pages * page_size, protflag, mapflag, -1, 0); mbind(p, nr_pages * page_size, MPOL_BIND, new_nodes->maskp, new_nodes->size + 1, 0);

sys_set_mempolicy_home_node(p, nr_pages * page_size, 2, 0);

This will allocate from nodes closer to node 2 and will make sure kernel will only allocate from nodes 1, 2 and3. Memory will not be allocated from slow memory nodes 10, 11 and 12

With MPOL_PREFERRED_MANY on the other hand will first try to allocate from the closest node to node 2 from the node list 1, 2 and 3. If those nodes don't have enough memory, kernel will allocate from slow memory node 10, 11 and 12 which ever is closer to node 2.

...

mm/mempolicy.c +18 -0
@@ -1477,6 +1478,60 @@ static long kernel_mbind(unsigned long start, unsigned long len,
 	return do_mbind(start, len, lmode, mode_flags, &nodes, flags);
 }
 
+SYSCALL_DEFINE4(set_mempolicy_home_node, unsigned long, start, unsigned long, len,
+		unsigned long, home_node, unsigned long, flags)
+{
+	struct mm_struct *mm = current->mm;
+	struct vm_area_struct *vma;
+	struct mempolicy *new;
+	unsigned long vmstart;
+	unsigned long vmend;
+	unsigned long end;
+	int err = -ENOENT;
+
+	if (start & ~PAGE_MASK)
+		return -EINVAL;
+	/*
+	 * flags is used for future extension if any.
+	 */
+	if (flags != 0)
+		return -EINVAL;
Quoted 8 lines

mm/mempolicy.c static long kernel_mbind(unsigned long start, unsigned long len, · line 1501

Quoted 3 lines
mm/mempolicy.c +3 -0
+
+	if (!node_online(home_node))
+		return -EINVAL;

What's the thinking here? The node can later be offlined and the kernel takes no action to reset home nodes, so why not permit setting a presently-offline node as the home node? Checking here seems rather arbitrary?

The node online check was needed to avoid accessing uninitialised pgdat structure. Such an access can result in below crash

cpu 0x0: Vector: 300 (Data Access) at [c00000000a693840]

    pc: c0000000004e9bac: __next_zones_zonelist+0xc/0xa0                                                                                                                                      
    lr: c000000000558d54: __alloc_pages+0x474/0x540                                                                                                                                           
    sp: c00000000a693ae0                                                                                                                                                                      

msr: 8000000000009033
dar: 1508
dsisr: 40000000
current = 0xc0000000087f8380
paca = 0xc000000003130000 irqmask: 0x03 irq_happened: 0x01
pid = 1161, comm = test_mpol_prefe
Linux version 5.16.0-rc3-14872-gd6ef4ee28b4f-dirty (kvaneesh@ltc-boston8) (gcc (Ubuntu 9.3.0-1 7ubuntu1~20.04) 9.3.0, GNU ld (GNU Binutils for Ubuntu) 2.34) #505 SMP Mon Nov 29 22:16:49 CST
2021
enter ? for help
[link register ] c000000000558d54 __alloc_pages+0x474/0x540
[c00000000a693ae0] c000000000558c68 __alloc_pages+0x388/0x540 (unreliable) [c00000000a693b60] c00000000059299c alloc_pages_vma+0xcc/0x380 [c00000000a693bd0] c00000000052129c __handle_mm_fault+0xcec/0x1900 [c00000000a693cc0] c000000000522094 handle_mm_fault+0x1e4/0x4f0 [c00000000a693d20] c000000000087288 ___do_page_fault+0x2f8/0xc20 [c00000000a693de0] c000000000087e50 do_page_fault+0x60/0x130
[c00000000a693e10] c00000000000891c data_access_common_virt+0x19c/0x1f0
--- Exception: 300 (Data Access) at 000074931e429160
SP (7fffe8116a50) is in userspace
0:mon>

Now IIUC, even after a node is marked offline via try_offline_node() we still be able to access the zonelist details using the pgdata struct. I was not able to force a NUMA node offline in my test, even after removing the memory assigned to it.

root@ubuntu-guest:/sys/devices/system/node/node2# numactl -H
available: 4 nodes (0-3)
node 0 cpus: 0 1
node 0 size: 4046 MB
node 0 free: 3362 MB
node 1 cpus: 2 3
node 1 size: 4090 MB
node 1 free: 3788 MB
node 2 cpus:
node 2 size: 0 MB
node 2 free: 0 MB
node 3 cpus: 6 7
node 3 size: 4063 MB
node 3 free: 3832 MB
node distances:
node   0   1   2   3 
  0:  10  11  222  33 
  1:  44  10  55  66 
  2:  77  88  10  99 
  3:  101  121  132  10 
reviewer
#14 lore raw

Re: [PATCH v5 2/3] mm/mempolicy: add set_mempolicy_home_node syscall

On Tue 30-11-21 14:29:02, Aneesh Kumar K.V wrote:
[...]

Quoted 2 lines

Now IIUC, even after a node is marked offline via try_offline_node() we still be able to access the zonelist details using the pgdata struct.

Yes, pgdat stays in place along with its zonelists when the node is completely hotremoved. This is unlikely to ever change because way too many operations would have to be hotplug aware. Leaving home node behind is not really much different from the preferred node policy or any other policy mask.

Signature · 2 lines
Michal Hocko
SUSE Labs
maintainer
#15 lore raw

Re: [PATCH v5 2/3] mm/mempolicy: add set_mempolicy_home_node syscall

In reply to Aneesh Kumar K.V
Quoted 8 lines · On Tue, 30 Nov 2021 14:29:02 +0530 "Aneesh Kumar K.V"…
Quoted 4 lines

What's the thinking here? The node can later be offlined and the kernel takes no action to reset home nodes, so why not permit setting a presently-offline node as the home node? Checking here seems rather arbitrary?

The node online check was needed to avoid accessing uninitialised pgdat structure. Such an access can result in below crash

Oh. This is unobvious from reading the code. Which calls for a comment, no?

#16 lore raw

Re: [PATCH v5 2/3] mm/mempolicy: add set_mempolicy_home_node syscall

Quoted 7 lines · Andrew Morton
Quoted 5 lines · On Tue, 30 Nov 2021 14:29:02 +0530 "Aneesh Kumar K.V"…
Quoted 4 lines

What's the thinking here? The node can later be offlined and the kernel takes no action to reset home nodes, so why not permit setting a presently-offline node as the home node? Checking here seems rather arbitrary?

Quoted 6 lines
Quoted 3 lines

The node online check was needed to avoid accessing uninitialised pgdat structure. Such an access can result in below crash

Oh. This is unobvious from reading the code. Which calls for a comment, no?

updated

@@ -1497,6 +1498,10 @@ SYSCALL_DEFINE4(set_mempolicy_home_node, unsigned long, start, unsigned long, le
if (flags != 0)
return -EINVAL;

+ /*
+ * Check home_node is online to avoid accessing uninitialized
+ * NODE_DATA.
+ */
if (home_node >= MAX_NUMNODES || !node_online(home_node))
return -EINVAL;

#17 lore raw

Re: [PATCH v5 2/3] mm/mempolicy: add set_mempolicy_home_node syscall

In reply to Aneesh Kumar K.V
Quoted 2 lines · Aneesh Kumar K.V

sys_set_mempolicy_home_node((unsigned long)p, nr_pages * page_size,

				  home_node, 0);

What about sys_mbind_home_node so the name is better aligned with mbind, since both operate on vma policy? The syscall might or might not be extended to task memory policy, but vma policy is what we're using this for today.

mm/mempolicy.c static long kernel_mbind(unsigned long start, unsigned long len, · line 1482

Quoted 2 lines
mm/mempolicy.c +2 -0
+SYSCALL_DEFINE4(set_mempolicy_home_node, unsigned long, start, unsigned long, len,
+		unsigned long, home_node, unsigned long, flags)

mbind does untagged_addr(addr), why doesn't this need to do the same? Seems like tagged addresses could be passed here too.

mm/mempolicy.c static long kernel_mbind(unsigned long start, unsigned long len, · line 1527

Quoted 7 lines
mm/mempolicy.c +7 -0
+		/*
+		 * Only update home node if there is an existing vma policy
+		 */
+		if (!new)
+			continue;
+		new->home_node = home_node;
+		err = mbind_range(mm, vmstart, vmend, new);

I think you need an mpol_put(new) here since @new is dup'ed again during mbind_range > vma_replace_policy.

#18 lore raw

Re: [PATCH v5 2/3] mm/mempolicy: add set_mempolicy_home_node syscall

Quoted 8 lines · Daniel Jordan
Quoted 2 lines · Aneesh Kumar K.V

sys_set_mempolicy_home_node((unsigned long)p, nr_pages * page_size,

				  home_node, 0);

What about sys_mbind_home_node so the name is better aligned with mbind, since both operate on vma policy? The syscall might or might not be extended to task memory policy, but vma policy is what we're using this for today.

I used the name set_mempolicy_home_node, because we are setting the home for a memory policy. I find the term mbind confusing.

Quoted 8 lines

mm/mempolicy.c static long kernel_mbind(unsigned long start, unsigned long len, · line 1482

Quoted 4 lines
mm/mempolicy.c +2 -0
+SYSCALL_DEFINE4(set_mempolicy_home_node, unsigned long, start, unsigned long, len,
+		unsigned long, home_node, unsigned long, flags)

mbind does untagged_addr(addr), why doesn't this need to do the same? Seems like tagged addresses could be passed here too.

updated
modified mm/mempolicy.c
@@ -1489,6 +1489,7 @@ SYSCALL_DEFINE4(set_mempolicy_home_node, unsigned long, start, unsigned long, le
unsigned long end;
int err = -ENOENT;

+ start = untagged_addr(start);
if (start & ~PAGE_MASK)
return -EINVAL;
/*

Quoted 11 lines

mm/mempolicy.c static long kernel_mbind(unsigned long start, unsigned long len, · line 1527

Quoted 8 lines
mm/mempolicy.c +7 -0
+		/*
+		 * Only update home node if there is an existing vma policy
+		 */
+		if (!new)
+			continue;
+		new->home_node = home_node;
+		err = mbind_range(mm, vmstart, vmend, new);

I think you need an mpol_put(new) here since @new is dup'ed again during mbind_range > vma_replace_policy.

updated
@@ -1536,6 +1540,7 @@ SYSCALL_DEFINE4(set_mempolicy_home_node, unsigned long, start, unsigned long, le

new->home_node = home_node;
err = mbind_range(mm, vmstart, vmend, new);
+ mpol_put(new);
if (err)
break;
}

Thanks for your review
-aneesh

#19 lore raw

Re: [PATCH v5 2/3] mm/mempolicy: add set_mempolicy_home_node syscall

Quoted 6 lines · Aneesh Kumar K.V
Quoted 4 lines · Daniel Jordan
Quoted 2 lines · Aneesh Kumar K.V

sys_set_mempolicy_home_node((unsigned long)p, nr_pages * page_size,

				  home_node, 0);
Quoted 7 lines
Quoted 4 lines

What about sys_mbind_home_node so the name is better aligned with mbind, since both operate on vma policy? The syscall might or might not be extended to task memory policy, but vma policy is what we're using this for today.

I used the name set_mempolicy_home_node, because we are setting the home for a memory policy. I find the term mbind confusing.

Fair enough. Forgive me for starting in on naming :-)

#20 lore raw

PATCH v5 3/3 mm/mempolicy: wire up syscall set_mempolicy_home_node

In reply to Aneesh Kumar K.V

Cc: Ben Widawsky <[email protected]>
Cc: Dave Hansen <[email protected]>
Cc: Feng Tang <[email protected]>
Cc: Michal Hocko <[email protected]>
Cc: Andrea Arcangeli <[email protected]>
Cc: Mel Gorman <[email protected]>
Cc: Mike Kravetz <[email protected]>
Cc: Randy Dunlap <[email protected]>
Cc: Vlastimil Babka <[email protected]>
Cc: Andi Kleen <[email protected]>
Cc: Dan Williams <[email protected]>
Cc: Huang Ying <[email protected]>
Cc: [email protected]
Fix build failure

---
 arch/alpha/kernel/syscalls/syscall.tbl      | 2 ++
 arch/arm/tools/syscall.tbl                  | 1 +
 arch/arm64/include/asm/unistd.h             | 2 +-
 arch/arm64/include/asm/unistd32.h           | 2 ++
 arch/ia64/kernel/syscalls/syscall.tbl       | 2 ++
 arch/m68k/kernel/syscalls/syscall.tbl       | 2 ++
 arch/microblaze/kernel/syscalls/syscall.tbl | 2 ++
 arch/mips/kernel/syscalls/syscall_n32.tbl   | 2 ++
 arch/mips/kernel/syscalls/syscall_n64.tbl   | 2 ++
 arch/mips/kernel/syscalls/syscall_o32.tbl   | 2 ++
 arch/parisc/kernel/syscalls/syscall.tbl     | 2 ++
 arch/powerpc/kernel/syscalls/syscall.tbl    | 2 ++
 arch/s390/kernel/syscalls/syscall.tbl       | 2 ++
 arch/sh/kernel/syscalls/syscall.tbl         | 2 ++
 arch/sparc/kernel/syscalls/syscall.tbl      | 2 ++
 arch/x86/entry/syscalls/syscall_32.tbl      | 1 +
 arch/x86/entry/syscalls/syscall_64.tbl      | 1 +
 arch/xtensa/kernel/syscalls/syscall.tbl     | 2 ++
 include/linux/syscalls.h                    | 3 +++
 include/uapi/asm-generic/unistd.h           | 5 ++++-
 kernel/sys_ni.c                             | 1 +
 21 files changed, 40 insertions(+), 2 deletions(-)
arch/alpha/kernel/syscalls/syscall.tbl +2 -0
index e4a041cd5715..17c88815bea4 100644
@@ -488,3 +488,5 @@
 556	common	landlock_restrict_self		sys_landlock_restrict_self
 # 557 reserved for memfd_secret
 558	common	process_mrelease		sys_process_mrelease
+# 559 reserved for futex_waitv
+560	common	set_mempolicy_home_node		sys_ni_syscall
arch/arm/tools/syscall.tbl +1 -0
index 543100151f2b..ac964612d8b0 100644
@@ -463,3 +463,4 @@
 # 447 reserved for memfd_secret
 448	common	process_mrelease		sys_process_mrelease
 449	common	futex_waitv			sys_futex_waitv
+450	common	set_mempolicy_home_node		sys_set_mempolicy_home_node
arch/arm64/include/asm/unistd.h +1 -1
index 6bdb5f5db438..4e65da3445c7 100644
@@ -38,7 +38,7 @@
 #define __ARM_NR_compat_set_tls		(__ARM_NR_COMPAT_BASE + 5)
 #define __ARM_NR_COMPAT_END		(__ARM_NR_COMPAT_BASE + 0x800)
 
-#define __NR_compat_syscalls		450
+#define __NR_compat_syscalls		451
 #endif
 
 #define __ARCH_WANT_SYS_CLONE
arch/arm64/include/asm/unistd32.h +2 -0
index 41ea1195e44b..604a2053d006 100644
@@ -905,6 +905,8 @@ __SYSCALL(__NR_landlock_restrict_self, sys_landlock_restrict_self)
 __SYSCALL(__NR_process_mrelease, sys_process_mrelease)
 #define __NR_futex_waitv 449
 __SYSCALL(__NR_futex_waitv, sys_futex_waitv)
+#define __NR_set_mempolicy_home_node 450
+__SYSCALL(__NR_set_mempolicy_home_node, sys_set_mempolicy_home_node)
 
 /*
  * Please add new compat syscalls above this comment and update
arch/ia64/kernel/syscalls/syscall.tbl +2 -0
index 6fea1844fb95..f1b09f3ca60e 100644
@@ -369,3 +369,5 @@
 446	common	landlock_restrict_self		sys_landlock_restrict_self
 # 447 reserved for memfd_secret
 448	common	process_mrelease		sys_process_mrelease
+# 449 reserved for futex_waitv
+450	common	set_mempolicy_home_node		sys_set_mempolicy_home_node
arch/m68k/kernel/syscalls/syscall.tbl +2 -0
index 7976dff8f879..abbc91d2f1b7 100644
@@ -448,3 +448,5 @@
 446	common	landlock_restrict_self		sys_landlock_restrict_self
 # 447 reserved for memfd_secret
 448	common	process_mrelease		sys_process_mrelease
+# 449 reserved for futex_waitv
+450	common	set_mempolicy_home_node		sys_set_mempolicy_home_node
arch/microblaze/kernel/syscalls/syscall.tbl +2 -0
index 6b0e11362bd2..31b63be6e211 100644
@@ -454,3 +454,5 @@
 446	common	landlock_restrict_self		sys_landlock_restrict_self
 # 447 reserved for memfd_secret
 448	common	process_mrelease		sys_process_mrelease
+# 449 reserved for futex_waitv
+450	common	set_mempolicy_home_node		sys_set_mempolicy_home_node
arch/mips/kernel/syscalls/syscall_n32.tbl +2 -0
index 70e32de2bcaa..c6ee91b3ddf8 100644
@@ -387,3 +387,5 @@
 446	n32	landlock_restrict_self		sys_landlock_restrict_self
 # 447 reserved for memfd_secret
 448	n32	process_mrelease		sys_process_mrelease
+# 449 reserved for futex_waitv
+450	n32	set_mempolicy_home_node		sys_set_mempolicy_home_node
arch/mips/kernel/syscalls/syscall_n64.tbl +2 -0
index 1ca7bc337932..cb8174e4bce8 100644
@@ -363,3 +363,5 @@
 446	n64	landlock_restrict_self		sys_landlock_restrict_self
 # 447 reserved for memfd_secret
 448	n64	process_mrelease		sys_process_mrelease
+# 449 reserved for futex_waitv
+450	common	set_mempolicy_home_node		sys_set_mempolicy_home_node
arch/mips/kernel/syscalls/syscall_o32.tbl +2 -0
index a61c35edaa74..da2580bad94c 100644
@@ -436,3 +436,5 @@
 446	o32	landlock_restrict_self		sys_landlock_restrict_self
 # 447 reserved for memfd_secret
 448	o32	process_mrelease		sys_process_mrelease
+# 449 reserved for futex_waitv
+450	o32	set_mempolicy_home_node		sys_set_mempolicy_home_node
arch/parisc/kernel/syscalls/syscall.tbl +2 -0
index bf751e0732b7..8aeaa72a6b38 100644
@@ -446,3 +446,5 @@
 446	common	landlock_restrict_self		sys_landlock_restrict_self
 # 447 reserved for memfd_secret
 448	common	process_mrelease		sys_process_mrelease
+# 449 reserved for futex_waitv
+450	common	set_mempolicy_home_node		sys_set_mempolicy_home_node
arch/powerpc/kernel/syscalls/syscall.tbl +2 -0
index 7bef917cc84e..b08a9993abb8 100644
@@ -528,3 +528,5 @@
 446	common	landlock_restrict_self		sys_landlock_restrict_self
 # 447 reserved for memfd_secret
 448	common	process_mrelease		sys_process_mrelease
+# 449 reserved for futex_waitv
+450 	nospu	set_mempolicy_home_node		sys_set_mempolicy_home_node
arch/s390/kernel/syscalls/syscall.tbl +2 -0
index df5261e5cfe1..81a336d2e03f 100644
@@ -451,3 +451,5 @@
 446  common	landlock_restrict_self	sys_landlock_restrict_self	sys_landlock_restrict_self
 # 447 reserved for memfd_secret
 448  common	process_mrelease	sys_process_mrelease		sys_process_mrelease
+# 449 reserved for futex_waitv
+450  common	set_mempolicy_home_node	sys_set_mempolicy_home_node	sys_set_mempolicy_home_node
arch/sh/kernel/syscalls/syscall.tbl +2 -0
index 208f131659c5..53676ef76523 100644
@@ -451,3 +451,5 @@
 446	common	landlock_restrict_self		sys_landlock_restrict_self
 # 447 reserved for memfd_secret
 448	common	process_mrelease		sys_process_mrelease
+# 449 reserved for futex_waitv
+450	common	set_mempolicy_home_node		sys_set_mempolicy_home_node
arch/sparc/kernel/syscalls/syscall.tbl +2 -0
index c37764dc764d..9cc6f644f6f4 100644
@@ -494,3 +494,5 @@
 446	common	landlock_restrict_self		sys_landlock_restrict_self
 # 447 reserved for memfd_secret
 448	common	process_mrelease		sys_process_mrelease
+# 449 reserved for futex_waitv
+450	common	set_mempolicy_home_node		sys_set_mempolicy_home_node
arch/x86/entry/syscalls/syscall_32.tbl +1 -0
index 7e25543693de..320480a8db4f 100644
@@ -454,3 +454,4 @@
 447	i386	memfd_secret		sys_memfd_secret
 448	i386	process_mrelease	sys_process_mrelease
 449	i386	futex_waitv		sys_futex_waitv
+450	i386	set_mempolicy_home_node		sys_set_mempolicy_home_node
arch/x86/entry/syscalls/syscall_64.tbl +1 -0
index fe8f8dd157b4..c84d12608cd2 100644
@@ -371,6 +371,7 @@
 447	common	memfd_secret		sys_memfd_secret
 448	common	process_mrelease	sys_process_mrelease
 449	common	futex_waitv		sys_futex_waitv
+450	common	set_mempolicy_home_node	sys_set_mempolicy_home_node
 
 #
 # Due to a historical design error, certain syscalls are numbered differently
arch/xtensa/kernel/syscalls/syscall.tbl +2 -0
index 104b327f8ac9..89d4cd2a89fd 100644
@@ -419,3 +419,5 @@
 446	common	landlock_restrict_self		sys_landlock_restrict_self
 # 447 reserved for memfd_secret
 448	common	process_mrelease		sys_process_mrelease
+# 449 reserved for futex_waitv
+450	common	set_mempolicy_home_node		sys_set_mempolicy_home_node
include/linux/syscalls.h +3 -0
index 528a478dbda8..819c0cb00b6d 100644
@@ -1057,6 +1057,9 @@ asmlinkage long sys_landlock_add_rule(int ruleset_fd, enum landlock_rule_type ru
 		const void __user *rule_attr, __u32 flags);
 asmlinkage long sys_landlock_restrict_self(int ruleset_fd, __u32 flags);
 asmlinkage long sys_memfd_secret(unsigned int flags);
+asmlinkage long sys_set_mempolicy_home_node(unsigned long start, unsigned long len,
+					    unsigned long home_node,
+					    unsigned long flags);
 
 /*
  * Architecture-specific system calls
include/uapi/asm-generic/unistd.h +4 -1
index 4557a8b6086f..1c48b0ae3ba3 100644
@@ -883,8 +883,11 @@ __SYSCALL(__NR_process_mrelease, sys_process_mrelease)
 #define __NR_futex_waitv 449
 __SYSCALL(__NR_futex_waitv, sys_futex_waitv)
 
+#define __NR_set_mempolicy_home_node 450
+__SYSCALL(__NR_set_mempolicy_home_node, sys_set_mempolicy_home_node)
+
 #undef __NR_syscalls
-#define __NR_syscalls 450
+#define __NR_syscalls 451
 
 /*
  * 32 bit systems traditionally used different
kernel/sys_ni.c +1 -0
index d1944258cfc0..a492f159624f 100644
@@ -297,6 +297,7 @@ COND_SYSCALL(get_mempolicy);
 COND_SYSCALL(set_mempolicy);
 COND_SYSCALL(migrate_pages);
 COND_SYSCALL(move_pages);
+COND_SYSCALL(set_mempolicy_home_node);
 
 COND_SYSCALL(perf_event_open);
 COND_SYSCALL(accept4);
Signature · 1 line
2.31.1
#21 lore raw
In reply to Aneesh Kumar K.V

Hi Andrew,

Quoted 35 lines · Aneesh Kumar K.V

Changes from v4:
* Add flags == 0 check
* Make sure the home node is online before updating memory policy.

Changes from v3:
* Fix build warning reported by kernel test robot

Changes from RFC v2:
* Rebase to latest kernel
* Update numa_memory_policy.rst

Aneesh Kumar K.V (3):
mm/mempolicy: use policy_node helper with MPOL_PREFERRED_MANY mm/mempolicy: add set_mempolicy_home_node syscall mm/mempolicy: wire up syscall set_mempolicy_home_node

 .../admin-guide/mm/numa_memory_policy.rst     | 14 +++-
 arch/alpha/kernel/syscalls/syscall.tbl        |  2 +
 arch/arm/tools/syscall.tbl                    |  1 +
 arch/arm64/include/asm/unistd.h               |  2 +-
 arch/arm64/include/asm/unistd32.h             |  2 +
 arch/ia64/kernel/syscalls/syscall.tbl         |  2 +
 arch/m68k/kernel/syscalls/syscall.tbl         |  2 +
 arch/microblaze/kernel/syscalls/syscall.tbl   |  2 +
 arch/mips/kernel/syscalls/syscall_n32.tbl     |  2 +
 arch/mips/kernel/syscalls/syscall_n64.tbl     |  2 +
 arch/mips/kernel/syscalls/syscall_o32.tbl     |  2 +
 arch/parisc/kernel/syscalls/syscall.tbl       |  2 +
 arch/powerpc/kernel/syscalls/syscall.tbl      |  2 +
 arch/s390/kernel/syscalls/syscall.tbl         |  2 +
 arch/sh/kernel/syscalls/syscall.tbl           |  2 +
 arch/sparc/kernel/syscalls/syscall.tbl        |  2 +
 arch/x86/entry/syscalls/syscall_32.tbl        |  1 +
Quoted 11 lines
 arch/x86/entry/syscalls/syscall_64.tbl        |  1 +
 arch/xtensa/kernel/syscalls/syscall.tbl       |  2 +
 include/linux/mempolicy.h                     |  1 +
 include/linux/syscalls.h                      |  3 +
 include/uapi/asm-generic/unistd.h             |  5 +-
 kernel/sys_ni.c                               |  1 +
 mm/mempolicy.c                                | 67 ++++++++++++++++++-
 24 files changed, 119 insertions(+), 5 deletions(-)
Signature · 1 line
2.31.1

Gentle ping. Any objections for this series?

-aneesh