Skip to content

Commit 66447fd

Browse files
Chengming Zhouakpm00
authored andcommitted
mm/zswap: cleanup zswap_load()
After the common decompress part goes to __zswap_load(), we can cleanup the zswap_load() a little. Link: https://lkml.kernel.org/r/[email protected] Signed-off-by: Chengming Zhou <[email protected]> Reviewed-by: Yosry Ahmed <[email protected]> Acked-by: Chis Li <[email protected]> (Google) Cc: Barry Song <[email protected]> Cc: Dan Streetman <[email protected]> Cc: Johannes Weiner <[email protected]> Cc: Nhat Pham <[email protected]> Cc: Seth Jennings <[email protected]> Cc: Vitaly Wool <[email protected]> Signed-off-by: Andrew Morton <[email protected]>
1 parent 32acba4 commit 66447fd

File tree

1 file changed

+5
-9
lines changed

1 file changed

+5
-9
lines changed

mm/zswap.c

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1746,7 +1746,6 @@ bool zswap_load(struct folio *folio)
17461746
struct zswap_tree *tree = zswap_trees[type];
17471747
struct zswap_entry *entry;
17481748
u8 *dst;
1749-
bool ret;
17501749

17511750
VM_WARN_ON_ONCE(!folio_test_locked(folio));
17521751

@@ -1759,23 +1758,20 @@ bool zswap_load(struct folio *folio)
17591758
}
17601759
spin_unlock(&tree->lock);
17611760

1762-
if (!entry->length) {
1761+
if (entry->length)
1762+
__zswap_load(entry, page);
1763+
else {
17631764
dst = kmap_local_page(page);
17641765
zswap_fill_page(dst, entry->value);
17651766
kunmap_local(dst);
1766-
ret = true;
1767-
goto stats;
17681767
}
17691768

1770-
__zswap_load(entry, page);
1771-
ret = true;
1772-
stats:
17731769
count_vm_event(ZSWPIN);
17741770
if (entry->objcg)
17751771
count_objcg_event(entry->objcg, ZSWPIN);
17761772

17771773
spin_lock(&tree->lock);
1778-
if (ret && zswap_exclusive_loads_enabled) {
1774+
if (zswap_exclusive_loads_enabled) {
17791775
zswap_invalidate_entry(tree, entry);
17801776
folio_mark_dirty(folio);
17811777
} else if (entry->length) {
@@ -1785,7 +1781,7 @@ bool zswap_load(struct folio *folio)
17851781
zswap_entry_put(tree, entry);
17861782
spin_unlock(&tree->lock);
17871783

1788-
return ret;
1784+
return true;
17891785
}
17901786

17911787
void zswap_invalidate(int type, pgoff_t offset)

0 commit comments

Comments
 (0)