Re: [PATCH v1] [semaphore] Removed redundant code from semaphore's down family of function

From: Peter Zijlstra
Date: Thu Aug 22 2019 - 11:51:23 EST


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.

AFAICT from the actual patch, you're destroying the explicit
instantiation of the __down*() functions through constant propagation
into __down_common().