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

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 <jgross@xxxxxxxx>

Reviewed-by: Dario Faggioli <dfaggioli@xxxxxxxx>

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(&mask, sr->cpus, cpumask_of(cpu));
-        cpumask_raise_softirq(&mask, 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@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/xen-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.