* [PATCH] mm: zswap: remove unnecessary check in zswap_find_zpool()
@ 2024-03-11 23:52 Yosry Ahmed
2024-03-12 4:57 ` Chengming Zhou
` (2 more replies)
0 siblings, 3 replies; 5+ messages in thread
From: Yosry Ahmed @ 2024-03-11 23:52 UTC (permalink / raw)
To: Andrew Morton
Cc: Johannes Weiner, Nhat Pham, Chengming Zhou, linux-mm,
linux-kernel, Yosry Ahmed
zswap_find_zpool() checks if ZSWAP_NR_ZPOOLS > 1, which is always true.
This is a remnant from a patch version that had ZSWAP_NR_ZPOOLS as a
config option and never made it upstream. Remove the unnecessary check.
Signed-off-by: Yosry Ahmed <yosryahmed@google.com>
---
mm/zswap.c | 7 +------
1 file changed, 1 insertion(+), 6 deletions(-)
diff --git a/mm/zswap.c b/mm/zswap.c
index 9a32377520827..c6267b5e0999a 100644
--- a/mm/zswap.c
+++ b/mm/zswap.c
@@ -884,12 +884,7 @@ static void zswap_entry_cache_free(struct zswap_entry *entry)
static struct zpool *zswap_find_zpool(struct zswap_entry *entry)
{
- int i = 0;
-
- if (ZSWAP_NR_ZPOOLS > 1)
- i = hash_ptr(entry, ilog2(ZSWAP_NR_ZPOOLS));
-
- return entry->pool->zpools[i];
+ return entry->pool->zpools[hash_ptr(entry, ilog2(ZSWAP_NR_ZPOOLS))];
}
/*
--
2.44.0.278.ge034bb2e1d-goog
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH] mm: zswap: remove unnecessary check in zswap_find_zpool()
2024-03-11 23:52 [PATCH] mm: zswap: remove unnecessary check in zswap_find_zpool() Yosry Ahmed
@ 2024-03-12 4:57 ` Chengming Zhou
2024-03-12 9:35 ` Nhat Pham
2024-03-12 19:17 ` Johannes Weiner
2 siblings, 0 replies; 5+ messages in thread
From: Chengming Zhou @ 2024-03-12 4:57 UTC (permalink / raw)
To: Yosry Ahmed, Andrew Morton
Cc: Johannes Weiner, Nhat Pham, linux-mm, linux-kernel
On 2024/3/12 07:52, Yosry Ahmed wrote:
> zswap_find_zpool() checks if ZSWAP_NR_ZPOOLS > 1, which is always true.
> This is a remnant from a patch version that had ZSWAP_NR_ZPOOLS as a
> config option and never made it upstream. Remove the unnecessary check.
>
> Signed-off-by: Yosry Ahmed <yosryahmed@google.com>
Looks good to me!
Reviewed-by: Chengming Zhou <chengming.zhou@linux.dev>
Thanks.
> ---
> mm/zswap.c | 7 +------
> 1 file changed, 1 insertion(+), 6 deletions(-)
>
> diff --git a/mm/zswap.c b/mm/zswap.c
> index 9a32377520827..c6267b5e0999a 100644
> --- a/mm/zswap.c
> +++ b/mm/zswap.c
> @@ -884,12 +884,7 @@ static void zswap_entry_cache_free(struct zswap_entry *entry)
>
> static struct zpool *zswap_find_zpool(struct zswap_entry *entry)
> {
> - int i = 0;
> -
> - if (ZSWAP_NR_ZPOOLS > 1)
> - i = hash_ptr(entry, ilog2(ZSWAP_NR_ZPOOLS));
> -
> - return entry->pool->zpools[i];
> + return entry->pool->zpools[hash_ptr(entry, ilog2(ZSWAP_NR_ZPOOLS))];
> }
>
> /*
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] mm: zswap: remove unnecessary check in zswap_find_zpool()
2024-03-11 23:52 [PATCH] mm: zswap: remove unnecessary check in zswap_find_zpool() Yosry Ahmed
2024-03-12 4:57 ` Chengming Zhou
@ 2024-03-12 9:35 ` Nhat Pham
2024-03-12 10:22 ` Yosry Ahmed
2024-03-12 19:17 ` Johannes Weiner
2 siblings, 1 reply; 5+ messages in thread
From: Nhat Pham @ 2024-03-12 9:35 UTC (permalink / raw)
To: Yosry Ahmed
Cc: Andrew Morton, Johannes Weiner, Chengming Zhou, linux-mm, linux-kernel
On Tue, Mar 12, 2024 at 6:52 AM Yosry Ahmed <yosryahmed@google.com> wrote:
>
> zswap_find_zpool() checks if ZSWAP_NR_ZPOOLS > 1, which is always true.
> This is a remnant from a patch version that had ZSWAP_NR_ZPOOLS as a
> config option and never made it upstream. Remove the unnecessary check.
Do we need a Fixes: tag for this? I guess it's not a bug hmmm.
>
> Signed-off-by: Yosry Ahmed <yosryahmed@google.com>
Reviewed-by: Nhat Pham <nphamcs@gmail.com>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] mm: zswap: remove unnecessary check in zswap_find_zpool()
2024-03-12 9:35 ` Nhat Pham
@ 2024-03-12 10:22 ` Yosry Ahmed
0 siblings, 0 replies; 5+ messages in thread
From: Yosry Ahmed @ 2024-03-12 10:22 UTC (permalink / raw)
To: Nhat Pham
Cc: Andrew Morton, Johannes Weiner, Chengming Zhou, linux-mm, linux-kernel
On Tue, Mar 12, 2024 at 2:35 AM Nhat Pham <nphamcs@gmail.com> wrote:
>
> On Tue, Mar 12, 2024 at 6:52 AM Yosry Ahmed <yosryahmed@google.com> wrote:
> >
> > zswap_find_zpool() checks if ZSWAP_NR_ZPOOLS > 1, which is always true.
> > This is a remnant from a patch version that had ZSWAP_NR_ZPOOLS as a
> > config option and never made it upstream. Remove the unnecessary check.
>
> Do we need a Fixes: tag for this? I guess it's not a bug hmmm.
The compiler should be producing the exact same code either way, so I
would say no. It's just a cleanup.
>
> >
> > Signed-off-by: Yosry Ahmed <yosryahmed@google.com>
>
> Reviewed-by: Nhat Pham <nphamcs@gmail.com>
Thanks!
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] mm: zswap: remove unnecessary check in zswap_find_zpool()
2024-03-11 23:52 [PATCH] mm: zswap: remove unnecessary check in zswap_find_zpool() Yosry Ahmed
2024-03-12 4:57 ` Chengming Zhou
2024-03-12 9:35 ` Nhat Pham
@ 2024-03-12 19:17 ` Johannes Weiner
2 siblings, 0 replies; 5+ messages in thread
From: Johannes Weiner @ 2024-03-12 19:17 UTC (permalink / raw)
To: Yosry Ahmed
Cc: Andrew Morton, Nhat Pham, Chengming Zhou, linux-mm, linux-kernel
On Mon, Mar 11, 2024 at 11:52:10PM +0000, Yosry Ahmed wrote:
> zswap_find_zpool() checks if ZSWAP_NR_ZPOOLS > 1, which is always true.
> This is a remnant from a patch version that had ZSWAP_NR_ZPOOLS as a
> config option and never made it upstream. Remove the unnecessary check.
>
> Signed-off-by: Yosry Ahmed <yosryahmed@google.com>
Acked-by: Johannes Weiner <hannes@cmpxchg.org>
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2024-03-12 19:17 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-03-11 23:52 [PATCH] mm: zswap: remove unnecessary check in zswap_find_zpool() Yosry Ahmed
2024-03-12 4:57 ` Chengming Zhou
2024-03-12 9:35 ` Nhat Pham
2024-03-12 10:22 ` Yosry Ahmed
2024-03-12 19:17 ` Johannes Weiner
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).