summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChengming Zhou <zhouchengming@bytedance.com>2024-02-04 03:06:02 +0000
committerAndrew Morton <akpm@linux-foundation.org>2024-02-22 10:24:54 -0800
commit3b631bd06550040b37cd2ebb00e2374404db0360 (patch)
tree835ea3da4b2e8ca21da8768090b88f22c2ec1eb4
parentb49547ade38a63ff39c9fbc53fb38622cb63854a (diff)
mm/zswap: remove duplicate_entry debug value
cat /sys/kernel/debug/zswap/duplicate_entry 2086447 When testing, the duplicate_entry value is very high, but no warning message in the kernel log. From the comment of duplicate_entry "Duplicate store was encountered (rare)", it seems something goes wrong. Actually it's incremented in the beginning of zswap_store(), which found its zswap entry has already on the tree. And this is a normal case, since the folio could leave zswap entry on the tree after swapin, later it's dirtied and swapout/zswap_store again, found its original zswap entry. So duplicate_entry should be only incremented in the real bug case, which already have "WARN_ON(1)", it looks redundant to count bug case, so this patch just remove it. Link: https://lkml.kernel.org/r/20240201-b4-zswap-invalidate-entry-v2-4-99d4084260a0@bytedance.com Signed-off-by: Chengming Zhou <zhouchengming@bytedance.com> Acked-by: Johannes Weiner <hannes@cmpxchg.org> Reviewed-by: Nhat Pham <nphamcs@gmail.com> Acked-by: Yosry Ahmed <yosryahmed@google.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
-rw-r--r--mm/zswap.c9
1 files changed, 1 insertions, 8 deletions
diff --git a/mm/zswap.c b/mm/zswap.c
index f8a4ac389118..91df925359c8 100644
--- a/mm/zswap.c
+++ b/mm/zswap.c
@@ -71,8 +71,6 @@ static u64 zswap_reject_compress_poor;
static u64 zswap_reject_alloc_fail;
/* Store failed because the entry metadata could not be allocated (rare) */
static u64 zswap_reject_kmemcache_fail;
-/* Duplicate store was encountered (rare) */
-static u64 zswap_duplicate_entry;
/* Shrinker work queue */
static struct workqueue_struct *shrink_wq;
@@ -1568,10 +1566,8 @@ bool zswap_store(struct folio *folio)
*/
spin_lock(&tree->lock);
entry = zswap_rb_search(&tree->rbroot, offset);
- if (entry) {
+ if (entry)
zswap_invalidate_entry(tree, entry);
- zswap_duplicate_entry++;
- }
spin_unlock(&tree->lock);
if (!zswap_enabled)
@@ -1662,7 +1658,6 @@ insert_entry:
*/
while (zswap_rb_insert(&tree->rbroot, entry, &dupentry) == -EEXIST) {
WARN_ON(1);
- zswap_duplicate_entry++;
zswap_invalidate_entry(tree, dupentry);
}
if (entry->length) {
@@ -1823,8 +1818,6 @@ static int zswap_debugfs_init(void)
zswap_debugfs_root, &zswap_reject_compress_poor);
debugfs_create_u64("written_back_pages", 0444,
zswap_debugfs_root, &zswap_written_back_pages);
- debugfs_create_u64("duplicate_entry", 0444,
- zswap_debugfs_root, &zswap_duplicate_entry);
debugfs_create_u64("pool_total_size", 0444,
zswap_debugfs_root, &zswap_pool_total_size);
debugfs_create_atomic_t("stored_pages", 0444,