All of lore.kernel.org
 help / color / mirror / Atom feed
* [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
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ 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 related	[flat|nested] 6+ 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
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ 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] 6+ 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:06 ` + mm-zswap-remove-dead-length-check-in-zswap_store_page.patch added to mm-new branch Andrew Morton
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ 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] 6+ messages in thread

* + mm-zswap-remove-dead-length-check-in-zswap_store_page.patch added to mm-new branch
  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:06 ` Andrew Morton
  2026-11-23 17:16 ` [PATCH] mm: zswap: remove dead length check in zswap_store_page() Nhat Pham
  2026-11-24  1:21 ` SJ Park
  4 siblings, 0 replies; 6+ messages in thread
From: Andrew Morton @ 2026-11-23 17:06 UTC (permalink / raw)
  To: mm-commits, yosry, nphamcs, joshua.hahnjy, hannes, chengming.zhou,
	raizudeen.kerneldev, akpm


The patch titled
     Subject: mm: zswap: remove dead length check in zswap_store_page()
has been added to the -mm mm-new branch.  Its filename is
     mm-zswap-remove-dead-length-check-in-zswap_store_page.patch

This patch will shortly appear at
     https://git.kernel.org/pub/scm/linux/kernel/git/akpm/25-new.git/tree/patches/mm-zswap-remove-dead-length-check-in-zswap_store_page.patch

This patch will later appear in the mm-new branch at
    git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm

Note, mm-new is a provisional staging ground for work-in-progress
patches, and acceptance into mm-new is a notification for others take
notice and to finish up reviews.  Please do not hesitate to respond to
review feedback and post updated versions to replace or incrementally
fixup patches in mm-new.

The mm-new branch of mm.git is not included in linux-next

If a few days of testing in mm-new is successful, the patch will me moved
into mm.git's mm-unstable branch, which is included in linux-next

Before you just go and hit "reply", please:
   a) Consider who else should be cc'ed
   b) Prefer to cc a suitable mailing list as well
   c) Ideally: find the original patch on the mailing list and do a
      reply-to-all to that, adding suitable additional cc's

*** Remember to use Documentation/process/submit-checklist.rst when testing your code ***

The -mm tree is included into linux-next via various
branches at git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
and is updated there most days

------------------------------------------------------
From: Mohamad Raizudeen <raizudeen.kerneldev@gmail.com>
Subject: mm: zswap: remove dead length check in zswap_store_page()
Date: Mon, 23 Nov 2026 08:55:12 +0530

zswap_compress() never succeeds with entry->length == 0, so the condition
is always true.  Remove it.

Link: https://patch.msgid.link/20261123032512.6119-1-raizudeen.kerneldev@gmail.com
Signed-off-by: Mohamad Raizudeen <raizudeen.kerneldev@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Reviewed-by: Joshua Hahn <joshua.hahnjy@gmail.com>
Acked-by: Yosry Ahmed <yosry@kernel.org>
Cc: Chengming Zhou <chengming.zhou@linux.dev>
Cc: Johannes Weiner <hannes@cmpxchg.org>
Cc: Nhat Pham <nphamcs@gmail.com>

 mm/zswap.c |    6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

--- a/mm/zswap.c~mm-zswap-remove-dead-length-check-in-zswap_store_page
+++ a/mm/zswap.c
@@ -1597,10 +1597,8 @@ static bool zswap_store_page(struct foli
 	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;
 
_

Patches currently in -mm which might be from raizudeen.kerneldev@gmail.com are

mm-zswap-remove-dead-length-check-in-zswap_store_page.patch


^ permalink raw reply	[flat|nested] 6+ 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
                   ` (2 preceding siblings ...)
  2026-11-23 17:06 ` + mm-zswap-remove-dead-length-check-in-zswap_store_page.patch added to mm-new branch Andrew Morton
@ 2026-11-23 17:16 ` Nhat Pham
  2026-11-24  1:21 ` SJ Park
  4 siblings, 0 replies; 6+ 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] 6+ 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
                   ` (3 preceding siblings ...)
  2026-11-23 17:16 ` [PATCH] mm: zswap: remove dead length check in zswap_store_page() Nhat Pham
@ 2026-11-24  1:21 ` SJ Park
  4 siblings, 0 replies; 6+ messages in thread
From: SJ Park @ 2026-11-24  1:21 UTC (permalink / raw)
  To: Mohamad Raizudeen
  Cc: SJ Park, chengming.zhou, yosry, hannes, nphamcs, akpm, linux-mm,
	linux-kernel

On Mon, 23 Nov 2026 08:55:12 +0530 Mohamad Raizudeen <raizudeen.kerneldev@gmail.com> wrote:

> zswap_compress() never succeeds with entry->length == 0, so the
> condition is always true. Remove it.

Makes sense to me.

> 
> Signed-off-by: Mohamad Raizudeen <raizudeen.kerneldev@gmail.com>

Reviewed-by: SJ Park <sj@kernel.org>


Thanks,
SJ

[...]

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2026-11-24  1:21 UTC | newest]

Thread overview: 6+ 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:06 ` + mm-zswap-remove-dead-length-check-in-zswap_store_page.patch added to mm-new branch Andrew Morton
2026-11-23 17:16 ` [PATCH] mm: zswap: remove dead length check in zswap_store_page() Nhat Pham
2026-11-24  1:21 ` SJ Park

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.