aboutsummaryrefslogtreecommitdiffstats
path: root/kernel
diff options
context:
space:
mode:
Diffstat (limited to 'kernel')
-rw-r--r--kernel/cpuset.c27
1 files changed, 19 insertions, 8 deletions
diff --git a/kernel/cpuset.c b/kernel/cpuset.c
index d5a7e17474ee..66b24d9b6638 100644
--- a/kernel/cpuset.c
+++ b/kernel/cpuset.c
@@ -331,6 +331,24 @@ static void guarantee_online_mems(const struct cpuset *cs, nodemask_t *pmask)
331 BUG_ON(!nodes_intersects(*pmask, node_states[N_HIGH_MEMORY])); 331 BUG_ON(!nodes_intersects(*pmask, node_states[N_HIGH_MEMORY]));
332} 332}
333 333
334/*
335 * update task's spread flag if cpuset's page/slab spread flag is set
336 *
337 * Called with callback_mutex/cgroup_mutex held
338 */
339static void cpuset_update_task_spread_flag(struct cpuset *cs,
340 struct task_struct *tsk)
341{
342 if (is_spread_page(cs))
343 tsk->flags |= PF_SPREAD_PAGE;
344 else
345 tsk->flags &= ~PF_SPREAD_PAGE;
346 if (is_spread_slab(cs))
347 tsk->flags |= PF_SPREAD_SLAB;
348 else
349 tsk->flags &= ~PF_SPREAD_SLAB;
350}
351
334/** 352/**
335 * cpuset_update_task_memory_state - update task memory placement 353 * cpuset_update_task_memory_state - update task memory placement
336 * 354 *
@@ -388,14 +406,7 @@ void cpuset_update_task_memory_state(void)
388 cs = task_cs(tsk); /* Maybe changed when task not locked */ 406 cs = task_cs(tsk); /* Maybe changed when task not locked */
389 guarantee_online_mems(cs, &tsk->mems_allowed); 407 guarantee_online_mems(cs, &tsk->mems_allowed);
390 tsk->cpuset_mems_generation = cs->mems_generation; 408 tsk->cpuset_mems_generation = cs->mems_generation;
391 if (is_spread_page(cs)) 409 cpuset_update_task_spread_flag(cs, tsk);
392 tsk->flags |= PF_SPREAD_PAGE;
393 else
394 tsk->flags &= ~PF_SPREAD_PAGE;
395 if (is_spread_slab(cs))
396 tsk->flags |= PF_SPREAD_SLAB;
397 else
398 tsk->flags &= ~PF_SPREAD_SLAB;
399 task_unlock(tsk); 410 task_unlock(tsk);
400 mutex_unlock(&callback_mutex); 411 mutex_unlock(&callback_mutex);
401 mpol_rebind_task(tsk, &tsk->mems_allowed); 412 mpol_rebind_task(tsk, &tsk->mems_allowed);