cpuset: Restore tasks affinity while moving across cpusets

When tasks move across cpusets, the current affinity settings
are lost. Cache the task affinity and restore it during cpuset
migration. The restoring happens only when the cached affinity
is subset of the current cpuset settings.

Change-Id: I6c2ec1d5e3d994e176926d94b9e0cc92418020cc
Signed-off-by: Pavankumar Kondeti <[email protected]>
[[email protected]: fix trivial merge conflicts and
replace cs->cpus_requested with cs->cpus_allowed]
Signed-off-by: Satya Durga Srinivasu Prabhala <[email protected]>
This commit is contained in:
Pavankumar Kondeti 2019-02-28 10:40:39 +05:30 • committed by Gerrit - the friendly Code Review server
commit 311342d796
4 changed files with 32 additions and 2 deletions

View file

@ -5634,6 +5634,11 @@ again:
retval = -EINVAL;
}
#ifdef CONFIG_SCHED_WALT
if (!retval && !(p->flags & PF_KTHREAD))
cpumask_and(&p->cpus_requested, in_mask, cpu_possible_mask);
#endif
out_free_new_mask:
free_cpumask_var(new_mask);
out_free_cpus_allowed:
@ -6780,6 +6785,9 @@ void __init sched_init_smp(void)
/* Move init over to a non-isolated CPU */
if (set_cpus_allowed_ptr(current, housekeeping_cpumask(HK_FLAG_DOMAIN)) < 0)
BUG();
#ifdef CONFIG_SCHED_WALT
cpumask_copy(&current->cpus_requested, cpu_possible_mask);
#endif
sched_init_granularity();
init_sched_rt_class();