mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Trond Myklebust <Trond.Myklebust@netapp.com>
To: Steve Dickson <SteveD@redhat.com>
Cc: Andrew Morton <akpm@osdl.org>, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] VM: Fix the gfp_mask in invalidate_complete_page2
Date: Fri, 06 Oct 2006 18:16:30 -0400	[thread overview]
Message-ID: <1160172990.12253.14.camel@lade.trondhjem.org> (raw)
In-Reply-To: <4526CF6F.9040006@RedHat.com>

On Fri, 2006-10-06 at 17:49 -0400, Steve Dickson wrote:
> Trond Myklebust wrote:
> > If try_to_release_page() is called with a zero gfp mask, then the
> > filesystem is effectively denied the possibility of sleeping while
> > attempting to release the page. There doesn't appear to be any valid
> > reason why this should be banned, given that we're not calling this from
> > a memory allocation context.
> >  
> > For this reason, change the gfp_mask argument of the call to GFP_KERNEL.
> >     
> > Note: I am less sure of what the callers of invalidate_complete_page()
> > require, and so this patch does not touch that mask.
> > 
> > Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
> > ---
> > diff --git a/mm/truncate.c b/mm/truncate.c
> > index f4edbc1..49c1ffd 100644
> > --- a/mm/truncate.c
> > +++ b/mm/truncate.c
> > @@ -302,7 +302,7 @@ invalidate_complete_page2(struct address
> >  	if (page->mapping != mapping)
> >  		return 0;
> >  
> > -	if (PagePrivate(page) && !try_to_release_page(page, 0))
> > +	if (PagePrivate(page) && !try_to_release_page(page, GFP_KERNEL))
> >  		return 0;
> >  
> >  	write_lock_irq(&mapping->tree_lock);
> Well I was using mapping_gfp_mask(mapping) as the argument to
> try_to_release_page() which also worked... but isn't this
> just plugging one of many holes?

Yeah using mapping_gfp_mask(mapping) sounds like a better option.

...and yes, there are other callers that need to be audited. I'm
particularly curious about the effect of the call in
block_invalidatepage() on XFS, which has a similar test to ours.

The call in fallback_migrate_page() should probably be using
mapping_gfp_mask() too.

> Meaning try_to_release_page is called
> from a number of places with a zero gfp_mask so shouldn't those
> also be fixed as well OR removed the gfp_mask as an argument as the
> comment at the top of try_to_release_page() alludes to?

Nope. In order to make it work correctly with NFS and XFS, all calls to
try_to_release_page() would have to be allowed to be blocking. The
problem is that shrink_page_list() still wants to call
try_to_release_page() from a memory allocation context.

Cheers,
  Trond

  reply	other threads:[~2006-10-06 22:16 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-10-06 21:37 Trond Myklebust
2006-10-06 21:49 ` Steve Dickson
2006-10-06 22:16   ` Trond Myklebust [this message]
2006-10-06 22:19     ` Trond Myklebust
2006-10-06 22:40       ` Andrew Morton
2006-10-06 23:09         ` Steve Dickson
2006-10-06 23:20           ` Andrew Morton
2006-10-07  2:33           ` Andrew Morton
2006-10-10  9:43 ` David Howells
2006-10-10 11:42   ` Trond Myklebust
2006-10-10 12:18     ` Steve Dickson
2006-10-10 12:27       ` Trond Myklebust
2006-10-10 13:22         ` Steve Dickson
2006-10-10 13:32           ` Trond Myklebust
2006-10-10 12:49   ` David Howells
2006-10-10 13:15     ` Trond Myklebust

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=1160172990.12253.14.camel@lade.trondhjem.org \
    --to=trond.myklebust@netapp.com \
    --cc=SteveD@redhat.com \
    --cc=akpm@osdl.org \
    --cc=linux-kernel@vger.kernel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®