From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S965886AbcIVVdz (ORCPT ); Thu, 22 Sep 2016 17:33:55 -0400 Received: from Galois.linutronix.de ([146.0.238.70]:39461 "EHLO Galois.linutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S964986AbcIVVdw (ORCPT ); Thu, 22 Sep 2016 17:33:52 -0400 Date: Thu, 22 Sep 2016 23:31:19 +0200 (CEST) From: Thomas Gleixner To: Waiman Long cc: Ingo Molnar , Peter Zijlstra , Jonathan Corbet , linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org, Davidlohr Bueso , Jason Low , Scott J Norton , Douglas Hatch Subject: Re: [RFC PATCH v2 1/5] futex: Add futex_set_timer() helper function In-Reply-To: <1474378963-15496-2-git-send-email-Waiman.Long@hpe.com> Message-ID: References: <1474378963-15496-1-git-send-email-Waiman.Long@hpe.com> <1474378963-15496-2-git-send-email-Waiman.Long@hpe.com> User-Agent: Alpine 2.20 (DEB 67 2015-01-07) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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