From: Lai Jiangshan <laijs@cn.fujitsu.com>
To: paulmck@linux.vnet.ibm.com
Cc: linux-kernel@vger.kernel.org, mingo@elte.hu, dipankar@in.ibm.com,
akpm@linux-foundation.org, mathieu.desnoyers@efficios.com,
josh@joshtriplett.org, niv@us.ibm.com, tglx@linutronix.de,
peterz@infradead.org, rostedt@goodmis.org,
Valdis.Kletnieks@vt.edu, dhowells@redhat.com,
eric.dumazet@gmail.com, darren@dvhart.com, fweisbec@gmail.com,
patches@linaro.org, torvalds@linux-foundation.org
Subject: Re: [PATCH RFC] rcu: Make __rcu_read_lock() inlinable
Date: Tue, 27 Mar 2012 16:06:08 +0800 [thread overview]
Message-ID: <4F7174F0.1080504@cn.fujitsu.com> (raw)
In-Reply-To: <20120325205249.GA29528@linux.vnet.ibm.com>
On 03/26/2012 04:52 AM, Paul E. McKenney wrote:
> +void rcu_switch_from(void)
> {
> - current->rcu_read_lock_nesting++;
> - barrier(); /* needed if we ever invoke rcu_read_lock in rcutree.c */
> + current->rcu_read_lock_nesting_save =
> + __this_cpu_read(rcu_read_lock_nesting);
> + barrier();
> + __this_cpu_write(rcu_read_lock_nesting, 0);
- __this_cpu_write(rcu_read_lock_nesting, 0);
+ __this_cpu_write(rcu_read_lock_nesting, 1);
if prev or next task has non-zero rcu_read_unlock_special,
"__this_cpu_write(rcu_read_lock_nesting, 1)" will prevent wrong qs reporting
when rcu_read_unlock() is called in any interrupt/tracing while doing switch_to().
> +}
> +
> +/*
> + * Restore the incoming task's value for rcu_read_lock_nesting at the
> + * end of a context switch.
> + */
> +void rcu_switch_to(void)
> +{
> + __this_cpu_write(rcu_read_lock_nesting,
> + current->rcu_read_lock_nesting_save);
> + barrier();
> + current->rcu_read_lock_nesting_save = 0;
> }
- barrier();
- current->rcu_read_lock_nesting_save = 0;
rcu_read_lock_nesting_save is set but not used before next set here, just remove it.
I don't like it hooks too much into scheduler.
Approaches:
0) stay using function call
1) hook into kbuild(https://lkml.org/lkml/2011/3/27/170,https://lkml.org/lkml/2011/3/27/171)
2) hook into scheduler(still need more works for rcu_read_unlock())
3) Add rcu_read_lock_nesting to thread_info like preempt_count
4) resolve header-file dependence
For me
3=4>1>2>0
Thanks,
Lai
next prev parent reply other threads:[~2012-03-27 8:00 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-03-25 20:52 [PATCH RFC] rcu: Make __rcu_read_lock() inlinable Paul E. McKenney
2012-03-26 7:54 ` Peter Zijlstra
2012-03-26 18:32 ` Paul E. McKenney
2012-03-26 18:47 ` Peter Zijlstra
2012-03-27 5:15 ` Paul E. McKenney
2012-03-27 12:26 ` Steven Rostedt
2012-03-27 16:39 ` Paul E. McKenney
2012-03-26 18:53 ` Steven Rostedt
2012-03-26 23:43 ` Paul E. McKenney
2012-03-27 8:06 ` Lai Jiangshan [this message]
2012-03-27 16:46 ` Paul E. McKenney
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=4F7174F0.1080504@cn.fujitsu.com \
--to=laijs@cn.fujitsu.com \
--cc=Valdis.Kletnieks@vt.edu \
--cc=akpm@linux-foundation.org \
--cc=darren@dvhart.com \
--cc=dhowells@redhat.com \
--cc=dipankar@in.ibm.com \
--cc=eric.dumazet@gmail.com \
--cc=fweisbec@gmail.com \
--cc=josh@joshtriplett.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mathieu.desnoyers@efficios.com \
--cc=mingo@elte.hu \
--cc=niv@us.ibm.com \
--cc=patches@linaro.org \
--cc=paulmck@linux.vnet.ibm.com \
--cc=peterz@infradead.org \
--cc=rostedt@goodmis.org \
--cc=tglx@linutronix.de \
--cc=torvalds@linux-foundation.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.