Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 344814
b: refs/heads/master
c: 5bca230
h: refs/heads/master
v: v3
  • Loading branch information
Mel Gorman committed Dec 11, 2012
1 parent d54f384 commit 14a2dbd
Show file tree
Hide file tree
Showing 5 changed files with 35 additions and 2 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 3105b86a9fee7d2c2e76edb53bbbc4027599628f
refs/heads/master: 5bca23035391928c4c7301835accca3551b96cc2
10 changes: 10 additions & 0 deletions trunk/include/linux/mm_types.h
Original file line number Diff line number Diff line change
Expand Up @@ -418,10 +418,20 @@ struct mm_struct {

/* numa_scan_seq prevents two threads setting pte_numa */
int numa_scan_seq;

/*
* The first node a task was scheduled on. If a task runs on
* a different node than Make PTE Scan Go Now.
*/
int first_nid;
#endif
struct uprobes_state uprobes_state;
};

/* first nid will either be a valid NID or one of these values */
#define NUMA_PTE_SCAN_INIT -1
#define NUMA_PTE_SCAN_ACTIVE -2

static inline void mm_init_cpumask(struct mm_struct *mm)
{
#ifdef CONFIG_CPUMASK_OFFSTACK
Expand Down
3 changes: 3 additions & 0 deletions trunk/kernel/fork.c
Original file line number Diff line number Diff line change
Expand Up @@ -820,6 +820,9 @@ struct mm_struct *dup_mm(struct task_struct *tsk)

#ifdef CONFIG_TRANSPARENT_HUGEPAGE
mm->pmd_huge_pte = NULL;
#endif
#ifdef CONFIG_NUMA_BALANCING
mm->first_nid = NUMA_PTE_SCAN_INIT;
#endif
if (!mm_init(mm, tsk))
goto fail_nomem;
Expand Down
18 changes: 18 additions & 0 deletions trunk/kernel/sched/fair.c
Original file line number Diff line number Diff line change
Expand Up @@ -860,6 +860,24 @@ void task_numa_work(struct callback_head *work)
if (p->flags & PF_EXITING)
return;

/*
* We do not care about task placement until a task runs on a node
* other than the first one used by the address space. This is
* largely because migrations are driven by what CPU the task
* is running on. If it's never scheduled on another node, it'll
* not migrate so why bother trapping the fault.
*/
if (mm->first_nid == NUMA_PTE_SCAN_INIT)
mm->first_nid = numa_node_id();
if (mm->first_nid != NUMA_PTE_SCAN_ACTIVE) {
/* Are we running on a new node yet? */
if (numa_node_id() == mm->first_nid &&
!sched_feat_numa(NUMA_FORCE))
return;

mm->first_nid = NUMA_PTE_SCAN_ACTIVE;
}

/*
* Reset the scan period if enough time has gone by. Objective is that
* scanning will be reduced if pages are properly placed. As tasks
Expand Down
4 changes: 3 additions & 1 deletion trunk/kernel/sched/features.h
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,10 @@ SCHED_FEAT(LB_MIN, false)
/*
* Apply the automatic NUMA scheduling policy. Enabled automatically
* at runtime if running on a NUMA machine. Can be controlled via
* numa_balancing=
* numa_balancing=. Allow PTE scanning to be forced on UMA machines
* for debugging the core machinery.
*/
#ifdef CONFIG_NUMA_BALANCING
SCHED_FEAT(NUMA, false)
SCHED_FEAT(NUMA_FORCE, false)
#endif

0 comments on commit 14a2dbd

Please sign in to comment.