From: "Jan Beulich" Subject: Re: [PATCH] xen: recalculate per-cpupool credits when updating timeslice Date: Fri, 29 Jan 2016 03:46:28 -0700 Message-ID: <56AB511402000078000CC59C@prv-mh.provo.novell.com> References: <1454062908-32013-1-git-send-email-jgross@suse.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <1454062908-32013-1-git-send-email-jgross@suse.com> Content-Disposition: inline List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Juergen Gross Cc: george.dunlap@eu.citrix.com, dario.faggioli@citrix.com, xen-devel@lists.xen.org List-Id: xen-devel@lists.xenproject.org >>> On 29.01.16 at 11:21, wrote: > --- a/xen/common/sched_credit.c > +++ b/xen/common/sched_credit.c > @@ -1086,12 +1086,19 @@ csched_dom_cntl( > static inline void > __csched_set_tslice(struct csched_private *prv, unsigned timeslice) > { > + unsigned long flags; > + > + spin_lock_irqsave(&prv->lock, flags); > + > prv->tslice_ms = timeslice; > prv->ticks_per_tslice = CSCHED_TICKS_PER_TSLICE; > if ( prv->tslice_ms < prv->ticks_per_tslice ) > prv->ticks_per_tslice = 1; > prv->tick_period_us = prv->tslice_ms * 1000 / prv->ticks_per_tslice; > prv->credits_per_tslice = CSCHED_CREDITS_PER_MSEC * prv->tslice_ms; > + prv->credit = prv->credits_per_tslice * prv->ncpus; > + > + spin_unlock_irqrestore(&prv->lock, flags); > } The added locking, which has no reason give for in the description at all, puzzles me: I can see it being needed (and having been missing) when called from csched_sys_cntl(), but it's not clear to me why it would be needed when called from csched_init(). Yet csched_sys_cntl() subsequently als updates prv->ratelimit_us, and hence the lock would perhaps better be taken there? Jan