From: Peter Zijlstra <peterz@infradead.org>
To: Oleg Nesterov <oleg@redhat.com>
Cc: linux-tip-commits@vger.kernel.org, dave@stgolabs.net,
hpa@zytor.com, sasha.levin@oracle.com, tglx@linutronix.de,
linux-kernel@vger.kernel.org, jason.low2@hp.com,
walken@google.com, akpm@linux-foundation.org, mingo@kernel.org,
paulmck@linux.vnet.ibm.com, davej@codemonkey.org.uk,
ming.lei@canonical.com, torvalds@linux-foundation.org,
tim.c.chen@linux.intel.com
Subject: Re: [tip:locking/core] locking/rwsem: Fix lock optimistic spinning when owner is not running
Date: Tue, 10 Mar 2015 11:59:39 +0100 [thread overview]
Message-ID: <20150310105939.GV2896@worktop.programming.kicks-ass.net> (raw)
In-Reply-To: <20150307171347.GA30365@redhat.com>
On Sat, Mar 07, 2015 at 06:13:47PM +0100, Oleg Nesterov wrote:
> I think the patch is fine, but this reminds me...
>
> On 03/07, tip-bot for Jason Low wrote:
> >
> > bool rwsem_spin_on_owner(struct rw_semaphore *sem, struct task_struct *owner)
> > {
> > long count;
> >
> > rcu_read_lock();
> > - while (owner_running(sem, owner)) {
> > - /* abort spinning when need_resched */
> > - if (need_resched()) {
> > + while (sem->owner == owner) {
> > + /*
> > + * Ensure we emit the owner->on_cpu, dereference _after_
> > + * checking sem->owner still matches owner, if that fails,
> > + * owner might point to free()d memory, if it still matches,
> > + * the rcu_read_lock() ensures the memory stays valid.
> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>
> Yes, this is another case when we wrongly assume this.
>
> Peter, should I resend
>
> [PATCH 3/3] introduce task_rcu_dereference()
> http://marc.info/?l=linux-kernel&m=141443631413914
>
> ? or should we add another call_rcu() in finish_task_switch() (like -rt does)
> to make this true?
Yeah, I think the extra call_rcu() makes most sense.
next prev parent reply other threads:[~2015-03-10 11:00 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-03-07 7:45 [PATCH] locking/rwsem: Fix lock optimistic spinning when owner is not running Jason Low
2015-03-07 9:21 ` Peter Zijlstra
2015-03-09 17:42 ` Jason Low
2015-03-07 16:43 ` [tip:locking/core] " tip-bot for Jason Low
2015-03-07 17:13 ` Oleg Nesterov
2015-03-10 10:59 ` Peter Zijlstra [this message]
2015-03-10 16:04 ` Linus Torvalds
2015-03-10 16:16 ` Peter Zijlstra
2015-03-10 17:28 ` Oleg Nesterov
2015-03-10 17:45 ` Linus Torvalds
2015-03-10 18:33 ` Oleg Nesterov
2015-03-07 18:17 ` [PATCH] " Sasha Levin
2015-03-09 17:37 ` Jason Low
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=20150310105939.GV2896@worktop.programming.kicks-ass.net \
--to=peterz@infradead.org \
--cc=akpm@linux-foundation.org \
--cc=dave@stgolabs.net \
--cc=davej@codemonkey.org.uk \
--cc=hpa@zytor.com \
--cc=jason.low2@hp.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-tip-commits@vger.kernel.org \
--cc=ming.lei@canonical.com \
--cc=mingo@kernel.org \
--cc=oleg@redhat.com \
--cc=paulmck@linux.vnet.ibm.com \
--cc=sasha.levin@oracle.com \
--cc=tglx@linutronix.de \
--cc=tim.c.chen@linux.intel.com \
--cc=torvalds@linux-foundation.org \
--cc=walken@google.com \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox