Skip to content
Permalink
Matthew-Wilcox…
Switch branches/tags

Commits on Dec 8, 2021

  1. mm: Use multi-index entries in the page cache

    We currently store large folios as 2^N consecutive entries.  While this
    consumes rather more memory than necessary, it also turns out to be buggy.
    A writeback operation which starts within a tail page of a dirty folio will
    not write back the folio as the xarray's dirty bit is only set on the
    head index.  With multi-index entries, the dirty bit will be found no
    matter where in the folio the operation starts.
    
    This does end up simplifying the page cache slightly, although not as
    much as I had hoped.
    
    Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
    Matthew Wilcox (Oracle) authored and intel-lab-lkp committed Dec 8, 2021
  2. XArray: Add xas_advance()

    Add a new helper function to help iterate over multi-index entries.
    
    Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
    Matthew Wilcox (Oracle) authored and intel-lab-lkp committed Dec 8, 2021
  3. truncate,shmem: Handle truncates that split large folios

    Handle folio splitting in the parts of the truncation functions which
    already handle partial pages.  Factor all that code out into a new
    function called truncate_inode_partial_folio().
    
    Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
    Reviewed-by: Jan Kara <jack@suse.cz>
    Reviewed-by: William Kucharski <william.kucharski@oracle.com>
    Matthew Wilcox (Oracle) authored and intel-lab-lkp committed Dec 8, 2021
  4. truncate: Convert invalidate_inode_pages2_range to folios

    If we're going to unmap a folio, we have to be sure to unmap the entire
    folio, not just the part of it which lies after the search index.
    
    Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
    Matthew Wilcox (Oracle) authored and intel-lab-lkp committed Dec 8, 2021
  5. fs: Convert vfs_dedupe_file_range_compare to folios

    We still only operate on a single page of data at a time due to using
    kmap().  A more complex implementation would work on each page in a folio,
    but it's not clear that such a complex implementation would be worthwhile.
    
    Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
    Matthew Wilcox (Oracle) authored and intel-lab-lkp committed Dec 8, 2021
  6. mm: Remove pagevec_remove_exceptionals()

    All of its callers now call folio_batch_remove_exceptionals().
    
    Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
    Matthew Wilcox (Oracle) authored and intel-lab-lkp committed Dec 8, 2021
  7. mm: Convert find_lock_entries() to use a folio_batch

    find_lock_entries() already only returned the head page of folios, so
    convert it to return a folio_batch instead of a pagevec.  That cascades
    through converting truncate_inode_pages_range() to
    delete_from_page_cache_batch() and page_cache_delete_batch().
    
    Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
    Matthew Wilcox (Oracle) authored and intel-lab-lkp committed Dec 8, 2021
  8. filemap: Return only folios from find_get_entries()

    The callers have all been converted to work on folios, so convert
    find_get_entries() to return a batch of folios instead of pages.
    We also now return multiple large folios in a single call.
    
    Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
    Reviewed-by: Jan Kara <jack@suse.cz>
    Reviewed-by: William Kucharski <william.kucharski@oracle.com>
    Matthew Wilcox (Oracle) authored and intel-lab-lkp committed Dec 8, 2021
  9. filemap: Convert filemap_get_read_batch() to use a folio_batch

    This change ripples all the way through the filemap_read() call chain and
    removes a lot of messing about converting folios to pages and back again.
    
    Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
    Matthew Wilcox (Oracle) authored and intel-lab-lkp committed Dec 8, 2021
  10. filemap: Convert filemap_read() to use a folio

    We know the pagevec always contains folios, but use page_folio() anyway
    instead of casting.  Removes a few calls to legacy functions.
    
    Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
    Matthew Wilcox (Oracle) authored and intel-lab-lkp committed Dec 8, 2021
  11. truncate: Add invalidate_complete_folio2()

    Convert invalidate_complete_page2() to invalidate_complete_folio2().
    Use filemap_free_folio() to free the page instead of calling ->freepage
    manually.
    
    Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
    Matthew Wilcox (Oracle) authored and intel-lab-lkp committed Dec 8, 2021
  12. truncate: Convert invalidate_inode_pages2_range() to use a folio

    If we're going to unmap a folio, we have to be sure to unmap the entire
    folio, not just the part of it which lies after the search index.
    
    We cannot yet remove the struct page from invalidate_inode_pages2_range()
    because the page pointer in the pvec might be a shadow/dax/swap entry
    instead of actually a page.
    
    Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
    Matthew Wilcox (Oracle) authored and intel-lab-lkp committed Dec 8, 2021
  13. truncate: Skip known-truncated indices

    If we've truncated an entire folio, we can skip over all the indices
    covered by this folio.
    
    Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
    Matthew Wilcox (Oracle) authored and intel-lab-lkp committed Dec 8, 2021
  14. truncate,shmem: Add truncate_inode_folio()

    Convert all callers of truncate_inode_page() to call
    truncate_inode_folio() instead, and move the declaration to mm/internal.h.
    Move the assertion that the caller is not passing in a tail page to
    generic_error_remove_page().  We can't entirely remove the struct page
    from the callers yet because the page pointer in the pvec might be a
    shadow/dax/swap entry instead of actually a page.
    
    Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
    Matthew Wilcox (Oracle) authored and intel-lab-lkp committed Dec 8, 2021
  15. shmem: Convert part of shmem_undo_range() to use a folio

    find_lock_entries() never returns tail pages.  We cannot use page_folio()
    here as the pagevec may also contain swap entries, so simply cast.
    
    Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
    Matthew Wilcox (Oracle) authored and intel-lab-lkp committed Dec 8, 2021
  16. mm: Add unmap_mapping_folio()

    Convert both callers of unmap_mapping_page() to call unmap_mapping_folio()
    instead.  Also move zap_details from linux/mm.h to mm/internal.h
    
    Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
    Matthew Wilcox (Oracle) authored and intel-lab-lkp committed Dec 8, 2021
  17. truncate: Add truncate_cleanup_folio()

    Convert both callers of truncate_cleanup_page() to use
    truncate_cleanup_folio() instead.
    
    Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
    Matthew Wilcox (Oracle) authored and intel-lab-lkp committed Dec 8, 2021
  18. filemap: Add filemap_release_folio()

    Reimplement try_to_release_page() as a wrapper around
    filemap_release_folio().
    
    Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
    Matthew Wilcox (Oracle) authored and intel-lab-lkp committed Dec 8, 2021
  19. filemap: Use a folio in filemap_page_mkwrite

    This fixes a bug for tail pages.  They always have a NULL mapping, so
    the check would fail and we would never mark the folio as dirty.
    Ends up growing the kernel by 19 bytes although there will be fewer
    calls to compound_head() dynamically.
    
    Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
    Matthew Wilcox (Oracle) authored and intel-lab-lkp committed Dec 8, 2021
  20. filemap: Use a folio in filemap_map_pages

    Saves 61 bytes due to fewer calls to compound_head().
    
    Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
    Matthew Wilcox (Oracle) authored and intel-lab-lkp committed Dec 8, 2021
  21. filemap: Use folios in next_uptodate_page

    This saves 105 bytes of text.
    
    Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
    Matthew Wilcox (Oracle) authored and intel-lab-lkp committed Dec 8, 2021
  22. filemap: Convert page_cache_delete_batch to folios

    Saves one call to compound_head() and reduces text size by 15 bytes.
    
    Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
    Matthew Wilcox (Oracle) authored and intel-lab-lkp committed Dec 8, 2021
  23. filemap: Convert filemap_get_pages to use folios

    This saves a few calls to compound_head(), including one in
    filemap_update_page().  Shrinks the kernel by 78 bytes.
    
    Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
    Matthew Wilcox (Oracle) authored and intel-lab-lkp committed Dec 8, 2021
  24. filemap: Add read_cache_folio and read_mapping_folio

    Reimplement read_cache_page() as a wrapper around read_cache_folio().
    Saves over 400 bytes of text from do_read_cache_folio() which more
    thn makes up for the extra 100 bytes of text added to the various
    wrapper functions.
    
    Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
    Matthew Wilcox (Oracle) authored and intel-lab-lkp committed Dec 8, 2021
  25. filemap: Convert filemap_fault to folio

    Instead of converting back-and-forth between the actual page and
    the head page, just convert once at the end of the function where we
    set the vmf->page.  Saves 241 bytes of text, or 15% of the size of
    filemap_fault().
    
    Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
    Matthew Wilcox (Oracle) authored and intel-lab-lkp committed Dec 8, 2021
  26. filemap: Convert do_async_mmap_readahead to take a folio

    Call page_cache_async_ra() directly instead of indirecting through
    page_cache_async_readahead().
    
    Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
    Matthew Wilcox (Oracle) authored and intel-lab-lkp committed Dec 8, 2021
  27. readahead: Convert page_cache_ra_unbounded to folios

    This saves 99 bytes of kernel text.
    
    Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
    Matthew Wilcox (Oracle) authored and intel-lab-lkp committed Dec 8, 2021
  28. readahead: Convert page_cache_async_ra() to take a folio

    Using the folio here avoids checking whether it's a tail page.
    This patch mostly just enables some of the following patches.
    
    Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
    Matthew Wilcox (Oracle) authored and intel-lab-lkp committed Dec 8, 2021
  29. filemap: Convert filemap_range_uptodate to folios

    The only caller was already passing a head page, so this simply avoids
    a call to compound_head().
    
    Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
    Matthew Wilcox (Oracle) authored and intel-lab-lkp committed Dec 8, 2021
  30. filemap: Convert filemap_create_page to folio

    This is all internal to filemap and saves 100 bytes of text.
    
    Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
    Matthew Wilcox (Oracle) authored and intel-lab-lkp committed Dec 8, 2021
  31. filemap: Convert filemap_read_page to take a folio

    One of the callers already had a folio; the other two grow by a few
    bytes, but filemap_read_page() shrinks by 50 bytes for a net reduction
    of 27 bytes.
    
    Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
    Matthew Wilcox (Oracle) authored and intel-lab-lkp committed Dec 8, 2021
  32. filemap: Convert find_get_pages_contig to folios

    None of the callers of find_get_pages_contig() want tail pages.  They all
    use order-0 pages today, but if they were converted, they'd want folios.
    So just remove the call to find_subpage() instead of replacing it with
    folio_page().
    
    Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
    Matthew Wilcox (Oracle) authored and intel-lab-lkp committed Dec 8, 2021
  33. filemap: Convert filemap_get_read_batch to use folios

    The page cache only stores folios, never tail pages.  Saves 29 bytes
    due to removing calls to compound_head().
    
    Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
    Matthew Wilcox (Oracle) authored and intel-lab-lkp committed Dec 8, 2021
  34. filemap: Remove thp_contains()

    This function is now unused, so delete it.
    
    Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
    Matthew Wilcox (Oracle) authored and intel-lab-lkp committed Dec 8, 2021
  35. filemap: Convert find_get_entry to return a folio

    Convert callers to cope.  Saves 580 bytes of kernel text; all five
    callers are reduced in size.
    
    Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
    Matthew Wilcox (Oracle) authored and intel-lab-lkp committed Dec 8, 2021
Older