From: Oleg Nesterov <oleg@redhat.com>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: Andi Kleen <andi@firstfloor.org>,
hch@infradead.org, corbet@lwn.net, linux-kernel@vger.kernel.org,
viro@ZenIV.linux.org.uk, linux-api@vger.kernel.org,
alan@lxorguk.ukuu.org.uk
Subject: Re: [PATCH, RFC] Remove fasync() BKL usage, take 3325
Date: Wed, 28 Jan 2009 04:14:39 +0100 [thread overview]
Message-ID: <20090128031439.GA11025@redhat.com> (raw)
In-Reply-To: <20090127165504.53ed7a2d.akpm@linux-foundation.org>
On 01/27, Andrew Morton wrote:
>
> On Fri, 23 Jan 2009 05:56:46 +0100
> Andi Kleen <andi@firstfloor.org> wrote:
>
> > On Thu, Jan 22, 2009 at 03:32:49PM -0500, Christoph Hellwig wrote:
> > > On Thu, Jan 22, 2009 at 06:51:04AM -0800, Andrew Morton wrote:
> > > > OK, replacing a lock_kernel() with a spin_lock(&global_lock) is pretty
> > > > straightforwad. But it's really really sad. It basically leaves a great
> > > > big FIXME in there. It'd be better to fix it.
> > >
> > >
> > > Umm, we've been discussiong this in and out a guestimated million times.
> > >
> > > Let's go forward with Jon's patch which is on obvious improvement and
> > > if it shows problems later on we can revisit it.
> >
> > The point was that we already have a better patch from Oleg.
> >
>
> Where is this patch?
I didn't send the actual patch. The idea is,
can't we use O_LOCK_FLAGS bit? I agree, it is a bit ugly,
and I won't insist if you don't like is.
static inline int try_lock_f_flags(struct file *file)
{
return !test_and_set_bit(O_LOCK_FLAGS, file->f_flags);
}
static inline set_f_flags(struct file *file, unsigned int flags)
{
file->f_flags = flags & ~O_LOCK_FLAGS;
}
Now, nobody should change ->f_flags directly (except create/open
pathes. For example, ioctl_fionbio() should be changed:
if (try_lock_f_flags(filp)) {
if (on)
set_f_flags(filp, filp->f_flags | flag);
else
set_f_flags(filp, filp->f_flags & ~flag);
}
If try_lock_f_flags() fails we do nothing, as if the current owner of
O_LOCK_FLAGS changes ->f_flags after us.
and, from another message,
No need to disable preemption, we never spin waiting for the
lock bit. If it is locked - somebody else updates ->f_flags,
we can pretend it does this after us. This can confuse F_GETFL
after F_SETFL (if F_SETFL "fails"), but I think in that case
user-space is wrong anyway, it must not do F_GETFL in parallel.
I'll try to make the patch tomorrow, but the problem is that I am not
sure this is not too ugly. At least Jonathan dislikes this approach,
and I do understand him ;)
Oleg.
next prev parent reply other threads:[~2009-01-28 3:17 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-01-15 22:32 [PATCH, RFC] Remove fasync() BKL usage, take 3325 Jonathan Corbet
2009-01-22 14:51 ` Andrew Morton
2009-01-22 16:09 ` Andi Kleen
2009-01-23 5:21 ` Jonathan Corbet
2009-01-22 20:32 ` Christoph Hellwig
2009-01-23 4:56 ` Andi Kleen
2009-01-28 0:53 ` Andrew Morton
2009-01-28 0:55 ` Andrew Morton
2009-01-28 3:14 ` Oleg Nesterov [this message]
2009-01-28 3:57 ` Jonathan Corbet
2009-01-28 4:23 ` Oleg Nesterov
2009-01-28 14:13 ` Jonathan Corbet
2009-01-28 17:36 ` Christoph Hellwig
2009-01-28 17:44 ` Jonathan Corbet
2009-01-28 17:55 ` Christoph Hellwig
2009-01-28 18:13 ` Matt Mackall
2009-01-28 21:05 ` Jonathan Corbet
2009-01-28 18:14 ` David Daney
2009-01-29 14:37 ` Andi Kleen
2009-01-23 5:15 ` Jonathan Corbet
2009-01-23 5:31 ` Andrew Morton
2009-01-23 5:45 ` Matt Mackall
2009-01-23 6:15 ` Andi Kleen
2009-01-23 10:45 ` Bernd Petrovitsch
2009-01-23 5:54 ` Andi Kleen
2009-01-23 6:01 ` Jonathan Corbet
2009-01-23 6:57 ` Andrew Morton
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=20090128031439.GA11025@redhat.com \
--to=oleg@redhat.com \
--cc=akpm@linux-foundation.org \
--cc=alan@lxorguk.ukuu.org.uk \
--cc=andi@firstfloor.org \
--cc=corbet@lwn.net \
--cc=hch@infradead.org \
--cc=linux-api@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=viro@ZenIV.linux.org.uk \
/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