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

Re: [Xen-devel] [PATCH v3 34/47] xen/sched: add fall back to idle vcpu when scheduling unit

On 25.09.19 15:11, Jan Beulich wrote:
On 25.09.2019 14:58, Jürgen Groß wrote:
On 24.09.19 12:53, Jan Beulich wrote:
On 14.09.2019 10:52, Juergen Gross wrote:
@@ -2015,7 +2079,8 @@ static void sched_slave(void)
pcpu_schedule_unlock_irq(lock, cpu); - sched_context_switch(vprev, sched_unit2vcpu_cpu(next, cpu), now);
+    sched_context_switch(vprev, sched_unit2vcpu_cpu(next, cpu),
+                         is_idle_unit(next) && !is_idle_unit(prev), now);
@@ -2075,7 +2140,8 @@ static void schedule(void)
       pcpu_schedule_unlock_irq(lock, cpu);
vnext = sched_unit2vcpu_cpu(next, cpu);
-    sched_context_switch(vprev, vnext, now);
+    sched_context_switch(vprev, vnext,
+                         !is_idle_unit(prev) && is_idle_unit(next), now);

As a minor remark, I think between such constructs it would be good
if there was no difference, unless there's a reason to have one. Yet
if there was a reason, it surely would want to be spelled out.

I guess you mean changing the parameters of sched_context_switch()? I
can do that.

Well, yes, the two sides of the && in one of them.

Ah, okay.

--- a/xen/include/asm-x86/smp.h
+++ b/xen/include/asm-x86/smp.h
@@ -76,6 +76,9 @@ void set_nr_sockets(void);
   /* Representing HT and core siblings in each socket. */
   extern cpumask_t **socket_cpumask;
+#define get_cpu_current(cpu) \
+    (get_cpu_info_from_stack((unsigned long)stack_base[cpu])->current_vcpu)

I don't think this can go without a comment clarifying under what
(pretty narrow I think) conditions this is legitimate to use.

Okay. I'll add a comment like: "to be used only while no context switch
can occur on the cpu".

To be crystal clear, I'd append ", i.e. by certain scheduling code only".

Fine with me.


Xen-devel mailing list



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