From: Oleg Nesterov <oleg@tv-sign.ru>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>,
Ingo Molnar <mingo@elte.hu>,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] fix theoretical ccids_{read,write}_lock() race
Date: Sun, 22 Jul 2007 00:06:27 +0400 [thread overview]
Message-ID: <20070721200627.GA107@tv-sign.ru> (raw)
In-Reply-To: <20070721122149.62c73ba5.akpm@linux-foundation.org>
On 07/21, Andrew Morton wrote:
>
> On Sat, 21 Jul 2007 23:11:04 +0400 Oleg Nesterov <oleg@tv-sign.ru> wrote:
>
> > On 07/21, Andrew Morton wrote:
> > >
> > > On Sat, 21 Jul 2007 19:02:06 +0400 Oleg Nesterov <oleg@tv-sign.ru> wrote:
> > >
> > > > Make sure that spin_unlock_wait() is properly ordered wrt atomic_inc().
> > > >
> > > > Signed-off-by: Oleg Nesterov <oleg@tv-sign.ru>
> > > >
> > > > --- t/net/dccp/ccid.c~ccid 2006-12-18 18:17:31.000000000 +0300
> > > > +++ t/net/dccp/ccid.c 2007-07-21 18:29:21.000000000 +0400
> > > > @@ -40,6 +40,7 @@ static inline void ccids_write_unlock(vo
> > > > static inline void ccids_read_lock(void)
> > > > {
> > > > atomic_inc(&ccids_lockct);
> > > > + smp_mb__after_atomic_inc();
> > > > spin_unlock_wait(&ccids_lock);
> > > > }
> > > >
> > >
> > > Why not just use standard rwlocks in there?
> > >
> > > (This is probably an FAQ, but it should be).
> >
> > Perhaps because read_lock() doesn't allow to sleep?
> >
>
> down_read() does.
>
> afaict the code doesn't sleep while holding that lock anwyay.
Ah yes, it doesn't call kmem_cache_alloc() under ccids_read_lock().
So, really, why not read_lock/write_lock ?
Oleg.
next prev parent reply other threads:[~2007-07-21 20:06 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-07-21 11:57 [PATCH] pi-futex: set PF_EXITING without taking ->pi_lock Oleg Nesterov
2007-07-21 12:31 ` Ingo Molnar
2007-07-21 14:18 ` Oleg Nesterov
2007-07-21 15:02 ` [PATCH] fix theoretical ccids_{read,write}_lock() race Oleg Nesterov
2007-07-21 19:02 ` Andrew Morton
2007-07-21 19:11 ` Oleg Nesterov
2007-07-21 19:21 ` Andrew Morton
2007-07-21 20:06 ` Oleg Nesterov [this message]
2007-07-21 15:05 ` [PATCH] pi-futex: set PF_EXITING without taking ->pi_lock Ingo Molnar
2007-07-21 16:39 ` Oleg Nesterov
2007-08-06 7:30 ` Ingo Molnar
2007-07-22 0:31 ` Paul Mackerras
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=20070721200627.GA107@tv-sign.ru \
--to=oleg@tv-sign.ru \
--cc=acme@redhat.com \
--cc=akpm@linux-foundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
/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