[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <4878ccfd-7a4e-4f84-9bc3-1d477e077587@linux.alibaba.com>
Date: Mon, 4 Nov 2019 19:41:20 +0800
From: Lai Jiangshan <laijs@...ux.alibaba.com>
To: Sebastian Andrzej Siewior <bigeasy@...utronix.de>
Cc: linux-kernel@...r.kernel.org,
Peter Zijlstra <peterz@...radead.org>,
Thomas Gleixner <tglx@...utronix.de>,
Ingo Molnar <mingo@...hat.com>, Borislav Petkov <bp@...en8.de>,
"H. Peter Anvin" <hpa@...or.com>, x86@...nel.org,
"Paul E. McKenney" <paulmck@...nel.org>,
Josh Triplett <josh@...htriplett.org>,
Steven Rostedt <rostedt@...dmis.org>,
Mathieu Desnoyers <mathieu.desnoyers@...icios.com>,
Lai Jiangshan <jiangshanlai@...il.com>,
Joel Fernandes <joel@...lfernandes.org>,
Andi Kleen <ak@...ux.intel.com>,
Andy Lutomirski <luto@...nel.org>,
Fenghua Yu <fenghua.yu@...el.com>,
Kees Cook <keescook@...omium.org>,
"Rafael J. Wysocki" <rafael.j.wysocki@...el.com>,
Dave Hansen <dave.hansen@...el.com>,
Babu Moger <Babu.Moger@....com>,
Rik van Riel <riel@...riel.com>,
"Chang S. Bae" <chang.seok.bae@...el.com>,
Jann Horn <jannh@...gle.com>,
David Windsor <dwindsor@...il.com>,
Elena Reshetova <elena.reshetova@...el.com>,
Yuyang Du <duyuyang@...il.com>,
Anshuman Khandual <anshuman.khandual@....com>,
Richard Guy Briggs <rgb@...hat.com>,
Andrew Morton <akpm@...ux-foundation.org>,
Christian Brauner <christian.brauner@...ntu.com>,
Michal Hocko <mhocko@...e.com>,
Andrea Arcangeli <aarcange@...hat.com>,
Al Viro <viro@...iv.linux.org.uk>,
"Dmitry V. Levin" <ldv@...linux.org>, rcu@...r.kernel.org
Subject: Re: [PATCH V2 7/7] x86,rcu: use percpu rcu_preempt_depth
On 2019/11/4 5:25 下午, Sebastian Andrzej Siewior wrote:
> On 2019-11-02 12:45:59 [+0000], Lai Jiangshan wrote:
>> Convert x86 to use a per-cpu rcu_preempt_depth. The reason for doing so
>> is that accessing per-cpu variables is a lot cheaper than accessing
>> task_struct or thread_info variables.
>
> Is there a benchmark saying how much we gain from this?
Hello
Maybe I can write a tight loop for testing, but I don't
think anyone will be interesting in it.
I'm also trying to find some good real tests. I need
some suggestions here.
>
>> We need to save/restore the actual rcu_preempt_depth when switch.
>> We also place the per-cpu rcu_preempt_depth close to __preempt_count
>> and current_task variable.
>>
>> Using the idea of per-cpu __preempt_count.
>>
>> No function call when using rcu_read_[un]lock().
>> Single instruction for rcu_read_lock().
>> 2 instructions for fast path of rcu_read_unlock().
>
> I think these were not inlined due to the header requirements.
objdump -D -S kernel/workqueue.o shows (selected fractions):
raw_cpu_add_4(__rcu_preempt_depth, 1);
d8f: 65 ff 05 00 00 00 00 incl %gs:0x0(%rip) #
d96 <work_busy+0x16>
......
return GEN_UNARY_RMWcc("decl", __rcu_preempt_depth, e,
__percpu_arg([var]));
dd8: 65 ff 0d 00 00 00 00 decl %gs:0x0(%rip) #
ddf <work_busy+0x5f>
if (unlikely(rcu_preempt_depth_dec_and_test()))
ddf: 74 26 je e07 <work_busy+0x87>
......
rcu_read_unlock_special();
e07: e8 00 00 00 00 callq e0c <work_busy+0x8c>
>
> Boris pointed one thing, there is also DEFINE_PERCPU_RCU_PREEMP_DEPTH.
>
Thanks for pointing out.
Best regards
Lai
Powered by blists - more mailing lists