Unverified Commit 2a888818 authored by openeuler-ci-bot's avatar openeuler-ci-bot Committed by Gitee
Browse files

!637 Introduce new memory policy for OLK-5.10

Merge Pull Request from: @ma-wupeng 
 
Introduce new syscall set_mempolicy_home_node and mempolicy
MPOL_PREFERRED_MANY.

This patch series introduces the concept of the MPOL_PREFERRED_MANY mempolicy.
This mempolicy mode can be used with either the set_mempolicy(2) or mbind(2)
interfaces. Like the MPOL_PREFERRED interface, it allows an application to set a
preference for nodes which will fulfil memory allocation requests. Unlike the
MPOL_PREFERRED mode, it takes a set of nodes. Like the MPOL_BIND interface, it
works over a set of nodes. Unlike MPOL_BIND, it will not cause a SIGSEGV or
invoke the OOM killer if those preferred nodes are not available.

mm: add new syscall set_mempolicy_home_node 
 
Link:https://gitee.com/openeuler/kernel/pulls/637

 

Reviewed-by: default avatarKefeng Wang <wangkefeng.wang@huawei.com>
Signed-off-by: default avatarJialin Zhang <zhangjialin11@huawei.com>
parents 1a32e08f 160c26bc
Loading
Loading
Loading
Loading
+26 −5
Original line number Diff line number Diff line
@@ -245,6 +245,13 @@ MPOL_INTERLEAVED
	address range or file.  During system boot up, the temporary
	interleaved system default policy works in this mode.

MPOL_PREFERRED_MANY
	This mode specifices that the allocation should be preferrably
	satisfied from the nodemask specified in the policy. If there is
	a memory pressure on all nodes in the nodemask, the allocation
	can fall back to all existing numa nodes. This is effectively
	MPOL_PREFERRED allowed for a mask rather than a single node.

NUMA memory policy supports the following optional mode flags:

MPOL_F_STATIC_NODES
@@ -253,10 +260,10 @@ MPOL_F_STATIC_NODES
	nodes changes after the memory policy has been defined.

	Without this flag, any time a mempolicy is rebound because of a
	change in the set of allowed nodes, the node (Preferred) or
	nodemask (Bind, Interleave) is remapped to the new set of
	allowed nodes.  This may result in nodes being used that were
	previously undesired.
        change in the set of allowed nodes, the preferred nodemask (Preferred
        Many), preferred node (Preferred) or nodemask (Bind, Interleave) is
        remapped to the new set of allowed nodes.  This may result in nodes
        being used that were previously undesired.

	With this flag, if the user-specified nodes overlap with the
	nodes allowed by the task's cpuset, then the memory policy is
@@ -401,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.

@@ -453,6 +460,20 @@ 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. Specifying the home node override
the default allocation policy to allocate memory close to the local node for an
executing CPU.


Memory Policy Command Line Interface
====================================

+1 −0
Original line number Diff line number Diff line
@@ -483,3 +483,4 @@
554	common	landlock_create_ruleset		sys_landlock_create_ruleset
555	common	landlock_add_rule		sys_landlock_add_rule
556	common	landlock_restrict_self		sys_landlock_restrict_self
560	common	set_mempolicy_home_node		sys_ni_syscall
+1 −1
Original line number Diff line number Diff line
@@ -463,7 +463,7 @@
447	common	kabi_reserved447		sys_ni_syscall
448	common	kabi_reserved448		sys_ni_syscall
449	common	kabi_reserved449		sys_ni_syscall
450	common	kabi_reserved450		sys_ni_syscall
450	common	set_mempolicy_home_node		sys_set_mempolicy_home_node
451	common	kabi_reserved451		sys_ni_syscall
452	common	kabi_reserved452		sys_ni_syscall
453	common	kabi_reserved453		sys_ni_syscall
+0 −1
Original line number Diff line number Diff line
@@ -42,7 +42,6 @@
#define __ARM_NR_compat_cacheflush	(__ARM_NR_COMPAT_BASE + 2)
#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		457
#endif

+2 −2
Original line number Diff line number Diff line
@@ -908,8 +908,8 @@ __SYSCALL(__NR_kabi_reserved447, sys_ni_syscall)
__SYSCALL(__NR_kabi_reserved448, sys_ni_syscall)
#define __NR_kabi_reserved449 449
__SYSCALL(__NR_kabi_reserved449, sys_ni_syscall)
#define __NR_kabi_reserved450 450
__SYSCALL(__NR_kabi_reserved450, sys_ni_syscall)
#define __NR_set_mempolicy_home_node 450
__SYSCALL(__NR_set_mempolicy_home_node, sys_set_mempolicy_home_node)
#define __NR_kabi_reserved451 451
__SYSCALL(__NR_kabi_reserved451, sys_ni_syscall)
#define __NR_kabi_reserved452 452
Loading