Skip to contentSkip to conversation

mm, mempolicy: simplify rebinding mempolicies when updating cpusets

PATCH New [email protected] 1 participant 1 message Jul 6, 2017

Subsystems (4)
lore
Share & tools
lore

[email protected]

author maintainer
#0 lore raw

PATCH 89/108 mm, mempolicy: simplify rebinding mempolicies when updating cpusets

From: Vlastimil Babka <[email protected]>
Subject: mm, mempolicy: simplify rebinding mempolicies when updating cpusets

Commit c0ff7453bb5c ("cpuset,mm: fix no node to alloc memory when changing cpuset's mems") has introduced a two-step protocol when rebinding task's mempolicy due to cpuset update, in order to avoid a parallel allocation seeing an empty effective nodemask and failing. Later, commit cc9a6c877661 ("cpuset: mm: reduce large amounts of memory barrier related damage v3") introduced a seqlock protection and removed the synchronization point between the two update steps. At that point (or perhaps later), the two-step rebinding became unnecessary. Currently it only makes sure that the update first adds new nodes in step 1 and then removes nodes in step 2. Without memory barriers the effects are questionable, and even then this cannot prevent a parallel zonelist iteration checking the nodemask at each step to observe all nodes as unusable for allocation. We now fully rely on the seqlock to prevent premature OOMs and allocation failures.

We can thus remove the two-step update parts and simplify the code.

Cc "Kirill A. Shutemov" <[email protected]>
Cc Andrea Arcangeli <[email protected]>
Cc Anshuman Khandual <[email protected]>
Cc Christoph Lameter <[email protected]>
Cc David Rientjes <[email protected]>
Cc Dimitri Sivanich <[email protected]>
Cc Hugh Dickins <[email protected]>
Cc Li Zefan <[email protected]>
Cc Mel Gorman <[email protected]>

---

 include/linux/mempolicy.h      |    6 -
 include/uapi/linux/mempolicy.h |    8 --
 kernel/cgroup/cpuset.c         |    4 -
 mm/mempolicy.c                 |  102 +++++--------------------------
 4 files changed, 21 insertions(+), 99 deletions(-)
include/linux/mempolicy.h renamed from include/linux/mempolicy.h~mm-mempolicy-simplify-rebinding-mempolicies-when-updating-cpusets +2 -4
diff -puN include/linux/mempolicy.h~mm-mempolicy-simplify-rebinding-mempolicies-when-updating-cpusets include/linux/mempolicy.h
@@ -142,8 +142,7 @@ bool vma_policy_mof(struct vm_area_struc
 
 extern void numa_default_policy(void);
 extern void numa_policy_init(void);
-extern void mpol_rebind_task(struct task_struct *tsk, const nodemask_t *new,
-				enum mpol_rebind_step step);
+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 int huge_node(struct vm_area_struct *vma,
@@ -260,8 +259,7 @@ static inline void numa_default_policy(v
 }
 
 static inline void mpol_rebind_task(struct task_struct *tsk,
-				const nodemask_t *new,
-				enum mpol_rebind_step step)
+				const nodemask_t *new)
 {
 }
 
include/uapi/linux/mempolicy.h renamed from include/uapi/linux/mempolicy.h~mm-mempolicy-simplify-rebinding-mempolicies-when-updating-cpusets +0 -8
diff -puN include/uapi/linux/mempolicy.h~mm-mempolicy-simplify-rebinding-mempolicies-when-updating-cpusets include/uapi/linux/mempolicy.h
@@ -24,13 +24,6 @@ enum {
 	MPOL_MAX,	/* always last member of enum */
 };
 
-enum mpol_rebind_step {
-	MPOL_REBIND_ONCE,	/* do rebind work at once(not by two step) */
-	MPOL_REBIND_STEP1,	/* first step(set all the newly nodes) */
-	MPOL_REBIND_STEP2,	/* second step(clean all the disallowed nodes)*/
-	MPOL_REBIND_NSTEP,
-};
-
 /* Flags for set_mempolicy */
 #define MPOL_F_STATIC_NODES	(1 << 15)
 #define MPOL_F_RELATIVE_NODES	(1 << 14)
@@ -65,7 +58,6 @@ enum mpol_rebind_step {
  */
 #define MPOL_F_SHARED  (1 << 0)	/* identify shared policies */
 #define MPOL_F_LOCAL   (1 << 1)	/* preferred local allocation */
-#define MPOL_F_REBINDING (1 << 2)	/* identify policies in rebinding */
 #define MPOL_F_MOF	(1 << 3) /* this policy wants migrate on fault */
 #define MPOL_F_MORON	(1 << 4) /* Migrate On protnone Reference On Node */
 
kernel/cgroup/cpuset.c renamed from kernel/cgroup/cpuset.c~mm-mempolicy-simplify-rebinding-mempolicies-when-updating-cpusets +1 -3
diff -puN kernel/cgroup/cpuset.c~mm-mempolicy-simplify-rebinding-mempolicies-when-updating-cpusets kernel/cgroup/cpuset.c
@@ -1063,9 +1063,7 @@ static void cpuset_change_task_nodemask(
 	}
 
 	nodes_or(tsk->mems_allowed, tsk->mems_allowed, *newmems);
-	mpol_rebind_task(tsk, newmems, MPOL_REBIND_STEP1);
-
-	mpol_rebind_task(tsk, newmems, MPOL_REBIND_STEP2);
+	mpol_rebind_task(tsk, newmems);
 	tsk->mems_allowed = *newmems;
 
 	if (need_loop) {
mm/mempolicy.c renamed from mm/mempolicy.c~mm-mempolicy-simplify-rebinding-mempolicies-when-updating-cpusets +18 -84

163 lines not on this page · raw message

_