On 09/22/2016 05:31 PM, Thomas Gleixner wrote:
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)
+ *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 for the suggestions. I will fix this patch in the next revision.