[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <alpine.DEB.2.20.1609222317040.5640@nanos>
Date: Thu, 22 Sep 2016 23:31:19 +0200 (CEST)
From: Thomas Gleixner <tglx@...utronix.de>
To: Waiman Long <Waiman.Long@....com>
cc: Ingo Molnar <mingo@...nel.org>,
Peter Zijlstra <peterz@...radead.org>,
Jonathan Corbet <corbet@....net>, linux-kernel@...r.kernel.org,
linux-doc@...r.kernel.org, Davidlohr Bueso <dave@...olabs.net>,
Jason Low <jason.low2@....com>,
Scott J Norton <scott.norton@....com>,
Douglas Hatch <doug.hatch@....com>
Subject: Re: [RFC PATCH v2 1/5] futex: Add futex_set_timer() helper
function
On Tue, 20 Sep 2016, Waiman Long wrote:
Please be more careful of your subject lines. First thing I thought was
that you add a helper which is used in later patches to find out that you
actualy consolidate duplicated code. Something like:
futex: Consolidate duplicated timer setup code
would have told me right away what this is about.
> This patch adds a new futex_set_timer() function to consolidate all
Please do not use: "This patch ...". We already know that this is a patch,
otherwise it would not be tagged [PATCH n/m] in the subject line.
See Documentation/SubmittingPatches ....
> the sleeping hrtime setup code.
Let me give you a hint:
1: The code has three identical code copies to set up the futex timeout.
2: Add a helper function and consolidate the call sites.
#1 tells precisely what the problem is
#2 tells precisely how it is solved
Can you see the difference?
> +/*
> + * Helper function to set the sleeping hrtimer.
> + */
> +static inline void futex_set_timer(ktime_t *time, struct hrtimer_sleeper **pto,
> + struct hrtimer_sleeper *timeout, int flags, u64 range_ns)
Please use futex_setup_timer() as the function name. I was confused when I
read the other patch that you wanted to "set" the timer before entering
into the place which would actually need it.
> +{
> + if (!time)
> + return;
> + *pto = timeout;
Please don't do that. That's a horrible coding style.
What's wrong with returning NULL or the timeout pointer and assign it to
"to" at the call site?
Thanks,
tglx
Powered by blists - more mailing lists