diff options
author | Matthew Wilcox (Oracle) <willy@infradead.org> | 2023-07-15 05:23:43 +0100 |
---|---|---|
committer | Andrew Morton <akpm@linux-foundation.org> | 2023-08-21 13:37:27 -0700 |
commit | ca54f6d89d60abf3e7dea68c95dfd442eeece212 (patch) | |
tree | db5db1ac60a6e83fcb68e820566b87237632ead0 /mm/zswap.c | |
parent | fbcec6a3a09b309900f1ecef8954721d93555abd (diff) |
zswap: make zswap_load() take a folio
Only convert a few easy parts of this function to use the folio passed in;
convert back to struct page for the majority of it. Removes three hidden
calls to compound_head().
Link: https://lkml.kernel.org/r/20230715042343.434588-6-willy@infradead.org
Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
Cc: Christoph Hellwig <hch@infradead.org>
Cc: Domenico Cerasuolo <cerasuolodomenico@gmail.com>
Cc: Johannes Weiner <hannes@cmpxchg.org>
Cc: Nhat Pham <nphamcs@gmail.com>
Cc: Vitaly Wool <vitaly.wool@konsulko.com>
Cc: Yosry Ahmed <yosryahmed@google.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Diffstat (limited to 'mm/zswap.c')
-rw-r--r-- | mm/zswap.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/mm/zswap.c b/mm/zswap.c index 9df33298f2dc..7cc4a2baa713 100644 --- a/mm/zswap.c +++ b/mm/zswap.c @@ -1405,11 +1405,12 @@ shrink: goto reject; } -bool zswap_load(struct page *page) +bool zswap_load(struct folio *folio) { - swp_entry_t swp = { .val = page_private(page), }; + swp_entry_t swp = folio_swap_entry(folio); int type = swp_type(swp); pgoff_t offset = swp_offset(swp); + struct page *page = &folio->page; struct zswap_tree *tree = zswap_trees[type]; struct zswap_entry *entry; struct scatterlist input, output; @@ -1419,7 +1420,7 @@ bool zswap_load(struct page *page) unsigned int dlen; bool ret; - VM_WARN_ON_ONCE(!PageLocked(page)); + VM_WARN_ON_ONCE(!folio_test_locked(folio)); /* find */ spin_lock(&tree->lock); @@ -1481,7 +1482,7 @@ freeentry: spin_lock(&tree->lock); if (ret && zswap_exclusive_loads_enabled) { zswap_invalidate_entry(tree, entry); - SetPageDirty(page); + folio_mark_dirty(folio); } else if (entry->length) { spin_lock(&entry->pool->lru_lock); list_move(&entry->lru, &entry->pool->lru); |