Skip to contentSkip to conversation

numa: mempolicy: Allow tunable policy for system init.

PATCH New Paul Mundt 1 participant 1 message Jun 5, 2007

Subsystems (4)
lore
Share & tools
lore

Paul Mundt

author
#0 lore raw

PATCH 1/1 numa: mempolicy: Allow tunable policy for system init.

The current default behaviour for system init (via numa_policy_init()) is to use MPOL_INTERLEAVE across the online nodes in order to avoid a preference for node 0. This tends to be undesirable for small nodes that really would rather prefer to keep as many allocations on node 0 as possible.

As tmpfs already provides a parser for the policy and nodelist -- shmem_parse_mpol(), we generalize this and wrap in to it via an mpolinit= (for lack of a better name) setup param. Other code that wishes to do mempolicy parsing for itself can use the new mpol_parse_options().

As an example, for small nodes, one might prefer to boot with 'mpolinit=prefer:0'. numa_default_policy() will still overload this with MPOL_DEFAULT later on anyways, so this is only useful for system init.

--

 Documentation/kernel-parameters.txt |    6 ++
 include/linux/mempolicy.h           |    8 +++
 mm/mempolicy.c                      |   81 +++++++++++++++++++++++++++++++++---
 mm/shmem.c                          |   52 -----------------------
 4 files changed, 91 insertions(+), 56 deletions(-)
Documentation/kernel-parameters.txt +6 -0
index ce91560..1b77073 100644
@@ -1070,6 +1070,12 @@ and is between 256 and 4096 characters. It is defined in the file
 	mousedev.yres=	[MOUSE] Vertical screen resolution, used for devices
 			reporting absolute coordinates, such as tablets
 
+	mpolinit=	[KNL,NUMA]
+			Format: <policy>,[:<nodelist>]
+			Sets the default memory policy to be used at system
+			init time. Defaults to MPOL_INTERLEAVE between online
+			nodes.
+
 	mpu401=		[HW,OSS]
 			Format: <io>,<irq>
 
include/linux/mempolicy.h +8 -0
index daabb3a..471fd25 100644
@@ -148,6 +148,8 @@ extern void mpol_rebind_task(struct task_struct *tsk,
 					const nodemask_t *new);
 extern void mpol_rebind_mm(struct mm_struct *mm, nodemask_t *new);
 extern void mpol_fix_fork_child_flag(struct task_struct *p);
+extern int mpol_parse_options(char *value, int *policy,
+			      nodemask_t *policy_nodes);
 #define set_cpuset_being_rebound(x) (cpuset_being_rebound = (x))
 
 #ifdef CONFIG_CPUSETS
@@ -253,6 +255,12 @@ static inline void mpol_fix_fork_child_flag(struct task_struct *p)
 {
 }
 
+static inline int mpol_parse_options(char *value, int *policy,
+				     nodemask_t *policy_nodes)
+{
+	return 1;
+}
+
 #define set_cpuset_being_rebound(x) do {} while (0)
 
 static inline struct zonelist *huge_zonelist(struct vm_area_struct *vma,
mm/mempolicy.c +76 -5

103 lines not on this page · raw message

mm/shmem.c +1 -51

70 lines not on this page · raw message

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>