lkml.org 
[lkml]   [2020]   [Feb]   [18]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    SubjectRe: [PATCH v6 07/19] mm: Put readahead pages in cache earlier
    From
    Date
    On 2/18/20 5:02 PM, Matthew Wilcox wrote:
    > On Tue, Feb 18, 2020 at 04:01:43PM -0800, John Hubbard wrote:
    >> How about this instead? It uses the "for" loop fully and more naturally,
    >> and is easier to read. And it does the same thing:
    >>
    >> static inline struct page *readahead_page(struct readahead_control *rac)
    >> {
    >> struct page *page;
    >>
    >> if (!rac->_nr_pages)
    >> return NULL;
    >>
    >> page = xa_load(&rac->mapping->i_pages, rac->_start);
    >> VM_BUG_ON_PAGE(!PageLocked(page), page);
    >> rac->_batch_count = hpage_nr_pages(page);
    >>
    >> return page;
    >> }
    >>
    >> static inline struct page *readahead_next(struct readahead_control *rac)
    >> {
    >> rac->_nr_pages -= rac->_batch_count;
    >> rac->_start += rac->_batch_count;
    >>
    >> return readahead_page(rac);
    >> }
    >>
    >> #define readahead_for_each(rac, page) \
    >> for (page = readahead_page(rac); page != NULL; \
    >> page = readahead_page(rac))
    >
    > I'm assuming you mean 'page = readahead_next(rac)' on that second line.


    Yep. :)


    >
    > If you keep reading all the way to the penultimate patch, it won't work
    > for iomap ... at least not in the same way.
    >

    OK, getting there...


    thanks,
    --
    John Hubbard
    NVIDIA

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