Messages in this thread | | | Date | Sat, 27 Aug 2022 16:24:17 +0100 | From | Marc Zyngier <> | Subject | Re: [PATCH -next 2/3] genirq/affinity: Define tmp_mask as a local variable in irq_do_set_affinity |
| |
On Sat, 27 Aug 2022 02:13:50 +0100, Xu Qiang <xuqiang36@huawei.com> wrote: > > When irq_do_set_affinity is called, tmp_mask saved last time > does not make any sense. it is reassigned before each use, > so it should be defined as a local variable. > > Fixes: 33de0aa4bae9 (“genirq: Always limit the affinity to online CPUs”) > Signed-off-by: Xu Qiang <xuqiang36@huawei.com> > --- > kernel/irq/manage.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/kernel/irq/manage.c b/kernel/irq/manage.c > index c3423f552e0b..ae1c7eebdfa6 100644 > --- a/kernel/irq/manage.c > +++ b/kernel/irq/manage.c > @@ -218,7 +218,7 @@ int irq_do_set_affinity(struct irq_data *data, const struct cpumask *mask, > int ret; > > static DEFINE_RAW_SPINLOCK(tmp_mask_lock); > - static struct cpumask tmp_mask; > + struct cpumask tmp_mask; > > if (!chip || !chip->irq_set_affinity) > return -EINVAL;
Oh Gawd... Don't you see *WHY* this is a static structure? Hint: what is the effect of this on a machine with 4096 CPUs when the stack space is tight? And what would be the point of having a spinlock to protect a local variable?
M.
-- Without deviation from the norm, progress is not possible.
| |