Skip to content

Commit

Permalink
sched: numa: Slowly increase the scanning period as NUMA faults are h…
Browse files Browse the repository at this point in the history
…andled

Currently the rate of scanning for an address space is controlled
by the individual tasks. The next scan is simply determined by
2*p->numa_scan_period.

The 2*p->numa_scan_period is arbitrary and never changes. At this point
there is still no proper policy that decides if a task or process is
properly placed. It just scans and assumes the next NUMA fault will
place it properly. As it is assumed that pages will get properly placed
over time, increase the scan window each time a fault is incurred. This
is a big assumption as noted in the comments.

It should be noted that changing to p->numa_scan_period will increase
system CPU usage because now the scanning rate has effectively doubled.
If that is a problem then the min_rate should be made 200ms instead of
restoring the 2* logic.

Signed-off-by: Mel Gorman <mgorman@suse.de>
  • Loading branch information
Mel Gorman committed Dec 11, 2012
1 parent e14808b commit fb003b8
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion kernel/sched/fair.c
Original file line number Diff line number Diff line change
Expand Up @@ -812,6 +812,15 @@ void task_numa_fault(int node, int pages)

/* FIXME: Allocate task-specific structure for placement policy here */

/*
* Assume that as faults occur that pages are getting properly placed
* and fewer NUMA hints are required. Note that this is a big
* assumption, it assumes processes reach a steady steady with no
* further phase changes.
*/
p->numa_scan_period = min(sysctl_numa_balancing_scan_period_max,
p->numa_scan_period + jiffies_to_msecs(2));

task_numa_placement(p);
}

Expand Down Expand Up @@ -858,7 +867,7 @@ void task_numa_work(struct callback_head *work)
if (p->numa_scan_period == 0)
p->numa_scan_period = sysctl_numa_balancing_scan_period_min;

next_scan = now + 2*msecs_to_jiffies(p->numa_scan_period);
next_scan = now + msecs_to_jiffies(p->numa_scan_period);
if (cmpxchg(&mm->numa_next_scan, migrate, next_scan) != migrate)
return;

Expand Down

0 comments on commit fb003b8

Please sign in to comment.