All of lore.kernel.org
 help / color / mirror / Atom feed
From: Hugh Dickins <hughd@google.com>
To: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Dave Kleikamp <dave.kleikamp@oracle.com>,
	"Rafael J. Wysocki" <rjw@sisk.pl>,
	Dave Kleikamp <shaggy@kernel.org>,
	jfs-discussion@lists.sourceforge.net,
	Kernel Testers List <kernel-testers@vger.kernel.org>,
	LKML <linux-kernel@vger.kernel.org>,
	Maciej Rutecki <maciej.rutecki@gmail.com>,
	Andrew Morton <akpm@linux-foundation.org>,
	Florian Mickler <florian@mickler.org>,
	davem@davemloft.net, Al Viro <viro@zeniv.linux.org.uk>,
	linux-mm@kvack.org
Subject: Re: [Resend] 3.2-rc6+: Reported regressions from 3.0 and 3.1
Date: Tue, 20 Dec 2011 22:15:00 -0800 (PST)	[thread overview]
Message-ID: <alpine.LSU.2.00.1112202213310.3987@eggly.anvils> (raw)
In-Reply-To: <CA+55aFx=B9adsTR=-uYpmfJnQgdGN+1aL0KUabH5bSY6YcwO7Q@mail.gmail.com>

[-- Attachment #1: Type: TEXT/PLAIN, Size: 2927 bytes --]

On Tue, 20 Dec 2011, Linus Torvalds wrote:
> On Tue, Dec 20, 2011 at 8:23 PM, Dave Kleikamp <dave.kleikamp@oracle.com> wrote:
> >
> > I don't think this is a regression.  It's been seen before, but the
> > patch never got submitted, or was lost somewhere. I believe this
> > will fix it.
> 
> Hmm. This patch looks obviously correct. But it looks *so* obviously
> correct that it just makes me suspicious - this is not new or seldom
> used code, it's been this way for ages and used all the time. That
> line literally goes back to 2007, commit eb2be189317d0. And it looks
> like even before that we had a GFP_KERNEL for the add_to_page_cache()
> case and that goes back to before the git history. So this is
> *ancient*.
> 
> Maybe almost nobody uses __read_cache_page() with a non-GFP_KERNEL gfp
> and as a result we've not noticed.
> 
> Or maybe there is some crazy reason why it calls "add_to_page_cache()"
> with GFP_KERNEL.
> 
> Adding the usual suspects for mm/filemap.c to the cc line (Andrew is
> already cc'd, but Al and Hugh should comment).
> 
> Ack's, people? Is it really as obvious as it looks, and we've just had
> this bug forever?

Certainly

Acked-by: Hugh Dickins <hughd@google.com>

from me (and add_to_page_cache_locked does the masking of inappropriate
bits when passing on down, so no need to worry about that aspect).

I agree that it's odd that we've never noticed it before, but I don't
think the GFP_KERNEL there has any more significance than oversight.
Nick cleaned up some similar instances in filemap.c a few years back,
I guess ones he hit in testing, but this just got left over.

page_cache_read()'s GFP_KERNEL looks similarly worrying, but as it's
only called by filemap_fault(), I suppose it's actually okay.

Ooh, maybe you should also update that comment on GFP_KERNEL above
read_cache_page_gfp()...

Hugh

> 
>             Linus
> 
> --- snip snip ---
> > vfs: __read_cache_page should use gfp argument rather than GFP_KERNEL
> >
> > lockdep reports a deadlock in jfs because a special inode's rw semaphore
> > is taken recursively. The mapping's gfp mask is GFP_NOFS, but is not used
> > when __read_cache_page() calls add_to_page_cache_lru().
> >
> > Signed-off-by: Dave Kleikamp <dave.kleikamp@oracle.com>
> >
> > diff --git a/mm/filemap.c b/mm/filemap.c
> > index c106d3b..c9ea3df 100644
> > --- a/mm/filemap.c
> > +++ b/mm/filemap.c
> > @@ -1828,7 +1828,7 @@ repeat:
> >                page = __page_cache_alloc(gfp | __GFP_COLD);
> >                if (!page)
> >                        return ERR_PTR(-ENOMEM);
> > -               err = add_to_page_cache_lru(page, mapping, index, GFP_KERNEL);
> > +               err = add_to_page_cache_lru(page, mapping, index, gfp);
> >                if (unlikely(err)) {
> >                        page_cache_release(page);
> >                        if (err == -EEXIST)

  reply	other threads:[~2011-12-21  6:15 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-12-20 23:54 [Resend] 3.2-rc6+: Reported regressions from 3.0 and 3.1 Rafael J. Wysocki
2011-12-20 23:54 ` Rafael J. Wysocki
2011-12-21  2:31 ` Linus Torvalds
2011-12-21  2:31   ` Linus Torvalds
2011-12-21  4:23   ` Dave Kleikamp
2011-12-21  4:23     ` Dave Kleikamp
2011-12-21  4:44     ` Linus Torvalds
2011-12-21  4:44       ` Linus Torvalds
2011-12-21  4:44       ` Linus Torvalds
2011-12-21  6:15       ` Hugh Dickins [this message]
2011-12-21  7:10         ` Al Viro
2011-12-21  7:10           ` Al Viro
2011-12-21  7:10           ` Al Viro
2011-12-21 17:05         ` [PATCH v2] vfs: __read_cache_page should use gfp argument rather than GFP_KERNEL Dave Kleikamp
2011-12-21 17:05           ` Dave Kleikamp
2011-12-21 20:28           ` Andrew Morton
2011-12-21 20:28             ` Andrew Morton
2011-12-21 20:28             ` Andrew Morton
2011-12-21 20:53             ` Dave Kleikamp
2011-12-21 20:53               ` Dave Kleikamp
2011-12-21  4:50   ` [Resend] 3.2-rc6+: Reported regressions from 3.0 and 3.1 David Miller
2011-12-21  4:50     ` David Miller
2011-12-21 16:32 ` Nick Bowler
2011-12-21 16:32   ` Nick Bowler
2011-12-21 17:51   ` Keith Packard
2011-12-21 17:51     ` Keith Packard
2011-12-21 21:01 ` Jan Kara
2011-12-21 21:01   ` Jan Kara
2011-12-22 10:58 ` Srivatsa S. Bhat
2011-12-22 10:58   ` Srivatsa S. Bhat
2011-12-22 11:27   ` Jeff Layton
2011-12-22 11:27     ` Jeff Layton
2011-12-22 11:15 ` Srivatsa S. Bhat
2011-12-22 11:15   ` Srivatsa S. Bhat

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=alpine.LSU.2.00.1112202213310.3987@eggly.anvils \
    --to=hughd@google.com \
    --cc=akpm@linux-foundation.org \
    --cc=dave.kleikamp@oracle.com \
    --cc=davem@davemloft.net \
    --cc=florian@mickler.org \
    --cc=jfs-discussion@lists.sourceforge.net \
    --cc=kernel-testers@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=maciej.rutecki@gmail.com \
    --cc=rjw@sisk.pl \
    --cc=shaggy@kernel.org \
    --cc=torvalds@linux-foundation.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 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.