lkml.org 
[lkml]   [2020]   [Sep]   [9]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH v18 31/32] mm: Add explicit page decrement in exception path for isolate_lru_pages
On Wed, Sep 09, 2020 at 08:43:38AM -0700, Alexander Duyck wrote:
> On Tue, Sep 8, 2020 at 6:01 PM Matthew Wilcox <willy@infradead.org> wrote:
> >
> > On Mon, Aug 24, 2020 at 08:55:04PM +0800, Alex Shi wrote:
> > > +++ b/mm/vmscan.c
> > > @@ -1688,10 +1688,13 @@ static unsigned long isolate_lru_pages(unsigned long nr_to_scan,
> > >
> > > if (!TestClearPageLRU(page)) {
> > > /*
> > > - * This page may in other isolation path,
> > > - * but we still hold lru_lock.
> > > + * This page is being isolated in another
> > > + * thread, but we still hold lru_lock. The
> > > + * other thread must be holding a reference
> > > + * to the page so this should never hit a
> > > + * reference count of 0.
> > > */
> > > - put_page(page);
> > > + WARN_ON(put_page_testzero(page));
> > > goto busy;
> >
> > I read Hugh's review and that led me to take a look at this. We don't
> > do it like this. Use the same pattern as elsewhere in mm:
> >
> > page_ref_sub(page, nr);
> > VM_BUG_ON_PAGE(page_count(page) <= 0, page);
>
> Actually for this case page_ref_dec(page) would make more sense
> wouldn't it? Otherwise I agree that would be a better change if that
> is the way it has been handled before. I just wasn't familiar with
> those other spots.

Yes, page_ref_dec() should be fine. It's hard to remember which of
VM_BUG_ON, WARN_ON, etc, compile down to nothing with various CONFIG
options, and which ones actually evalauate their arguments. Safer not
to put things with side-effects inside macros.

\
 
 \ /
  Last update: 2020-09-09 19:09    [W:0.103 / U:2.252 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site