From: Chris Li <chrisl@kernel.org>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: linux-kernel@vger.kernel.org, linux-mm@kvack.org,
Yosry Ahmed <yosryahmed@google.com>,
Nhat Pham <nphamcs@gmail.com>,
Johannes Weiner <hannes@cmpxchg.org>,
Chengming Zhou <zhouchengming@bytedance.com>,
Chris Li <chrisl@kernel.org>
Subject: [PATCH] zswap: initialize entry->pool on same filled entry
Date: Thu, 21 Mar 2024 16:53:17 -0700 [thread overview]
Message-ID: <20240321-zswap-fill-v1-1-b6180dbf7c27@kernel.org> (raw)
Current zswap will leave the entry->pool uninitialized if
the page is same filled. The entry->pool pointer can
contain data written by previous usage.
Initialize entry->pool to zero for the same filled zswap entry.
Signed-off-by: Chris Li <chrisl@kernel.org>
---
Per Yosry's suggestion to split out this clean up
from the zxwap rb tree to xarray patch.
https://lore.kernel.org/all/ZemDuW25YxjqAjm-@google.com/
---
mm/zswap.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/mm/zswap.c b/mm/zswap.c
index b31c977f53e9..f04a75a36236 100644
--- a/mm/zswap.c
+++ b/mm/zswap.c
@@ -1527,6 +1527,7 @@ bool zswap_store(struct folio *folio)
kunmap_local(src);
entry->length = 0;
entry->value = value;
+ entry->pool = 0;
atomic_inc(&zswap_same_filled_pages);
goto insert_entry;
}
---
base-commit: a824831a082f1d8f9b51a4c0598e633d38555fcf
change-id: 20240315-zswap-fill-f65f44574760
Best regards,
--
Chris Li <chrisl@kernel.org>
next reply other threads:[~2024-03-21 23:53 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-03-21 23:53 Chris Li [this message]
2024-03-21 23:56 ` [PATCH] zswap: initialize entry->pool on same filled entry Yosry Ahmed
2024-03-22 0:41 ` Chris Li
2024-03-22 3:19 ` Johannes Weiner
2024-03-22 13:35 ` Chris Li
2024-03-22 17:11 ` Johannes Weiner
2024-03-22 17:57 ` Chris Li
2024-03-22 18:58 ` Yosry Ahmed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240321-zswap-fill-v1-1-b6180dbf7c27@kernel.org \
--to=chrisl@kernel.org \
--cc=akpm@linux-foundation.org \
--cc=hannes@cmpxchg.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=nphamcs@gmail.com \
--cc=yosryahmed@google.com \
--cc=zhouchengming@bytedance.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.