diff mbox series

[v3,19/47] xen: add sched_unit_pause_nosync() and sched_unit_unpause()

Message ID 20190914085251.18816-20-jgross@suse.com (mailing list archive)
State Superseded
Headers show
Series xen: add core scheduling support | expand

Commit Message

Jürgen Groß Sept. 14, 2019, 8:52 a.m. UTC
The credit scheduler calls vcpu_pause_nosync() and vcpu_unpause()
today. Add sched_unit_pause_nosync() and sched_unit_unpause() to
perform the same operations on scheduler units instead.

Signed-off-by: Juergen Gross <jgross@suse.com>
---
 xen/common/sched_credit.c  |  6 +++---
 xen/include/xen/sched-if.h | 10 ++++++++++
 2 files changed, 13 insertions(+), 3 deletions(-)

Comments

Dario Faggioli Sept. 25, 2019, 3:20 p.m. UTC | #1
On Sat, 2019-09-14 at 10:52 +0200, Juergen Gross wrote:
> The credit scheduler calls vcpu_pause_nosync() and vcpu_unpause()
> today. 
>
It does. And, FWIW, I hate it with all my heart because of that (among
other things! :-D).

> Add sched_unit_pause_nosync() and sched_unit_unpause() to
> perform the same operations on scheduler units instead.
> 
> Signed-off-by: Juergen Gross <jgross@suse.com>
>
> diff --git a/xen/include/xen/sched-if.h b/xen/include/xen/sched-if.h
> index d624b81e53..b5967d26af 100644
> --- a/xen/include/xen/sched-if.h
> +++ b/xen/include/xen/sched-if.h
> @@ -432,6 +432,16 @@ static inline int sched_adjust_cpupool(const
> struct scheduler *s,
>      return s->adjust_global ? s->adjust_global(s, op) : 0;
>  }
>  
> +static inline void sched_unit_pause_nosync(struct sched_unit *unit)
> +{
> +    vcpu_pause_nosync(unit->vcpu_list);
> +}
> +
> +static inline void sched_unit_unpause(struct sched_unit *unit)
> +{
> +    vcpu_unpause(unit->vcpu_list);
> +}
> +
So, isn't this another one of those places where we could have the
for_each_unit_vcpu() loop already?

Regards
Jürgen Groß Sept. 26, 2019, 4:49 a.m. UTC | #2
On 25.09.19 17:20, Dario Faggioli wrote:
> On Sat, 2019-09-14 at 10:52 +0200, Juergen Gross wrote:
>> The credit scheduler calls vcpu_pause_nosync() and vcpu_unpause()
>> today.
>>
> It does. And, FWIW, I hate it with all my heart because of that (among
> other things! :-D).
> 
>> Add sched_unit_pause_nosync() and sched_unit_unpause() to
>> perform the same operations on scheduler units instead.
>>
>> Signed-off-by: Juergen Gross <jgross@suse.com>
>>
>> diff --git a/xen/include/xen/sched-if.h b/xen/include/xen/sched-if.h
>> index d624b81e53..b5967d26af 100644
>> --- a/xen/include/xen/sched-if.h
>> +++ b/xen/include/xen/sched-if.h
>> @@ -432,6 +432,16 @@ static inline int sched_adjust_cpupool(const
>> struct scheduler *s,
>>       return s->adjust_global ? s->adjust_global(s, op) : 0;
>>   }
>>   
>> +static inline void sched_unit_pause_nosync(struct sched_unit *unit)
>> +{
>> +    vcpu_pause_nosync(unit->vcpu_list);
>> +}
>> +
>> +static inline void sched_unit_unpause(struct sched_unit *unit)
>> +{
>> +    vcpu_unpause(unit->vcpu_list);
>> +}
>> +
> So, isn't this another one of those places where we could have the
> for_each_unit_vcpu() loop already?

Yes.


Juergen
diff mbox series

Patch

diff --git a/xen/common/sched_credit.c b/xen/common/sched_credit.c
index 044b1d8a51..dcaa9f9557 100644
--- a/xen/common/sched_credit.c
+++ b/xen/common/sched_credit.c
@@ -1065,7 +1065,7 @@  csched_unit_remove(const struct scheduler *ops, struct sched_unit *unit)
     if ( test_and_clear_bit(CSCHED_FLAG_UNIT_PARKED, &svc->flags) )
     {
         SCHED_STAT_CRANK(unit_unpark);
-        vcpu_unpause(svc->unit->vcpu_list);
+        sched_unit_unpause(svc->unit);
     }
 
     spin_lock_irq(&prv->lock);
@@ -1515,7 +1515,7 @@  csched_acct(void* dummy)
                      !test_and_set_bit(CSCHED_FLAG_UNIT_PARKED, &svc->flags) )
                 {
                     SCHED_STAT_CRANK(unit_park);
-                    vcpu_pause_nosync(svc->unit->vcpu_list);
+                    sched_unit_pause_nosync(svc->unit);
                 }
 
                 /* Lower bound on credits */
@@ -1539,7 +1539,7 @@  csched_acct(void* dummy)
                      * if it is woken up here.
                      */
                     SCHED_STAT_CRANK(unit_unpark);
-                    vcpu_unpause(svc->unit->vcpu_list);
+                    sched_unit_unpause(svc->unit);
                     clear_bit(CSCHED_FLAG_UNIT_PARKED, &svc->flags);
                 }
 
diff --git a/xen/include/xen/sched-if.h b/xen/include/xen/sched-if.h
index d624b81e53..b5967d26af 100644
--- a/xen/include/xen/sched-if.h
+++ b/xen/include/xen/sched-if.h
@@ -432,6 +432,16 @@  static inline int sched_adjust_cpupool(const struct scheduler *s,
     return s->adjust_global ? s->adjust_global(s, op) : 0;
 }
 
+static inline void sched_unit_pause_nosync(struct sched_unit *unit)
+{
+    vcpu_pause_nosync(unit->vcpu_list);
+}
+
+static inline void sched_unit_unpause(struct sched_unit *unit)
+{
+    vcpu_unpause(unit->vcpu_list);
+}
+
 #define REGISTER_SCHEDULER(x) static const struct scheduler *x##_entry \
   __used_section(".data.schedulers") = &x;