Re: [PATCH] [13/16] HWPOISON: The high level memory error handler in the VM v3

Nick Piggin
2009-06-02T14:14:24Z

On Tue, Jun 02, 2009 at 10:10:31PM +0800, Wu Fengguang wrote:
> On Tue, Jun 02, 2009 at 10:08:30PM +0800, Andi Kleen wrote:
> > > > > We could probably call truncate_complete_page(), but then
> > > > > we would also need to duplicate most of the checking outside
> > > > > the function anyways and there wouldn't be any possibility
> > > > > to share the clean/dirty variants. If you insist I can
> > > > > do it, but I think it would be significantly worse code
> > > > > than before and I'm reluctant to do that.
> > > >
> > > > I can write you the patch for that too if you like.
> > >
> > > I have already posted one on truncate_complete_page(). Not the way you want it?
> >
> > Sorry I must have missed it (too much mail I guess). Can you repost please?
>
> OK, here it is, a more simplified one.

I prefer mine because I don't want truncate_complete_page escaping
mm/truncate.c because the caller has to deal with truncate races.

> ---
> mm/memory-failure.c | 13 +++----------
> 1 file changed, 3 insertions(+), 10 deletions(-)
>
> --- sound-2.6.orig/mm/memory-failure.c
> +++ sound-2.6/mm/memory-failure.c
> @@ -324,23 +324,16 @@ static int me_free(struct page *p)
> */
> static int me_pagecache_clean(struct page *p)
> {
> + if (page_mapping(p))
> + truncate_complete_page(p->mapping, p);
> +
> if (!isolate_lru_page(p))
> page_cache_release(p);
>
> - if (page_has_private(p))
> - do_invalidatepage(p, 0);
> if (page_has_private(p) && !try_to_release_page(p, GFP_NOIO))
> Dprintk(KERN_ERR "MCE %#lx: failed to release buffers\n",
> page_to_pfn(p));
>
> - /*
> - * remove_from_page_cache assumes (mapping && !mapped)
> - */
> - if (page_mapping(p) && !page_mapped(p)) {
> - remove_from_page_cache(p);
> - page_cache_release(p);
> - }
> -
> return RECOVERED;
> }