Re: [Xen-devel] [PATCH] xen/sched: avoid cpumasks on stack in sched/core.c
On 24.01.20 01:01, Dario Faggioli wrote: On Thu, 2020-01-23 at 10:03 +0100, Juergen Gross wrote: There are still several instances of cpumask_t on the stack in scheduling code. Avoid them as far as possible. Signed-off-by: Juergen Gross Reviewed-by: Dario Faggioli Just curious... --- a/xen/common/sched/core.c +++ b/xen/common/sched/core.c @@ -2586,11 +2582,11 @@ static void schedule(void) if ( gran > 1 ) { -cpumask_t mask; +cpumask_t *mask = cpumask_scratch_cpu(cpu); prev->rendezvous_in_cnt = gran; -cpumask_andnot(, sr->cpus, cpumask_of(cpu)); -cpumask_raise_softirq(, SCHED_SLAVE_SOFTIRQ); +cpumask_andnot(mask, sr->cpus, cpumask_of(cpu)); +cpumask_raise_softirq(mask, SCHED_SLAVE_SOFTIRQ); ... why are we keeping the temporary variable (mask) ? per_cpu accesses are more expensive than those to local variables. mask is used twice. Juergen ___ Xen-devel mailing list Xen-devel@lists.xenproject.org https://lists.xenproject.org/mailman/listinfo/xen-devel
Re: [Xen-devel] [PATCH] xen/sched: avoid cpumasks on stack in sched/core.c
On Thu, 2020-01-23 at 10:03 +0100, Juergen Gross wrote: > There are still several instances of cpumask_t on the stack in > scheduling code. Avoid them as far as possible. > > Signed-off-by: Juergen Gross > Reviewed-by: Dario Faggioli Just curious... > --- a/xen/common/sched/core.c > +++ b/xen/common/sched/core.c > @@ -2586,11 +2582,11 @@ static void schedule(void) > > if ( gran > 1 ) > { > -cpumask_t mask; > +cpumask_t *mask = cpumask_scratch_cpu(cpu); > > prev->rendezvous_in_cnt = gran; > -cpumask_andnot(, sr->cpus, cpumask_of(cpu)); > -cpumask_raise_softirq(, SCHED_SLAVE_SOFTIRQ); > +cpumask_andnot(mask, sr->cpus, cpumask_of(cpu)); > +cpumask_raise_softirq(mask, SCHED_SLAVE_SOFTIRQ); > ... why are we keeping the temporary variable (mask) ? Thanks and Regards -- Dario Faggioli, Ph.D http://about.me/dario.faggioli Virtualization Software Engineer SUSE Labs, SUSE https://www.suse.com/ --- <> (Raistlin Majere) signature.asc Description: This is a digitally signed message part ___ Xen-devel mailing list Xen-devel@lists.xenproject.org https://lists.xenproject.org/mailman/listinfo/xen-devel