Message ID | 20190503153839.19932-1-elnikety@amazon.com (mailing list archive) |
---|---|
State | Superseded |
Headers | show |
Series | sched/credit: avoid priority boost for capped domains when unpark | expand |
On Fri, 2019-05-03 at 15:38 +0000, Eslam Elnikety wrote: > 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. > Mmm... I'm not an expert of these things, but doesn't this means we need a "Signed-off-by: Xi Xiong <xxx@yyy.zzz>" then? Cc-ing Lars... > Signed-off-by: Eslam Elnikety <elnikety@amazon.com> > Reviewed-by: Leonard Foerster <foersleo@amazon.de> > Reviewed-by: Petre Eftime <epetre@amazon.com> > About the patch itself: Acked-by: Dario Faggioli <dfaggioli@suse.com> With just one suggestion... > --- 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,8 @@ csched_acct(void* dummy) > */ > SCHED_STAT_CRANK(vcpu_unpark); > vcpu_unpause(svc->vcpu); > + /* Now clear the PARKED flag */ > + clear_bit(CSCHED_FLAG_VCPU_PARKED, &svc->flags); > I don't think adding the comment here is necessary. The one which is already present, explains things well enough, and this one does not add much. Acked-by stands anyway, but I'd prefer it to be removed (which I think could be done when committing the patch?). Regards
> On 3 May 2019, at 10:48, Dario Faggioli <dfaggioli@suse.com> wrote: > > On Fri, 2019-05-03 at 15:38 +0000, Eslam Elnikety wrote: >> 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. >> > Mmm... I'm not an expert of these things, but doesn't this means we > need a "Signed-off-by: Xi Xiong <xxx@yyy.zzz>" then? Cc-ing Lars... As far as I can tell from a quick search on xen-devel@ Xi Xiong is or was an Amazon employee so a signed-off-by is not strictly necessary but you may want to say something like. Original patch author credit: Xi Xiong of Amazon Lars
On 3. May 2019, at 20:56, Lars Kurth <lars.kurth.xen@gmail.com<mailto:lars.kurth.xen@gmail.com>> wrote: On 3 May 2019, at 10:48, Dario Faggioli <dfaggioli@suse.com<mailto:dfaggioli@suse.com>> wrote: On Fri, 2019-05-03 at 15:38 +0000, Eslam Elnikety wrote: 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. Mmm... I'm not an expert of these things, but doesn't this means we need a "Signed-off-by: Xi Xiong <xxx@yyy.zzz<mailto:xxx@yyy.zzz>>" then? Cc-ing Lars... As far as I can tell from a quick search on xen-devel@ Xi Xiong is or was an Amazon employee so a signed-off-by is not strictly necessary but you may want to say something like. Original patch author credit: Xi Xiong of Amazon Lars Thanks for the prompt responses, Lars and Dario. Indeed. Xi was with Amazon. I will adjust the commit message accordingly. (I will also omit the additional comment as pointed out by Dario). <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=us-ascii"> </head> <body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""> <br class=""> <div> <blockquote type="cite" class=""> <div class="">On 3. May 2019, at 20:56, Lars Kurth <<a href="mailto:lars.kurth.xen@gmail.com" class="">lars.kurth.xen@gmail.com</a>> wrote:</div> <br class="Apple-interchange-newline"> <div class=""><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""> <br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""> <blockquote type="cite" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;" class=""> On 3 May 2019, at 10:48, Dario Faggioli <<a href="mailto:dfaggioli@suse.com" class="">dfaggioli@suse.com</a>> wrote:<br class=""> <br class=""> On Fri, 2019-05-03 at 15:38 +0000, Eslam Elnikety wrote:<br class=""> <blockquote type="cite" class="">When unpausing a capped domain, the scheduler currently clears the<br class=""> CSCHED_FLAG_VCPU_PARKED flag before vcpu_wake(). This, in turn,<br class=""> causes the<br class=""> vcpu_wake to set CSCHED_PRI_TS_BOOST, resulting in an unfair credit<br class=""> boost. The<br class=""> comment around the changed lines already states that clearing the<br class=""> flag should<br class=""> happen AFTER the unpause. This bug was introduced in commit<br class=""> be650750945<br class=""> "credit1: Use atomic bit operations for the flags structure".<br class=""> <br class=""> Original patch author credit: Xi Xiong.<br class=""> <br class=""> </blockquote> Mmm... I'm not an expert of these things, but doesn't this means we<br class=""> need a "Signed-off-by: Xi Xiong <<a href="mailto:xxx@yyy.zzz" class="">xxx@yyy.zzz</a>>" then? Cc-ing Lars...<br class=""> </blockquote> <br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""> <span style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class="">As far as I can tell from a quick search on xen-devel@ Xi Xiong is or<span class="Apple-converted-space"> </span></span><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""> <span style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class="">was an Amazon employee so a signed-off-by is not strictly necessary</span><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""> <span style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class="">but you may want to say something like.</span><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""> <br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""> <span style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class="">Original patch author credit: Xi Xiong of Amazon</span><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""> <br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""> <span style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class="">Lars</span></div> </blockquote> </div> <div class=""><br class=""> </div> Thanks for the prompt responses, Lars and Dario. <div class=""><br class=""> <div class="">Indeed. Xi was with Amazon. I will adjust the commit message accordingly. (I will also omit the additional comment as pointed out by Dario).</div> </div> </body> </html>
diff --git a/xen/common/sched_credit.c b/xen/common/sched_credit.c index 3abe20def8..8eb1aba12a 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,8 @@ csched_acct(void* dummy) */ SCHED_STAT_CRANK(vcpu_unpark); vcpu_unpause(svc->vcpu); + /* Now clear the PARKED flag */ + clear_bit(CSCHED_FLAG_VCPU_PARKED, &svc->flags); } /* Upper bound on credits means VCPU stops earning */