Re: page cache: Store only head pages in i_pages

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sat, Mar 23, 2019 at 10:52:49PM -0400, Qian Cai wrote:
> On 3/23/19 10:06 PM, Matthew Wilcox wrote:
> > Thanks for testing.  Kirill suggests this would be a better fix:
> > 
> > diff --git a/include/linux/pagemap.h b/include/linux/pagemap.h
> > index 41858a3744b4..9718393ae45b 100644
> > --- a/include/linux/pagemap.h
> > +++ b/include/linux/pagemap.h
> > @@ -334,10 +334,12 @@ static inline struct page *grab_cache_page_nowait(struct address_space *mapping,
> >  
> >  static inline struct page *find_subpage(struct page *page, pgoff_t offset)
> >  {
> > +	unsigned long index = page_index(page);
> > +
> >  	VM_BUG_ON_PAGE(PageTail(page), page);
> > -	VM_BUG_ON_PAGE(page->index > offset, page);
> > -	VM_BUG_ON_PAGE(page->index + compound_nr(page) <= offset, page);
> > -	return page - page->index + offset;
> > +	VM_BUG_ON_PAGE(index > offset, page);
> > +	VM_BUG_ON_PAGE(index + compound_nr(page) <= offset, page);
> > +	return page - index + offset;
> >  }
> >  
> >  struct page *find_get_entry(struct address_space *mapping, pgoff_t offset);
> 
> This is not even compiled.
> 
> If "s/compound_nr/compound_order/", it failed to boot here,

Oh, sorry.  I have another patch in that tree.

-       VM_BUG_ON_PAGE(page->index + (1 << compound_order(page)) <= offset,
-                       page);
+       VM_BUG_ON_PAGE(page->index + compound_nr(page) <= offset, page);

The patch for you should have looked like this:

@@ -335,11 +335,12 @@ static inline struct page *grab_cache_page_nowait(struct address_space *mapping,
 
 static inline struct page *find_subpage(struct page *page, pgoff_t offset)
 {
+       unsigned long index = page_index(page);
+
        VM_BUG_ON_PAGE(PageTail(page), page);
-       VM_BUG_ON_PAGE(page->index > offset, page);
-       VM_BUG_ON_PAGE(page->index + (1 << compound_order(page)) <= offset,
-                       page);
-       return page - page->index + offset;
+       VM_BUG_ON_PAGE(index > offset, page);
+       VM_BUG_ON_PAGE(index + (1 << compound_order(page)) <= offset, page);
+       return page - index + offset;
 }


> [   56.915812] page dumped because: VM_BUG_ON_PAGE(index + compound_order(page)
> <= offset)

Yeah, you were missing the '1 <<' part.




[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux