Skip to contentSkip to conversation

sched/numa: Remove small mode

tip:sched/numa tip-bot for Peter Zijlstra 1 participant 1 message Oct 12, 2012

Subsystems (5)
lore
Share & tools
lore
#0 lore raw
Commit-ID:  962498153e02c320b99694e4a7f3e79d46ed8d20
Gitweb:     http://git.kernel.org/tip/962498153e02c320b99694e4a7f3e79d46ed8d20
Author:     Peter Zijlstra <[email protected]>
AuthorDate: Tue, 9 Oct 2012 13:19:50 +0200
Committer:  Ingo Molnar <[email protected]>
CommitDate: Fri, 12 Oct 2012 12:07:18 +0200

sched/numa: Remove small mode

Now that the 'big' mode is more or less working, remove the small mode. There's still the periodic scan cost I don't like, but Rik's suggestion of adapting the scan period (growing it for stable tasks) should take care of most of that (not implemented yet).

For now, start by removing 'small' mode to clear out/simplify things.

---
 include/linux/init_task.h |    3 +-
 include/linux/mempolicy.h |    5 +-
 include/linux/mm_types.h  |   26 --------
 include/linux/sched.h     |    3 -
 kernel/sched/core.c       |   12 +---
 kernel/sched/fair.c       |  142 ++++-----------------------------------------
 kernel/sched/features.h   |    1 -
 mm/huge_memory.c          |    2 +-
 mm/memory.c               |   14 +---
 mm/mempolicy.c            |    4 +-
 10 files changed, 23 insertions(+), 189 deletions(-)
include/linux/init_task.h +1 -2
index 36aca4e..18906c1 100644
@@ -145,8 +145,7 @@ extern struct task_group root_task_group;
 
 #ifdef CONFIG_SCHED_NUMA
 # define INIT_TASK_NUMA(tsk)						\
-	.node = -1,							\
-	.node_last = -1,
+	.node = -1,
 #else
 # define INIT_TASK_NUMA(tsk)
 #endif
include/linux/mempolicy.h +2 -3
index 7f303d1..67c9734 100644
@@ -264,8 +264,7 @@ static inline int vma_migratable(struct vm_area_struct *vma)
 	return 1;
 }
 
-extern int mpol_misplaced(struct page *, struct vm_area_struct *,
-			  unsigned long, int);
+extern int mpol_misplaced(struct page *, struct vm_area_struct *, unsigned long);
 
 extern void lazy_migrate_process(struct mm_struct *mm);
 
@@ -395,7 +394,7 @@ static inline int mpol_to_str(char *buffer, int maxlen, struct mempolicy *pol,
 }
 
 static inline int mpol_misplaced(struct page *page, struct vm_area_struct *vma,
-				 unsigned long address, int multi)
+				 unsigned long address)
 {
 	return -1; /* no node preference */
 }
include/linux/mm_types.h +0 -26
index ffb3b2d..d6dc76c 100644
@@ -410,37 +410,11 @@ struct mm_struct {
 	struct cpumask cpumask_allocation;
 #endif
 #ifdef CONFIG_SCHED_NUMA
-	unsigned int  numa_big;
 	unsigned long numa_next_scan;
-	unsigned int  numa_migrate_success;
-	unsigned int  numa_migrate_failed;
 #endif
 	struct uprobes_state uprobes_state;
 };
 
-#ifdef CONFIG_SCHED_NUMA
-static __always_inline void mm_inc_numa_migrate(struct mm_struct *mm, bool success)
-{
-	if (success)
-		mm->numa_migrate_success++;
-	else
-		mm->numa_migrate_failed++;
-}
-#else
-static inline void mm_inc_numa_migrate(struct mm_struct *mm, bool success)
-{
-}
-#endif /* CONFNIG_SCHED_NUMA */
-
-static inline bool mm_numa_big(struct mm_struct *mm)
-{
-#ifdef CONFIG_SCHED_NUMA
-	return mm->numa_big;
-#else
-	return false;
-#endif
-}
-
 static inline void mm_init_cpumask(struct mm_struct *mm)
 {
 #ifdef CONFIG_CPUMASK_OFFSTACK
include/linux/sched.h +0 -3
index 0273b83..b0a2c73 100644
@@ -1523,10 +1523,7 @@ struct task_struct {
 #endif
 #ifdef CONFIG_SCHED_NUMA
 	int node;			/* task home node   */
-	int node_curr, node_last;	/* home node filter */
 	u64 node_stamp;			/* migration stamp  */
-	u64 numa_runtime_stamp;
-	u64 numa_walltime_stamp;
 	unsigned long numa_contrib;
 #endif /* CONFIG_SCHED_NUMA */
 
kernel/sched/core.c +2 -10
index 878e33f..5c1be07 100644
@@ -1535,19 +1535,11 @@ static void __sched_fork(struct task_struct *p)
 #endif
 
 #ifdef CONFIG_SCHED_NUMA
-	if (p->mm && atomic_read(&p->mm->mm_users) == 1) {
-		p->mm->numa_big = 0;
+	if (p->mm && atomic_read(&p->mm->mm_users) == 1)
 		p->mm->numa_next_scan = jiffies;
-		p->mm->numa_migrate_success = 0;
-		p->mm->numa_migrate_failed = 0;
-	}
 
 	p->node = -1;
-	p->node_curr = -1;
-	p->node_last = -1;
 	p->node_stamp = 0ULL;
-	p->numa_runtime_stamp = 0;
-	p->numa_walltime_stamp = local_clock();
 #endif /* CONFIG_SCHED_NUMA */
 }
 
@@ -6011,7 +6003,7 @@ void sched_setnode(struct task_struct *p, int node)
 	if (running)
 		p->sched_class->put_prev_task(rq, p);
 
-	p->node = p->node_curr = p->node_last = node;
+	p->node = node;
 
 	if (running)
 		p->sched_class->set_curr_task(rq);
kernel/sched/fair.c +11 -131

190 lines not on this page · raw message

kernel/sched/features.h +0 -1
index 3293af4..64ead49 100644
@@ -64,7 +64,6 @@ SCHED_FEAT(LB_MIN, false)
 
 #ifdef CONFIG_SCHED_NUMA
 SCHED_FEAT(NUMA,           true)
-SCHED_FEAT(NUMA_FORCE_BIG, false)
 SCHED_FEAT(NUMA_HOT,       true)
 SCHED_FEAT(NUMA_TTWU_BIAS, false)
 SCHED_FEAT(NUMA_TTWU_TO,   false)
mm/huge_memory.c +1 -1
index 5b9ab25..d14c8b2 100644
@@ -790,7 +790,7 @@ void do_huge_pmd_prot_none(struct mm_struct *mm, struct vm_area_struct *vma,
 	 * XXX should we serialize against split_huge_page ?
 	 */
 
-	if (mpol_misplaced(page, vma, haddr, mm->numa_big) == -1)
+	if (mpol_misplaced(page, vma, haddr) == -1)
 		goto do_fixup;
 
 	/*
mm/memory.c +4 -10
index ab5c170..1ee7d7c 100644
@@ -3446,21 +3446,15 @@ static bool pte_prot_none(struct vm_area_struct *vma, pte_t pte)
 static void do_prot_none_numa(struct mm_struct *mm, struct vm_area_struct *vma,
 			      unsigned long address, struct page *page)
 {
-	int node, ret;
+	int node;
 
 	/*
 	 * For NUMA systems we use the special PROT_NONE maps to drive
 	 * lazy page migration, see MPOL_MF_LAZY and related.
 	 */
-	node = mpol_misplaced(page, vma, address, mm_numa_big(mm));
-	if (node != -1) {
-		ret = migrate_misplaced_page(mm, page, node);
-		if (!ret)
-			mm_inc_numa_migrate(mm, true);
-		else if (ret == -ENOMEM || ret == -EBUSY)
-			mm_inc_numa_migrate(mm, false);
-	} else
-		mm_inc_numa_migrate(mm, true);
+	node = mpol_misplaced(page, vma, address);
+	if (node != -1)
+		migrate_misplaced_page(mm, page, node);
 }
 #else
 static void do_prot_none_numa(struct mm_struct *mm, struct vm_area_struct *vma,
mm/mempolicy.c +2 -2
index 3360a8d..9034202 100644
@@ -2187,7 +2187,7 @@ mpol_shared_policy_lookup(struct shared_policy *sp, unsigned long idx)
  * Called from fault path where we know the vma and faulting address.
  */
 int mpol_misplaced(struct page *page, struct vm_area_struct *vma,
-		   unsigned long addr, int multi)
+		   unsigned long addr)
 {
 	struct mempolicy *pol;
 	struct zone *zone;
@@ -2264,7 +2264,7 @@ int mpol_misplaced(struct page *page, struct vm_area_struct *vma,
 	 * long-term node of this task, further reducing noise. Also see
 	 * task_tick_numa().
 	 */
-	if (multi && (pol->flags & MPOL_F_HOME)) {
+	if (pol->flags & MPOL_F_HOME) {
 		int last_nid = page_xchg_last_nid(page, polnid);
 		if (last_nid != polnid)
 			goto out;