Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1412495

Re: [BUG/REGRESSION] THP: broken page count after commit aa88b68c

From Andrew Morton <akpm@linux-foundation.org>
Newsgroups linux.kernel
Subject Re: [BUG/REGRESSION] THP: broken page count after commit aa88b68c
Date 2016-06-02 20:50 +0200
Message-ID <rFFQR-1d1-1@gated-at.bofh.it> (permalink)
References <rFCJj-7Au-7@gated-at.bofh.it> <rFDcm-7Kh-21@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On Thu, 2 Jun 2016 18:51:50 +0300 "Kirill A. Shutemov" <kirill@shutemov.name> wrote:

> On Thu, Jun 02, 2016 at 05:21:41PM +0200, Gerald Schaefer wrote:
> > Christian Borntraeger reported a kernel panic after corrupt page counts,
> > and it turned out to be a regression introduced with commit aa88b68c
> > "thp: keep huge zero page pinned until tlb flush", at least on s390.
> > 
> > put_huge_zero_page() was moved over from zap_huge_pmd() to release_pages(),
> > and it was replaced by tlb_remove_page(). However, release_pages() might
> > not always be triggered by (the arch-specific) tlb_remove_page().
> > 
> > On s390 we call free_page_and_swap_cache() from tlb_remove_page(), and not
> > tlb_flush_mmu() -> free_pages_and_swap_cache() like the generic version,
> > because we don't use the MMU-gather logic. Although both functions have very
> > similar names, they are doing very unsimilar things, in particular
> > free_page_xxx is just doing a put_page(), while free_pages_xxx calls
> > release_pages().
> > 
> > This of course results in very harmful put_page()s on the huge zero page,
> > on architectures where tlb_remove_page() is implemented in this way. It
> > seems to affect only s390 and sh, but sh doesn't have THP support, so
> > the problem (currently) probably only exists on s390.
> > 
> > The following quick hack fixed the issue:
> > 
> > diff --git a/mm/swap_state.c b/mm/swap_state.c
> > index 0d457e7..c99463a 100644
> > --- a/mm/swap_state.c
> > +++ b/mm/swap_state.c
> > @@ -252,7 +252,10 @@ static inline void free_swap_cache(struct page *page)
> >  void free_page_and_swap_cache(struct page *page)
> >  {
> >  	free_swap_cache(page);
> > -	put_page(page);
> > +	if (is_huge_zero_page(page))
> > +		put_huge_zero_page();
> > +	else
> > +		put_page(page);
> >  }
> >  
> >  /*
> 
> The fix looks good to me.

Yes.  A bit regrettable, but that's what release_pages() does.

Can we have a signed-off-by please?

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[BUG/REGRESSION] THP: broken page count after commit aa88b68c Gerald Schaefer <gerald.schaefer@de.ibm.com> - 2016-06-02 17:30 +0200
  Re: [BUG/REGRESSION] THP: broken page count after commit aa88b68c "Kirill A. Shutemov" <kirill@shutemov.name> - 2016-06-02 18:00 +0200
    Re: [BUG/REGRESSION] THP: broken page count after commit aa88b68c Andrew Morton <akpm@linux-foundation.org> - 2016-06-02 20:50 +0200
      Re: [BUG/REGRESSION] THP: broken page count after commit aa88b68c Christian Borntraeger <borntraeger@de.ibm.com> - 2016-06-02 21:00 +0200
      Re: [BUG/REGRESSION] THP: broken page count after commit aa88b68c Andrew Morton <akpm@linux-foundation.org> - 2016-06-02 21:10 +0200
        Re: [BUG/REGRESSION] THP: broken page count after commit aa88b68c Christian Borntraeger <borntraeger@de.ibm.com> - 2016-06-02 21:20 +0200
    Re: [BUG/REGRESSION] THP: broken page count after commit aa88b68c Hugh Dickins <hughd@google.com> - 2016-06-02 21:50 +0200
      Re: [BUG/REGRESSION] THP: broken page count after commit aa88b68c "Kirill A. Shutemov" <kirill@shutemov.name> - 2016-06-03 12:40 +0200

csiph-web