From: Dario Faggioli <dario.faggioli@citrix.com>
To: Meng Xu <mengxu@cis.upenn.edu>, Tianyang Chen <tiche@seas.upenn.edu>
Cc: "xen-devel@lists.xenproject.org" <xen-devel@lists.xenproject.org>,
George Dunlap <george.dunlap@citrix.com>
Subject: Re: [PATCH] xen: sched: rtds: refactor code
Date: Fri, 13 May 2016 09:41:41 +0200 [thread overview]
Message-ID: <1463125301.18789.21.camel@citrix.com> (raw)
In-Reply-To: <CAENZ-+m8YgtxX8gwKzMfr5y=iARsooE1kw5N_LL-8HDagdoz9Q@mail.gmail.com>
[-- Attachment #1.1: Type: text/plain, Size: 3609 bytes --]
On Thu, 2016-05-12 at 23:34 -0400, Meng Xu wrote:
> On Wed, May 11, 2016 at 11:20 AM, Tianyang Chen <tiche@seas.upenn.edu
> > wrote:
> >
> > No functional change:
> > -Various coding style fix
> > -Added comments for UPDATE_LIMIT_SHIFT.
> >
Hey, Tianyang, thanks for this.
> > Use non-atomic bit-ops:
> > -Vcpu flags are checked and cleared atomically. Performance can be
> > improved with corresponding non-atomic versions since schedule.c
> > already has spin_locks in place.
> >
And this too. However, I think the patch should be split at least in
two, one doing the style/comments cleanups, the other doing the
atomic/non-atomic switch.
> > Suggested-by: Dario Faggioli <dario.faggioli@citrix.com>
> It's better to add the link to the thread that has the suggestion.
>
Yes, suggested-by tags are not especially useful, IMHO. I'm fine with
you using it, but as Meng says, a link would be more helpful. If you
send a series, which will have a cover letter, put the link(s) in the
cover letter rather than in the changelog, as that's an important
information when reviewing, much less when looking at git-log in 5
years time. :-)
> > @@ -930,7 +936,7 @@ burn_budget(const struct scheduler *ops, struct
> > rt_vcpu *svc, s_time_t now)
> > if ( svc->cur_budget <= 0 )
> > {
> > svc->cur_budget = 0;
> > - set_bit(__RTDS_depleted, &svc->flags);
> > + __set_bit(__RTDS_depleted, &svc->flags);
> > }
> >
> > /* TRACE */
> > @@ -955,7 +961,7 @@ burn_budget(const struct scheduler *ops, struct
> > rt_vcpu *svc, s_time_t now)
> > * lock is grabbed before calling this function
> The comment says "lock is grabbed before calling this function".
> IIRC, we use __ to represent that we grab the lock before call this
> function.
> Then this change violates the convention.
>
Yeah, but it was a bad convention, IMO, at least for sched_*.c files.
In fact, it is debatable whether one or two underscore is what should
really be used.
Also, that's not the only convention that lead to the introduction of
this king of prefix (for example, I've seen many times '__' used for
indicating some sort of 'raw' part of the operation... there are
examples of this in Xen too)... Which means one never knows which one
is the valid convention at some point, about '__'! :-O
But even if we leave this aside, and consider at the '__'==>locked
rule, well, pretty much all functions in sched_rt.c are called with the
proper locks held already. Basically, since in many occasione, the lock
has been taken in schedule.c before calling the hook, all the functions
eve called by an hook --end maybe even the hook itself-- should have
the '__' prefix, which defeats the purpose of the convention itself!
So, on this, I agree with Tianyang, and I think removing the '__' is a
good thing for this source file.
If there are places where we want to particularly stress the fact that
locks should have be taken already, then either add a comment or a
'_locked' suffix to the function name. But that should be the exception
rather than the rule and, out of the top of my head, I don't recall any
cases in sched_rt.c where that would be tremendously helpful...
Thanks and Regards,
Dario
--
<<This happens because I choose it to happen!>> (Raistlin Majere)
-----------------------------------------------------------------
Dario Faggioli, Ph.D, http://about.me/dario.faggioli
Senior Software Engineer, Citrix Systems R&D Ltd., Cambridge (UK)
[-- Attachment #1.2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 819 bytes --]
[-- Attachment #2: Type: text/plain, Size: 126 bytes --]
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel
prev parent reply other threads:[~2016-05-13 7:42 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-05-11 15:20 [PATCH] xen: sched: rtds: refactor code Tianyang Chen
2016-05-13 3:34 ` Meng Xu
2016-05-13 7:41 ` Dario Faggioli [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1463125301.18789.21.camel@citrix.com \
--to=dario.faggioli@citrix.com \
--cc=george.dunlap@citrix.com \
--cc=mengxu@cis.upenn.edu \
--cc=tiche@seas.upenn.edu \
--cc=xen-devel@lists.xenproject.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).