Re: [PATCH V3] sched/isolation: isolate from handling managed interrupt

From: Ming Lei
Date: Mon Jan 20 2020 - 03:59:13 EST


Hello Thomas,

On Sun, Jan 19, 2020 at 05:50:17PM +0100, Thomas Gleixner wrote:
> Ming,
>
> Ming Lei <ming.lei@xxxxxxxxxx> writes:
> >
> > +static bool hk_should_isolate(struct irq_data *data,
> > + const struct cpumask *affinity, unsigned int cpu)
>
> Please align the first argument on the second line with the first
> argument on the first line.
>
> > +{
> > + const struct cpumask *hk_mask;
> > +
> > + if (!housekeeping_enabled(HK_FLAG_MANAGED_IRQ))
> > + return false;
> > +
> > + if (!irqd_affinity_is_managed(data))
> > + return false;
>
> Pointless. That's already checked at the begin of the calling function.
>
> > +
> > + if (!cpumask_test_cpu(cpu, affinity))
> > + return false;
>
> Ditto.
>
> > + hk_mask = housekeeping_cpumask(HK_FLAG_MANAGED_IRQ);
> > + if (cpumask_subset(affinity, hk_mask))
> > + return false;
> > +
> > + if (cpumask_intersects(irq_data_get_effective_affinity_mask(data),
> > + hk_mask))
>
> I really had to think twice why this is correct. The example I gave you
> is far more intuitive. It's just missing the check below.

Your example uses isolation mask, which has to be allocated and built
from housekeeping_cpumask(HK_FLAG_MANAGED_IRQ), that is why I use the
above way so that we can avoid the allocation.

IMO, the above is intuitive too, given it can be thought as effective
affinity including hk CPUs.

Thanks,
Ming