diff options
Diffstat (limited to 'kernel/cpuset.c')
-rw-r--r-- | kernel/cpuset.c | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/kernel/cpuset.c b/kernel/cpuset.c index 214806deca99..40c6d801dd66 100644 --- a/kernel/cpuset.c +++ b/kernel/cpuset.c | |||
@@ -1688,6 +1688,39 @@ done: | |||
1688 | return allowed; | 1688 | return allowed; |
1689 | } | 1689 | } |
1690 | 1690 | ||
1691 | /** | ||
1692 | * cpuset_excl_nodes_overlap - Do we overlap @p's mem_exclusive ancestors? | ||
1693 | * @p: pointer to task_struct of some other task. | ||
1694 | * | ||
1695 | * Description: Return true if the nearest mem_exclusive ancestor | ||
1696 | * cpusets of tasks @p and current overlap. Used by oom killer to | ||
1697 | * determine if task @p's memory usage might impact the memory | ||
1698 | * available to the current task. | ||
1699 | * | ||
1700 | * Acquires cpuset_sem - not suitable for calling from a fast path. | ||
1701 | **/ | ||
1702 | |||
1703 | int cpuset_excl_nodes_overlap(const struct task_struct *p) | ||
1704 | { | ||
1705 | const struct cpuset *cs1, *cs2; /* my and p's cpuset ancestors */ | ||
1706 | int overlap = 0; /* do cpusets overlap? */ | ||
1707 | |||
1708 | down(&cpuset_sem); | ||
1709 | cs1 = current->cpuset; | ||
1710 | if (!cs1) | ||
1711 | goto done; /* current task exiting */ | ||
1712 | cs2 = p->cpuset; | ||
1713 | if (!cs2) | ||
1714 | goto done; /* task p is exiting */ | ||
1715 | cs1 = nearest_exclusive_ancestor(cs1); | ||
1716 | cs2 = nearest_exclusive_ancestor(cs2); | ||
1717 | overlap = nodes_intersects(cs1->mems_allowed, cs2->mems_allowed); | ||
1718 | done: | ||
1719 | up(&cpuset_sem); | ||
1720 | |||
1721 | return overlap; | ||
1722 | } | ||
1723 | |||
1691 | /* | 1724 | /* |
1692 | * proc_cpuset_show() | 1725 | * proc_cpuset_show() |
1693 | * - Print tasks cpuset path into seq_file. | 1726 | * - Print tasks cpuset path into seq_file. |