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

Re: [Xen-devel] [PATCH] xen: credit2: document that min_rqd is valid and ok to use


  • To: "dunlapg@xxxxxxxxx" <dunlapg@xxxxxxxxx>
  • From: Dario Faggioli <dfaggioli@xxxxxxxx>
  • Date: Mon, 26 Oct 2020 17:44:33 +0000
  • Accept-language: en-US
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=suse.com; dmarc=pass action=none header.from=suse.com; dkim=pass header.d=suse.com; arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=s+dcP0fDsH7fHeSWMU+ap3zr7bH622FyjHlpD2W3gSI=; b=EtlMy0e383W75vSzQIt3zDvFBEn1KYgaisj096OfMxKolWHAaCnTpqHd90eRLNG4yRU67Q2d/EBd8h4Ek5GxUehR6aZvll1l899IyzSMpqBNIl87exHID9QNDG5A/Nmiw+TqD0ZelQR1KCG0O/GXPPW/lrqHQc30oYj7t6Nmgnl040KtnqCMBKTOQSASTul1uOs/8RB8jKDoV0+FoCekw/jIbtwjr/+LmHq3hCzkqugr1Fk+7CAdsDYBCXTWP4rnZiBgHwK5Aejl2WEQxPWRtN5L6aqvNiapaJ+Iyj4jnRYlMn8lK2WgG/YUk7FMrfN5WzdfYJRzfqzSyvc3xYxtqQ==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=A2aNUeYsGKkOy5fpABeZP48YPp5kjq061clD/DFK9BT7aTmDug2Xg5lPbB4aGBRiUpBPg8s4TpJxHUI3/0V2H+WFxnk40CShD+MEu/z0RIPb/7rwTtNzr0yj7qojluKp5wuX9xG9peXP5xEjT3PiIjtonzXN2Gd/B9jWv7dcXvuF+PCJr+r7C/fP9muc5WqBI1C6B0365fsY568zqX+oBLsgf+P4a2g/cHWCPk8yAhWaPRlYQByxiT4kBpoSlavuf/0RSPhZps3n+05NlScQRq3qpubehNab12eVt/tBK5kQX+uN3KfL3kkfncXtvYFeSqm+IIoMq/rFpfv3HBt+4Q==
  • Authentication-results: umich.edu; dkim=none (message not signed) header.d=none;umich.edu; dmarc=none action=none header.from=suse.com;
  • Cc: Juergen Gross <JGross@xxxxxxxx>, Jan Beulich <JBeulich@xxxxxxxx>, "george.dunlap@xxxxxxxxxx" <george.dunlap@xxxxxxxxxx>, "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • Delivery-date: Mon, 26 Oct 2020 17:45:00 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
  • Thread-index: AQHWq4TS/h5FA3rgjEyszqb6NOGihKmqKEQA
  • Thread-topic: [Xen-devel] [PATCH] xen: credit2: document that min_rqd is valid and ok to use

On Mon, 2020-10-26 at 10:43 +0000, George Dunlap wrote:
> On Thu, Mar 26, 2020 at 5:09 PM Dario Faggioli <dfaggioli@xxxxxxxx>
> wrote:
> > diff --git a/xen/common/sched/credit2.c
> > b/xen/common/sched/credit2.c
> > index c7241944a8..9da51e624b 100644
> > --- a/xen/common/sched/credit2.c
> > +++ b/xen/common/sched/credit2.c
> > @@ -2387,6 +2387,13 @@ csched2_res_pick(const struct scheduler
> > *ops, const struct sched_unit *unit)
> >          goto out_up;
> >      }
> > 
> > +    /*
> > +     * If we're here, min_rqd must be valid. In fact, either we
> > picked a
> > +     * runqueue in the "list_for_each" (as min_avgload is
> > initialized to
> > +     * MAX_LOAD) or we just did that (in the "else" branch) above.
> > +     */
> 
> 
> Sorry it's taken so long to get back to you on this.
> 
> The problem with this is that there are actually *three* alternate
> clauses above:
> 
> 1. (has_soft && min_s_rqd)
> 2. min_rqd
> 3. <none of the above>
> 
Yes, indeed.

However, one of the three is "if (min_rqs)", and I think it is clear
that in that case (which would be 2 in the list above) min_rqd is
valid.

Therefore, this part of the comment "In fact, either we picked a
runqueue in the "list_for_each" (as min_avgload is initialized to
MAX_LOAD)", was referring to 1.

And this other part "or we just did that (in the "else" branch) above",
was referring to 3.

> It's obvious that if we hit #2 or #3, that min_rqd will be set.  But
> it's not immediately obvious why the condition in #1 guarantees that
> min_rqd will be set.
> 
That's what I tried to explain with this: "we picked a runqueue in the
"list_for_each" (as min_avgload is initialized to MAX_LOAD)"

> Is it because if we get to the point in the above loop where
> min_s_rqd is set, then min_rqd will always be set if it hasn't been
> set already?  Or to put it a different way -- the only way for
> min_rqd *not* to be set is if it always bailed before min_s_rqd was
> set?
> 
The point is really that the "list_for_each" loop scans all the
runqueues. If we do at least one step of the loop, min_rqd is ok,
because min_avgload is initialized to MAX_LOAD, and hence we have done
at least one assignment of min_rq=rqd (in the body of the very last if
of the loop itself).

min_s_rqd may or may not have been set to point to any runqueue. But if
it is valid, it means we have done at least one step of the loop, and
hence min_rqd is valid too.

Makes sense? :-)

Regards
-- 
Dario Faggioli, Ph.D
http://about.me/dario.faggioli
Virtualization Software Engineer
SUSE Labs, SUSE https://www.suse.com/
-------------------------------------------------------------------
<<This happens because _I_ choose it to happen!>> (Raistlin Majere)

Attachment: signature.asc
Description: This is a digitally signed message part


 


Rackspace

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