linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] kernel/futex: Change pi_state_update_owner() to an inline function
@ 2021-03-09  2:40 Xiangyang Yu
  2021-03-11 16:06 ` Thomas Gleixner
  0 siblings, 1 reply; 2+ messages in thread
From: Xiangyang Yu @ 2021-03-09  2:40 UTC (permalink / raw)
  To: tglx, mingo, peterz, dvhart; +Cc: linux-kernel, yuxiangyang4

In our performance tests, we find that the performance of
sysbench is descend. Function call consumes too many instructions,
change pi_state_update_owner() to an inline function.

Test environment:
CPU: Intel(R) Xeon(R) Gold 6154 CPU @ 3.00GHz * 2
MEM: 312G

Test case: https://github.com/akopytov/sysbench
Test cmd: ./sysbench --test=threads --num-threads=$thr
              --thread-yields=100 --thread-locks=2 run

$thr    stock   non-inline   inline
256    0.8511     0.9254     0.8588
512    0.8489     0.9232     0.8503
1024   0.8347     0.9248     0.8495
2048   0.8338     0.9575     0.8402

Signed-off-by: Xiangyang Yu <yuxiangyang4@huawei.com>
---
 kernel/futex.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/kernel/futex.c b/kernel/futex.c
index e68db7745039..570dee4e9e6f 100644
--- a/kernel/futex.c
+++ b/kernel/futex.c
@@ -763,7 +763,7 @@ static struct futex_pi_state *alloc_pi_state(void)
 	return pi_state;
 }
 
-static void pi_state_update_owner(struct futex_pi_state *pi_state,
+static inline void pi_state_update_owner(struct futex_pi_state *pi_state,
 				  struct task_struct *new_owner)
 {
 	struct task_struct *old_owner = pi_state->owner;
-- 
2.23.0


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] kernel/futex: Change pi_state_update_owner() to an inline function
  2021-03-09  2:40 [PATCH] kernel/futex: Change pi_state_update_owner() to an inline function Xiangyang Yu
@ 2021-03-11 16:06 ` Thomas Gleixner
  0 siblings, 0 replies; 2+ messages in thread
From: Thomas Gleixner @ 2021-03-11 16:06 UTC (permalink / raw)
  To: Xiangyang Yu, mingo, peterz, dvhart; +Cc: linux-kernel, yuxiangyang4

On Tue, Mar 09 2021 at 10:40, Xiangyang Yu wrote:
> In our performance tests, we find that the performance of
> sysbench is descend. Function call consumes too many instructions,
> change pi_state_update_owner() to an inline function.

Serioulsy? sysbench does not use PI futexes which means that it does not
ever invoke this function. So it's completely irrelevant for that test
whether the function is marked inline or not.

Aside of that the compiler can ignore 'inline' or inline a static
function. But even if there would be an extra call, then

> Test case: https://github.com/akopytov/sysbench
> Test cmd: ./sysbench --test=threads --num-threads=$thr
>               --thread-yields=100 --thread-locks=2 run
>
> $thr    stock   non-inline   inline
> 256    0.8511     0.9254     0.8588
> 512    0.8489     0.9232     0.8503
> 1024   0.8347     0.9248     0.8495
> 2048   0.8338     0.9575     0.8402

a performance change of this magnitude is certainly not the result. I
also have no idea what these numbers actually mean. Nothing in a
sysbench output with the same parameters looks even close.

But whatever the above is, the 'inline' is neither the cause nor the
cure.

Thanks,

        tglx

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-03-11 16:07 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-09  2:40 [PATCH] kernel/futex: Change pi_state_update_owner() to an inline function Xiangyang Yu
2021-03-11 16:06 ` Thomas Gleixner

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).