mirror of
https://github.com/torvalds/linux.git
synced 2026-07-27 09:36:22 +02:00
mm: merge writeout into pageout
writeout is only called from pageout, and a straight flow at the end, so merge the two functions. Link: https://lore.kernel.org/20260601113449.3464734-3-hch@lst.de Signed-off-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Baoquan He <baoquan.he@linux.dev> Reviewed-by: Nhat Pham <nphamcs@gmail.com> Acked-by: David Hildenbrand (Arm) <david@kernel.org> Cc: Chris Li <chrisl@kernel.org> Cc: Kairui Song <kasong@tencent.com> Cc: Kemeng Shi <shikemeng@huaweicloud.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
This commit is contained in:
parent
1d0ac576f3
commit
6f64c06f43
63
mm/vmscan.c
63
mm/vmscan.c
|
|
@ -612,11 +612,38 @@ typedef enum {
|
|||
PAGE_CLEAN,
|
||||
} pageout_t;
|
||||
|
||||
static pageout_t writeout(struct folio *folio, struct address_space *mapping,
|
||||
struct swap_iocb **plug, struct list_head *folio_list)
|
||||
/*
|
||||
* pageout is called by shrink_folio_list() for each dirty folio.
|
||||
*/
|
||||
static pageout_t pageout(struct folio *folio, struct address_space *mapping,
|
||||
struct swap_iocb **plug, struct list_head *folio_list)
|
||||
{
|
||||
int res;
|
||||
|
||||
/*
|
||||
* We no longer attempt to writeback filesystem folios here, other
|
||||
* than tmpfs/shmem. That's taken care of in page-writeback.
|
||||
* If we find a dirty filesystem folio at the end of the LRU list,
|
||||
* typically that means the filesystem is saturating the storage
|
||||
* with contiguous writes and telling it to write a folio here
|
||||
* would only make the situation worse by injecting an element
|
||||
* of random access.
|
||||
*
|
||||
* If the folio is swapcache, write it back even if that would
|
||||
* block, for some throttling. This happens by accident, because
|
||||
* swap_backing_dev_info is bust: it doesn't reflect the
|
||||
* congestion state of the swapdevs. Easy to fix, if needed.
|
||||
*
|
||||
* A freeable shmem or swapcache folio is referenced only by the
|
||||
* caller that isolated the folio and the page cache.
|
||||
*/
|
||||
if (folio_ref_count(folio) != 1 + folio_nr_pages(folio) || !mapping)
|
||||
return PAGE_KEEP;
|
||||
if (!shmem_mapping(mapping) && !folio_test_anon(folio))
|
||||
return PAGE_ACTIVATE;
|
||||
if (!folio_clear_dirty_for_io(folio))
|
||||
return PAGE_CLEAN;
|
||||
|
||||
folio_set_reclaim(folio);
|
||||
|
||||
/*
|
||||
|
|
@ -645,38 +672,6 @@ static pageout_t writeout(struct folio *folio, struct address_space *mapping,
|
|||
return PAGE_SUCCESS;
|
||||
}
|
||||
|
||||
/*
|
||||
* pageout is called by shrink_folio_list() for each dirty folio.
|
||||
*/
|
||||
static pageout_t pageout(struct folio *folio, struct address_space *mapping,
|
||||
struct swap_iocb **plug, struct list_head *folio_list)
|
||||
{
|
||||
/*
|
||||
* We no longer attempt to writeback filesystem folios here, other
|
||||
* than tmpfs/shmem. That's taken care of in page-writeback.
|
||||
* If we find a dirty filesystem folio at the end of the LRU list,
|
||||
* typically that means the filesystem is saturating the storage
|
||||
* with contiguous writes and telling it to write a folio here
|
||||
* would only make the situation worse by injecting an element
|
||||
* of random access.
|
||||
*
|
||||
* If the folio is swapcache, write it back even if that would
|
||||
* block, for some throttling. This happens by accident, because
|
||||
* swap_backing_dev_info is bust: it doesn't reflect the
|
||||
* congestion state of the swapdevs. Easy to fix, if needed.
|
||||
*
|
||||
* A freeable shmem or swapcache folio is referenced only by the
|
||||
* caller that isolated the folio and the page cache.
|
||||
*/
|
||||
if (folio_ref_count(folio) != 1 + folio_nr_pages(folio) || !mapping)
|
||||
return PAGE_KEEP;
|
||||
if (!shmem_mapping(mapping) && !folio_test_anon(folio))
|
||||
return PAGE_ACTIVATE;
|
||||
if (!folio_clear_dirty_for_io(folio))
|
||||
return PAGE_CLEAN;
|
||||
return writeout(folio, mapping, plug, folio_list);
|
||||
}
|
||||
|
||||
/*
|
||||
* Same as remove_mapping, but if the folio is removed from the mapping, it
|
||||
* gets returned with a refcount of 0.
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user