* [PATCH] mm: zswap: remove dead length check in zswap_store_page()
@ 2026-11-23 3:25 Mohamad Raizudeen
2026-11-23 16:20 ` Yosry Ahmed
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Mohamad Raizudeen @ 2026-11-23 3:25 UTC (permalink / raw)
To: chengming.zhou, yosry
Cc: hannes, nphamcs, akpm, linux-mm, linux-kernel, Mohamad Raizudeen
zswap_compress() never succeeds with entry->length == 0, so the
condition is always true. Remove it.
Signed-off-by: Mohamad Raizudeen <raizudeen.kerneldev@gmail.com>
---
mm/zswap.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/mm/zswap.c b/mm/zswap.c
index ae19e301fced..9590f333d83f 100644
--- a/mm/zswap.c
+++ b/mm/zswap.c
@@ -1509,10 +1509,8 @@ static bool zswap_store_page(struct folio *folio, long index,
entry->swpentry = page_swpentry;
entry->objcg = objcg;
entry->referenced = true;
- if (entry->length) {
- INIT_LIST_HEAD(&entry->lru);
- zswap_lru_add(entry);
- }
+ INIT_LIST_HEAD(&entry->lru);
+ zswap_lru_add(entry);
return true;
--
2.53.0
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: [PATCH] mm: zswap: remove dead length check in zswap_store_page()
2026-11-23 3:25 [PATCH] mm: zswap: remove dead length check in zswap_store_page() Mohamad Raizudeen
@ 2026-11-23 16:20 ` Yosry Ahmed
2026-11-23 16:26 ` Joshua Hahn
2026-11-23 17:16 ` Nhat Pham
2 siblings, 0 replies; 4+ messages in thread
From: Yosry Ahmed @ 2026-11-23 16:20 UTC (permalink / raw)
To: Mohamad Raizudeen
Cc: chengming.zhou, hannes, nphamcs, akpm, linux-mm, linux-kernel
On Sun, Nov 22, 2026 at 7:25 PM Mohamad Raizudeen
<raizudeen.kerneldev@gmail.com> wrote:
>
> zswap_compress() never succeeds with entry->length == 0, so the
> condition is always true. Remove it.
It's probably a remnant of same-filled pages that was not dropped in
commit 20a5532ffa53 ("mm: remove code to handle same filled pages").
>
> Signed-off-by: Mohamad Raizudeen <raizudeen.kerneldev@gmail.com>
Acked-by: Yosry Ahmed <yosry@kernel.org>
> ---
> mm/zswap.c | 6 ++----
> 1 file changed, 2 insertions(+), 4 deletions(-)
>
> diff --git a/mm/zswap.c b/mm/zswap.c
> index ae19e301fced..9590f333d83f 100644
> --- a/mm/zswap.c
> +++ b/mm/zswap.c
> @@ -1509,10 +1509,8 @@ static bool zswap_store_page(struct folio *folio, long index,
> entry->swpentry = page_swpentry;
> entry->objcg = objcg;
> entry->referenced = true;
> - if (entry->length) {
> - INIT_LIST_HEAD(&entry->lru);
> - zswap_lru_add(entry);
> - }
> + INIT_LIST_HEAD(&entry->lru);
> + zswap_lru_add(entry);
>
> return true;
>
> --
> 2.53.0
>
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: [PATCH] mm: zswap: remove dead length check in zswap_store_page()
2026-11-23 3:25 [PATCH] mm: zswap: remove dead length check in zswap_store_page() Mohamad Raizudeen
2026-11-23 16:20 ` Yosry Ahmed
@ 2026-11-23 16:26 ` Joshua Hahn
2026-11-23 17:16 ` Nhat Pham
2 siblings, 0 replies; 4+ messages in thread
From: Joshua Hahn @ 2026-11-23 16:26 UTC (permalink / raw)
To: Mohamad Raizudeen
Cc: chengming.zhou, yosry, hannes, nphamcs, akpm, linux-mm, linux-kernel
On Mon, Nov 23, 2026 at 08:55:12AM +0530, Mohamad Raizudeen wrote:
> zswap_compress() never succeeds with entry->length == 0, so the
> condition is always true. Remove it.
Hi Mohamad, nice catch! Looks right to me:
Reviewed-by: Joshua Hahn <joshua.hahnjy@gmail.com>
> Signed-off-by: Mohamad Raizudeen <raizudeen.kerneldev@gmail.com>
> ---
> mm/zswap.c | 6 ++----
> 1 file changed, 2 insertions(+), 4 deletions(-)
>
> diff --git a/mm/zswap.c b/mm/zswap.c
> index ae19e301fced..9590f333d83f 100644
> --- a/mm/zswap.c
> +++ b/mm/zswap.c
> @@ -1509,10 +1509,8 @@ static bool zswap_store_page(struct folio *folio, long index,
> entry->swpentry = page_swpentry;
> entry->objcg = objcg;
> entry->referenced = true;
> - if (entry->length) {
> - INIT_LIST_HEAD(&entry->lru);
> - zswap_lru_add(entry);
> - }
> + INIT_LIST_HEAD(&entry->lru);
> + zswap_lru_add(entry);
>
> return true;
>
> --
> 2.53.0
>
>
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: [PATCH] mm: zswap: remove dead length check in zswap_store_page()
2026-11-23 3:25 [PATCH] mm: zswap: remove dead length check in zswap_store_page() Mohamad Raizudeen
2026-11-23 16:20 ` Yosry Ahmed
2026-11-23 16:26 ` Joshua Hahn
@ 2026-11-23 17:16 ` Nhat Pham
2 siblings, 0 replies; 4+ messages in thread
From: Nhat Pham @ 2026-11-23 17:16 UTC (permalink / raw)
To: Mohamad Raizudeen
Cc: chengming.zhou, yosry, hannes, akpm, linux-mm, linux-kernel
On Sun, Nov 22, 2026 at 8:25 PM Mohamad Raizudeen
<raizudeen.kerneldev@gmail.com> wrote:
>
> zswap_compress() never succeeds with entry->length == 0, so the
> condition is always true. Remove it.
>
> Signed-off-by: Mohamad Raizudeen <raizudeen.kerneldev@gmail.com>
> ---
> mm/zswap.c | 6 ++----
> 1 file changed, 2 insertions(+), 4 deletions(-)
>
> diff --git a/mm/zswap.c b/mm/zswap.c
> index ae19e301fced..9590f333d83f 100644
> --- a/mm/zswap.c
> +++ b/mm/zswap.c
> @@ -1509,10 +1509,8 @@ static bool zswap_store_page(struct folio *folio, long index,
> entry->swpentry = page_swpentry;
> entry->objcg = objcg;
> entry->referenced = true;
> - if (entry->length) {
> - INIT_LIST_HEAD(&entry->lru);
> - zswap_lru_add(entry);
> - }
> + INIT_LIST_HEAD(&entry->lru);
> + zswap_lru_add(entry);
Acked-by: Nhat Pham <nphamcs@gmail.com>
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2026-11-23 17:16 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-23 3:25 [PATCH] mm: zswap: remove dead length check in zswap_store_page() Mohamad Raizudeen
2026-11-23 16:20 ` Yosry Ahmed
2026-11-23 16:26 ` Joshua Hahn
2026-11-23 17:16 ` Nhat Pham
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®