Re: [PATCH 2/6] sched/topology: optimize topology_span_sane()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, May 14, 2024 at 10:53:00PM +0200, Christophe JAILLET wrote:
> Le 14/05/2024 à 00:01, Yury Norov a écrit :
> > The function may call cpumask_equal with tl->mask(cpu) == tl->mask(i),
> > even though cpu != i. In such case, cpumask_equal() would always return
> > true, and we can proceed to the next CPU immediately.
> > 
> > Signed-off-by: Yury Norov <yury.norov-Re5JQEeQqe8AvxtiuMwx3w@xxxxxxxxxxxxxxxx>
> > ---
> >   kernel/sched/topology.c | 2 +-
> >   1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > diff --git a/kernel/sched/topology.c b/kernel/sched/topology.c
> > index 99ea5986038c..eb9eb17b0efa 100644
> > --- a/kernel/sched/topology.c
> > +++ b/kernel/sched/topology.c
> > @@ -2360,7 +2360,7 @@ static bool topology_span_sane(struct sched_domain_topology_level *tl,
> >   	 * breaks the linking done for an earlier span.
> >   	 */
> >   	for_each_cpu(i, cpu_map) {
> > -		if (i == cpu)
> > +		if (i == cpu || tl->mask(cpu) == tl->mask(i))
> >   			continue;
> >   		/*
> >   		 * We should 'and' all those masks with 'cpu_map' to exactly
> 
> Hi,
> 
> does it make sense to pre-compute tl->mask(cpu) outside the for_each_cpu()?

Looks like a good idea to me.

Leo 

> 
> CJ
> 





[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]     [Monitors]

  Powered by Linux