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

[Xen-changelog] [xen staging] sched/credit: avoid priority boost for capped domains when unpark



commit 5c8c0ae7c45ef45acde29638fa342c2d721ae70a
Author:     Eslam Elnikety <elnikety@xxxxxxxxxx>
AuthorDate: Fri May 3 19:43:49 2019 +0000
Commit:     Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
CommitDate: Mon May 13 10:35:38 2019 +0100

    sched/credit: avoid priority boost for capped domains when unpark
    
    When unpausing a capped domain, the scheduler currently clears the
    CSCHED_FLAG_VCPU_PARKED flag before vcpu_wake(). This, in turn, causes the
    vcpu_wake to set CSCHED_PRI_TS_BOOST, resulting in an unfair credit boost. 
The
    comment around the changed lines already states that clearing the flag 
should
    happen AFTER the unpause. This bug was introduced in commit be650750945
    "credit1: Use atomic bit operations for the flags structure".
    
    Original patch author credit: Xi Xiong while at Amazon.
    
    Signed-off-by: Eslam Elnikety <elnikety@xxxxxxxxxx>
    Reviewed-by: Leonard Foerster <foersleo@xxxxxxxxx>
    Reviewed-by: Petre Eftime <epetre@xxxxxxxxxx>
    Acked-by: Dario Faggioli <dfaggioli@xxxxxxxx>
---
 xen/common/sched_credit.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/xen/common/sched_credit.c b/xen/common/sched_credit.c
index 3abe20def8..7b7facbace 100644
--- a/xen/common/sched_credit.c
+++ b/xen/common/sched_credit.c
@@ -1538,7 +1538,7 @@ csched_acct(void* dummy)
                 svc->pri = CSCHED_PRI_TS_UNDER;
 
                 /* Unpark any capped domains whose credits go positive */
-                if ( test_and_clear_bit(CSCHED_FLAG_VCPU_PARKED, &svc->flags) )
+                if ( test_bit(CSCHED_FLAG_VCPU_PARKED, &svc->flags) )
                 {
                     /*
                      * It's important to unset the flag AFTER the unpause()
@@ -1547,6 +1547,7 @@ csched_acct(void* dummy)
                      */
                     SCHED_STAT_CRANK(vcpu_unpark);
                     vcpu_unpause(svc->vcpu);
+                    clear_bit(CSCHED_FLAG_VCPU_PARKED, &svc->flags);
                 }
 
                 /* Upper bound on credits means VCPU stops earning */
--
generated by git-patchbot for /home/xen/git/xen.git#staging

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/xen-changelog

 


Rackspace

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