FROMGIT: sched: Always clear user_cpus_ptr in do_set_cpus_allowed()
The do_set_cpus_allowed() function is used by either kthread_bind() or select_fallback_rq(). In both cases the user affinity (if any) should be destroyed too. Change-Id: I9da8961ebeefa2ac1d42eec3ea80ae2cbdddf485 Suggested-by: Peter Zijlstra <peterz@infradead.org> Signed-off-by: Waiman Long <longman@redhat.com> Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org> Link: https://lkml.kernel.org/r/20220922180041.1768141-6-longman@redhat.com BUG: 254447891 (cherry picked from commit 0083fbe7953602c341454889af01ada601ffac3b https://git.kernel.org/pub/scm/linux/kernel/git/peterz/queue.git sched/core)) Signed-off-by: Ashay Jaiswal <quic_ashayj@quicinc.com>
This commit is contained in:
committed by
Quentin Perret
parent
ec8cf94166
commit
448eb7ef25
@@ -2576,14 +2576,20 @@ __do_set_cpus_allowed(struct task_struct *p, struct affinity_context *ctx)
|
||||
set_next_task(rq, p);
|
||||
}
|
||||
|
||||
/*
|
||||
* Used for kthread_bind() and select_fallback_rq(), in both cases the user
|
||||
* affinity (if any) should be destroyed too.
|
||||
*/
|
||||
void do_set_cpus_allowed(struct task_struct *p, const struct cpumask *new_mask)
|
||||
{
|
||||
struct affinity_context ac = {
|
||||
.new_mask = new_mask,
|
||||
.flags = 0,
|
||||
.user_mask = NULL,
|
||||
.flags = SCA_USER, /* clear the user requested mask */
|
||||
};
|
||||
|
||||
__do_set_cpus_allowed(p, &ac);
|
||||
kfree(ac.user_mask);
|
||||
}
|
||||
|
||||
int dup_user_cpus_ptr(struct task_struct *dst, struct task_struct *src,
|
||||
|
||||
Reference in New Issue
Block a user