diff options
author | Peter Zijlstra <peterz@infradead.org> | 2013-10-07 06:29:21 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@kernel.org> | 2013-10-09 08:47:47 -0400 |
commit | 8c8a743c5087bac9caac8155b8f3b367e75cdd0b (patch) | |
tree | d5cc5c5f4368cf7d3deb627388c869dbea2e83f2 /include/linux | |
parent | 90572890d202527c366aa9489b32404e88a7c020 (diff) |
sched/numa: Use {cpu, pid} to create task groups for shared faults
While parallel applications tend to align their data on the cache
boundary, they tend not to align on the page or THP boundary.
Consequently tasks that partition their data can still "false-share"
pages presenting a problem for optimal NUMA placement.
This patch uses NUMA hinting faults to chain tasks together into
numa_groups. As well as storing the NID a task was running on when
accessing a page a truncated representation of the faulting PID is
stored. If subsequent faults are from different PIDs it is reasonable
to assume that those two tasks share a page and are candidates for
being grouped together. Note that this patch makes no scheduling
decisions based on the grouping information.
Signed-off-by: Peter Zijlstra <peterz@infradead.org>
Signed-off-by: Mel Gorman <mgorman@suse.de>
Reviewed-by: Rik van Riel <riel@redhat.com>
Cc: Andrea Arcangeli <aarcange@redhat.com>
Cc: Johannes Weiner <hannes@cmpxchg.org>
Cc: Srikar Dronamraju <srikar@linux.vnet.ibm.com>
Link: http://lkml.kernel.org/r/1381141781-10992-44-git-send-email-mgorman@suse.de
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Diffstat (limited to 'include/linux')
-rw-r--r-- | include/linux/mm.h | 11 | ||||
-rw-r--r-- | include/linux/sched.h | 3 |
2 files changed, 14 insertions, 0 deletions
diff --git a/include/linux/mm.h b/include/linux/mm.h index ce464cd4777e..81443d557a2e 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h | |||
@@ -691,6 +691,12 @@ static inline bool cpupid_cpu_unset(int cpupid) | |||
691 | return cpupid_to_cpu(cpupid) == (-1 & LAST__CPU_MASK); | 691 | return cpupid_to_cpu(cpupid) == (-1 & LAST__CPU_MASK); |
692 | } | 692 | } |
693 | 693 | ||
694 | static inline bool __cpupid_match_pid(pid_t task_pid, int cpupid) | ||
695 | { | ||
696 | return (task_pid & LAST__PID_MASK) == cpupid_to_pid(cpupid); | ||
697 | } | ||
698 | |||
699 | #define cpupid_match_pid(task, cpupid) __cpupid_match_pid(task->pid, cpupid) | ||
694 | #ifdef LAST_CPUPID_NOT_IN_PAGE_FLAGS | 700 | #ifdef LAST_CPUPID_NOT_IN_PAGE_FLAGS |
695 | static inline int page_cpupid_xchg_last(struct page *page, int cpupid) | 701 | static inline int page_cpupid_xchg_last(struct page *page, int cpupid) |
696 | { | 702 | { |
@@ -760,6 +766,11 @@ static inline bool cpupid_pid_unset(int cpupid) | |||
760 | static inline void page_cpupid_reset_last(struct page *page) | 766 | static inline void page_cpupid_reset_last(struct page *page) |
761 | { | 767 | { |
762 | } | 768 | } |
769 | |||
770 | static inline bool cpupid_match_pid(struct task_struct *task, int cpupid) | ||
771 | { | ||
772 | return false; | ||
773 | } | ||
763 | #endif /* CONFIG_NUMA_BALANCING */ | 774 | #endif /* CONFIG_NUMA_BALANCING */ |
764 | 775 | ||
765 | static inline struct zone *page_zone(const struct page *page) | 776 | static inline struct zone *page_zone(const struct page *page) |
diff --git a/include/linux/sched.h b/include/linux/sched.h index b6619792bb13..f587ded5c148 100644 --- a/include/linux/sched.h +++ b/include/linux/sched.h | |||
@@ -1347,6 +1347,9 @@ struct task_struct { | |||
1347 | u64 node_stamp; /* migration stamp */ | 1347 | u64 node_stamp; /* migration stamp */ |
1348 | struct callback_head numa_work; | 1348 | struct callback_head numa_work; |
1349 | 1349 | ||
1350 | struct list_head numa_entry; | ||
1351 | struct numa_group *numa_group; | ||
1352 | |||
1350 | /* | 1353 | /* |
1351 | * Exponential decaying average of faults on a per-node basis. | 1354 | * Exponential decaying average of faults on a per-node basis. |
1352 | * Scheduling placement decisions are made based on the these counts. | 1355 | * Scheduling placement decisions are made based on the these counts. |