Re: [PATCH] genirq: procfs: Make smp_affinity read-only for interrupts marked with IRQD_AFFINITY_MANAGED flag

From: Thomas Gleixner
Date: Sun Aug 25 2024 - 07:05:26 EST


On Sat, Aug 24 2024 at 14:54, jeff xie wrote:
>> This unlikely is a pointless exercise as this is not a hotpath
>> operation. Also please switch to S_IRUGO / S_IWUSR and simplify the
>> whole thing to:
>>
>> umode_t umode = S_IRUGO;
>>
>> if (!irqd_affinity_is_managed(&desc->irq_data))
>
> Okay, I will delete the unlikely.
>
> After thoroughly analyzing the code, I think it would be better to
> replace irqd_affinity_is_managed() with irq_can_set_affinity_usr()
> like below. What do you think?
>
> if (irq_can_set_affinity_usr(desc->irq_data.irq))
> umode |= S_IWUSR;

Makes sense