mvebu: kirkwood: fix ehci-orion probe if generic-phy isn't enabled
[openwrt/openwrt.git] / target / linux / generic / patches-4.1 / 130-MIPS-kernel-fix-sched_getaffinity-with-MT-FPAFF-enab.patch
1 From: Felix Fietkau <nbd@openwrt.org>
2 Date: Sun, 19 Jul 2015 00:21:57 +0200
3 Subject: [PATCH] MIPS: kernel: fix sched_getaffinity with MT FPAFF enabled
4
5 p->thread.user_cpus_allowed is zero-initialized and is only filled on
6 the first sched_setaffinity call.
7
8 To avoid adding overhead in the task initialization codepath, simply OR
9 the returned mask in sched_getaffinity with p->cpus_allowed.
10
11 Cc: stable@vger.kernel.org
12 Signed-off-by: Felix Fietkau <nbd@openwrt.org>
13 ---
14
15 --- a/arch/mips/kernel/mips-mt-fpaff.c
16 +++ b/arch/mips/kernel/mips-mt-fpaff.c
17 @@ -154,7 +154,7 @@ asmlinkage long mipsmt_sys_sched_getaffi
18 unsigned long __user *user_mask_ptr)
19 {
20 unsigned int real_len;
21 - cpumask_t mask;
22 + cpumask_t allowed, mask;
23 int retval;
24 struct task_struct *p;
25
26 @@ -173,7 +173,8 @@ asmlinkage long mipsmt_sys_sched_getaffi
27 if (retval)
28 goto out_unlock;
29
30 - cpumask_and(&mask, &p->thread.user_cpus_allowed, cpu_possible_mask);
31 + cpumask_or(&allowed, &p->thread.user_cpus_allowed, &p->cpus_allowed);
32 + cpumask_and(&mask, &allowed, cpu_active_mask);
33
34 out_unlock:
35 read_unlock(&tasklist_lock);