All of lore.kernel.org
 help / color / mirror / Atom feed
From: Satendra Singh Thakur <sst2005@gmail.com>
To: unlisted-recipients:; (no To-header on input)
Cc: satendrasingh.thakur@hcl.com,
	Satendra Singh Thakur <sst2005@gmail.com>,
	Peter Zijlstra <peterz@infradead.org>,
	Ingo Molnar <mingo@redhat.com>, Will Deacon <will@kernel.org>,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH v1] [semaphore] Removed redundant code from semaphore's down family of function
Date: Sat, 24 Aug 2019 09:20:59 +0530	[thread overview]
Message-ID: <20190824035100.7969-1-sst2005@gmail.com> (raw)
In-Reply-To: <20190822155112.GU2369@hirez.programming.kicks-ass.net>

On Thu, 22 Aug 2019 17:51:12 +0200, Peter Zijlstra wrote:
> On Mon, Aug 12, 2019 at 07:18:59PM +0530, Satendra Singh Thakur wrote:
> > -The semaphore code has four funcs
> > down,
> > down_interruptible,
> > down_killable,
> > down_timeout
> > -These four funcs have almost similar code except that
> > they all call lower level function __down_xyz.
> > -This lower level func in-turn call inline func
> > __down_common with appropriate arguments.
> > -This patch creates a common macro for above family of funcs
> > so that duplicate code is eliminated.
> > -Also, __down_common has been made noinline so that code is
> > functionally similar to previous one
> > -For example, earlier down_killable would call __down_killable
> > , which in-turn would call inline func __down_common
> > Now, down_killable calls noinline __down_common directly
> > through a macro
> > -The funcs __down_interruptible, __down_killable etc have been
> > removed as they were just wrapper to __down_common
>
> The above is unreadable and seems to lack a reason for this change.
Hi Mr Peter,
Thanks for the comments.
I will try to explain it further:

The semaphore has four functions named down*.
The call flow of the functions is

down* ----> __down* ----> inline __down_common

The code of down* and __down* is redundant/duplicate except that
the __down_common is called with different arguments from __down*
functions.

This patch defines a macro down_common which contain this common
code of all down* functions.

new call flow is

down* ----> noinline __down_common (through a macro down_common).

> AFAICT from the actual patch, you're destroying the explicit
> instantiation of the __down*() functions
> through constant propagation into __down_common().
Intead of instantiation of __down* functions, we are instaintiating
__down_common, is it a problem ?

Thanks
Satendra

  reply	other threads:[~2019-08-24  3:52 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-08-12  5:31 [PATCH] [semaphore] Removed redundant code from semaphore's down family of function Satendra Singh Thakur
2019-08-12  9:12 ` Will Deacon
2019-08-12 13:48 ` [PATCH v1] " Satendra Singh Thakur
2019-08-22 15:51   ` Peter Zijlstra
2019-08-24  3:50     ` Satendra Singh Thakur [this message]
2019-08-26 14:14       ` Peter Zijlstra
2019-08-26 14:25         ` Peter Zijlstra
2019-08-27  0:06           ` sched,time: Allow better constprop/DCE for schedule_timeout() kbuild test robot
2019-08-27  1:26           ` kbuild test robot
2019-08-30 10:40           ` [PATCH v1] [semaphore] Removed redundant code from semaphore's down family of function Satendra Singh Thakur
2019-08-30 10:46             ` Peter Zijlstra

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=20190824035100.7969-1-sst2005@gmail.com \
    --to=sst2005@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=peterz@infradead.org \
    --cc=satendrasingh.thakur@hcl.com \
    --cc=will@kernel.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.