aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/cpuset.c
diff options
context:
space:
mode:
authorPaul Jackson <pj@sgi.com>2006-01-08 04:01:55 -0500
committerLinus Torvalds <torvalds@g5.osdl.org>2006-01-08 23:13:44 -0500
commit909d75a3b77bdd8baa9429bad3b69a654d2954ce (patch)
treef9955ff697b7569fc75e5b8683d886315f34ac49 /kernel/cpuset.c
parentcf2a473c4089aa41c26f653200673f5a4cc25047 (diff)
[PATCH] cpuset: implement cpuset_mems_allowed
Provide a cpuset_mems_allowed() method, which the sys_migrate_pages() code needed, to obtain the mems_allowed vector of a cpuset, and replaced the workaround in sys_migrate_pages() to call this new method. Signed-off-by: Paul Jackson <pj@sgi.com> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'kernel/cpuset.c')
-rw-r--r--kernel/cpuset.c29
1 files changed, 26 insertions, 3 deletions
diff --git a/kernel/cpuset.c b/kernel/cpuset.c
index e9917d71628a..0d0dbbd6560a 100644
--- a/kernel/cpuset.c
+++ b/kernel/cpuset.c
@@ -1871,14 +1871,14 @@ void cpuset_exit(struct task_struct *tsk)
1871 * tasks cpuset. 1871 * tasks cpuset.
1872 **/ 1872 **/
1873 1873
1874cpumask_t cpuset_cpus_allowed(const struct task_struct *tsk) 1874cpumask_t cpuset_cpus_allowed(struct task_struct *tsk)
1875{ 1875{
1876 cpumask_t mask; 1876 cpumask_t mask;
1877 1877
1878 down(&callback_sem); 1878 down(&callback_sem);
1879 task_lock((struct task_struct *)tsk); 1879 task_lock(tsk);
1880 guarantee_online_cpus(tsk->cpuset, &mask); 1880 guarantee_online_cpus(tsk->cpuset, &mask);
1881 task_unlock((struct task_struct *)tsk); 1881 task_unlock(tsk);
1882 up(&callback_sem); 1882 up(&callback_sem);
1883 1883
1884 return mask; 1884 return mask;
@@ -1890,6 +1890,29 @@ void cpuset_init_current_mems_allowed(void)
1890} 1890}
1891 1891
1892/** 1892/**
1893 * cpuset_mems_allowed - return mems_allowed mask from a tasks cpuset.
1894 * @tsk: pointer to task_struct from which to obtain cpuset->mems_allowed.
1895 *
1896 * Description: Returns the nodemask_t mems_allowed of the cpuset
1897 * attached to the specified @tsk. Guaranteed to return some non-empty
1898 * subset of node_online_map, even if this means going outside the
1899 * tasks cpuset.
1900 **/
1901
1902nodemask_t cpuset_mems_allowed(struct task_struct *tsk)
1903{
1904 nodemask_t mask;
1905
1906 down(&callback_sem);
1907 task_lock(tsk);
1908 guarantee_online_mems(tsk->cpuset, &mask);
1909 task_unlock(tsk);
1910 up(&callback_sem);
1911
1912 return mask;
1913}
1914
1915/**
1893 * cpuset_zonelist_valid_mems_allowed - check zonelist vs. curremt mems_allowed 1916 * cpuset_zonelist_valid_mems_allowed - check zonelist vs. curremt mems_allowed
1894 * @zl: the zonelist to be checked 1917 * @zl: the zonelist to be checked
1895 * 1918 *