* [PATCH] mm: page_alloc: Remove redundant READ_ONCE
@ 2025-04-02 7:41 Songtang Liu
2025-04-02 7:59 ` Qi Zheng
` (5 more replies)
0 siblings, 6 replies; 7+ messages in thread
From: Songtang Liu @ 2025-04-02 7:41 UTC (permalink / raw)
To: akpm, ying.huang
Cc: linux-mm, linux-kernel, zhengqi.arch, songmuchun, Songtang Liu
In the current code, batch is a local variable, and it cannot be
concurrently modified. It's unnecessary to use READ_ONCE here,
so remove it.
Fixes: 51a755c56dc0 ("mm: tune PCP high automatically")
Signed-off-by: Songtang Liu <liusongtang@bytedance.com>
---
mm/page_alloc.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index e3ea5bf5c459..6edc6e57d4f8 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -2661,7 +2661,7 @@ static void free_frozen_page_commit(struct zone *zone,
free_high = (pcp->free_count >= batch &&
(pcp->flags & PCPF_PREV_FREE_HIGH_ORDER) &&
(!(pcp->flags & PCPF_FREE_HIGH_BATCH) ||
- pcp->count >= READ_ONCE(batch)));
+ pcp->count >= batch));
pcp->flags |= PCPF_PREV_FREE_HIGH_ORDER;
} else if (pcp->flags & PCPF_PREV_FREE_HIGH_ORDER) {
pcp->flags &= ~PCPF_PREV_FREE_HIGH_ORDER;
--
2.20.1
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] mm: page_alloc: Remove redundant READ_ONCE
2025-04-02 7:41 [PATCH] mm: page_alloc: Remove redundant READ_ONCE Songtang Liu
@ 2025-04-02 7:59 ` Qi Zheng
2025-04-02 8:30 ` Huang, Ying
` (4 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: Qi Zheng @ 2025-04-02 7:59 UTC (permalink / raw)
To: Songtang Liu, akpm, ying.huang
Cc: linux-mm, linux-kernel, zhengqi.arch, songmuchun
On 4/2/25 3:41 PM, Songtang Liu wrote:
> In the current code, batch is a local variable, and it cannot be
> concurrently modified. It's unnecessary to use READ_ONCE here,
> so remove it.
>
> Fixes: 51a755c56dc0 ("mm: tune PCP high automatically")
> Signed-off-by: Songtang Liu <liusongtang@bytedance.com>
> ---
> mm/page_alloc.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/mm/page_alloc.c b/mm/page_alloc.c
> index e3ea5bf5c459..6edc6e57d4f8 100644
> --- a/mm/page_alloc.c
> +++ b/mm/page_alloc.c
> @@ -2661,7 +2661,7 @@ static void free_frozen_page_commit(struct zone *zone,
> free_high = (pcp->free_count >= batch &&
> (pcp->flags & PCPF_PREV_FREE_HIGH_ORDER) &&
> (!(pcp->flags & PCPF_FREE_HIGH_BATCH) ||
> - pcp->count >= READ_ONCE(batch)));
> + pcp->count >= batch));
> pcp->flags |= PCPF_PREV_FREE_HIGH_ORDER;
> } else if (pcp->flags & PCPF_PREV_FREE_HIGH_ORDER) {
> pcp->flags &= ~PCPF_PREV_FREE_HIGH_ORDER;
Reviewed-by: Qi Zheng <zhengqi.arch@bytedance.com>
Thanks!
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] mm: page_alloc: Remove redundant READ_ONCE
2025-04-02 7:41 [PATCH] mm: page_alloc: Remove redundant READ_ONCE Songtang Liu
2025-04-02 7:59 ` Qi Zheng
@ 2025-04-02 8:30 ` Huang, Ying
2025-04-02 8:53 ` Anshuman Khandual
` (3 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: Huang, Ying @ 2025-04-02 8:30 UTC (permalink / raw)
To: Songtang Liu; +Cc: akpm, linux-mm, linux-kernel, zhengqi.arch, songmuchun
Songtang Liu <liusongtang@bytedance.com> writes:
> In the current code, batch is a local variable, and it cannot be
> concurrently modified. It's unnecessary to use READ_ONCE here,
> so remove it.
>
> Fixes: 51a755c56dc0 ("mm: tune PCP high automatically")
> Signed-off-by: Songtang Liu <liusongtang@bytedance.com>
> ---
> mm/page_alloc.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/mm/page_alloc.c b/mm/page_alloc.c
> index e3ea5bf5c459..6edc6e57d4f8 100644
> --- a/mm/page_alloc.c
> +++ b/mm/page_alloc.c
> @@ -2661,7 +2661,7 @@ static void free_frozen_page_commit(struct zone *zone,
> free_high = (pcp->free_count >= batch &&
> (pcp->flags & PCPF_PREV_FREE_HIGH_ORDER) &&
> (!(pcp->flags & PCPF_FREE_HIGH_BATCH) ||
> - pcp->count >= READ_ONCE(batch)));
> + pcp->count >= batch));
Nice catch!
Reviewed-by: Huang Ying <ying.huang@linux.alibaba.com>
> pcp->flags |= PCPF_PREV_FREE_HIGH_ORDER;
> } else if (pcp->flags & PCPF_PREV_FREE_HIGH_ORDER) {
> pcp->flags &= ~PCPF_PREV_FREE_HIGH_ORDER;
---
Best Regards,
Huang, Ying
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] mm: page_alloc: Remove redundant READ_ONCE
2025-04-02 7:41 [PATCH] mm: page_alloc: Remove redundant READ_ONCE Songtang Liu
2025-04-02 7:59 ` Qi Zheng
2025-04-02 8:30 ` Huang, Ying
@ 2025-04-02 8:53 ` Anshuman Khandual
2025-04-02 9:27 ` Gupta, Pankaj
` (2 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: Anshuman Khandual @ 2025-04-02 8:53 UTC (permalink / raw)
To: Songtang Liu, akpm, ying.huang
Cc: linux-mm, linux-kernel, zhengqi.arch, songmuchun
On 4/2/25 13:11, Songtang Liu wrote:
> In the current code, batch is a local variable, and it cannot be
> concurrently modified. It's unnecessary to use READ_ONCE here,
> so remove it.
>
> Fixes: 51a755c56dc0 ("mm: tune PCP high automatically")
Although READ_ONCE() should not have been used here with the above
commit - does this cause any problem though ? So in other words is
the Fixes: tag necessary here ?
> Signed-off-by: Songtang Liu <liusongtang@bytedance.com>
> ---
> mm/page_alloc.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/mm/page_alloc.c b/mm/page_alloc.c
> index e3ea5bf5c459..6edc6e57d4f8 100644
> --- a/mm/page_alloc.c
> +++ b/mm/page_alloc.c
> @@ -2661,7 +2661,7 @@ static void free_frozen_page_commit(struct zone *zone,
> free_high = (pcp->free_count >= batch &&
> (pcp->flags & PCPF_PREV_FREE_HIGH_ORDER) &&
> (!(pcp->flags & PCPF_FREE_HIGH_BATCH) ||
> - pcp->count >= READ_ONCE(batch)));
> + pcp->count >= batch));
> pcp->flags |= PCPF_PREV_FREE_HIGH_ORDER;
> } else if (pcp->flags & PCPF_PREV_FREE_HIGH_ORDER) {
> pcp->flags &= ~PCPF_PREV_FREE_HIGH_ORDER;
Otherwise LGTM
Reviewed-by: Anshuman Khandual <anshuman.khandual@arm.com>
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] mm: page_alloc: Remove redundant READ_ONCE
2025-04-02 7:41 [PATCH] mm: page_alloc: Remove redundant READ_ONCE Songtang Liu
` (2 preceding siblings ...)
2025-04-02 8:53 ` Anshuman Khandual
@ 2025-04-02 9:27 ` Gupta, Pankaj
2025-04-02 9:32 ` Oscar Salvador
2025-04-02 19:01 ` Vishal Moola (Oracle)
5 siblings, 0 replies; 7+ messages in thread
From: Gupta, Pankaj @ 2025-04-02 9:27 UTC (permalink / raw)
To: Songtang Liu, akpm, ying.huang
Cc: linux-mm, linux-kernel, zhengqi.arch, songmuchun
> In the current code, batch is a local variable, and it cannot be
> concurrently modified. It's unnecessary to use READ_ONCE here,
> so remove it.
>
> Fixes: 51a755c56dc0 ("mm: tune PCP high automatically")
> Signed-off-by: Songtang Liu <liusongtang@bytedance.com>
Reviewed-by: Pankaj Gupta <pankaj.gupta@amd.com>
> ---
> mm/page_alloc.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/mm/page_alloc.c b/mm/page_alloc.c
> index e3ea5bf5c459..6edc6e57d4f8 100644
> --- a/mm/page_alloc.c
> +++ b/mm/page_alloc.c
> @@ -2661,7 +2661,7 @@ static void free_frozen_page_commit(struct zone *zone,
> free_high = (pcp->free_count >= batch &&
> (pcp->flags & PCPF_PREV_FREE_HIGH_ORDER) &&
> (!(pcp->flags & PCPF_FREE_HIGH_BATCH) ||
> - pcp->count >= READ_ONCE(batch)));
> + pcp->count >= batch));
> pcp->flags |= PCPF_PREV_FREE_HIGH_ORDER;
> } else if (pcp->flags & PCPF_PREV_FREE_HIGH_ORDER) {
> pcp->flags &= ~PCPF_PREV_FREE_HIGH_ORDER;
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] mm: page_alloc: Remove redundant READ_ONCE
2025-04-02 7:41 [PATCH] mm: page_alloc: Remove redundant READ_ONCE Songtang Liu
` (3 preceding siblings ...)
2025-04-02 9:27 ` Gupta, Pankaj
@ 2025-04-02 9:32 ` Oscar Salvador
2025-04-02 19:01 ` Vishal Moola (Oracle)
5 siblings, 0 replies; 7+ messages in thread
From: Oscar Salvador @ 2025-04-02 9:32 UTC (permalink / raw)
To: Songtang Liu
Cc: akpm, ying.huang, linux-mm, linux-kernel, zhengqi.arch, songmuchun
On Wed, Apr 02, 2025 at 03:41:16AM -0400, Songtang Liu wrote:
> In the current code, batch is a local variable, and it cannot be
> concurrently modified. It's unnecessary to use READ_ONCE here,
> so remove it.
>
> Fixes: 51a755c56dc0 ("mm: tune PCP high automatically")
> Signed-off-by: Songtang Liu <liusongtang@bytedance.com>
Reviewed-by: Oscar Salvador <osalvador@suse.de>
--
Oscar Salvador
SUSE Labs
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] mm: page_alloc: Remove redundant READ_ONCE
2025-04-02 7:41 [PATCH] mm: page_alloc: Remove redundant READ_ONCE Songtang Liu
` (4 preceding siblings ...)
2025-04-02 9:32 ` Oscar Salvador
@ 2025-04-02 19:01 ` Vishal Moola (Oracle)
5 siblings, 0 replies; 7+ messages in thread
From: Vishal Moola (Oracle) @ 2025-04-02 19:01 UTC (permalink / raw)
To: Songtang Liu
Cc: akpm, ying.huang, linux-mm, linux-kernel, zhengqi.arch, songmuchun
On Wed, Apr 02, 2025 at 03:41:16AM -0400, Songtang Liu wrote:
> In the current code, batch is a local variable, and it cannot be
> concurrently modified. It's unnecessary to use READ_ONCE here,
> so remove it.
>
> Fixes: 51a755c56dc0 ("mm: tune PCP high automatically")
> Signed-off-by: Songtang Liu <liusongtang@bytedance.com>
Reviewed-by: Vishal Moola (Oracle) <vishal.moola@gmail.com>
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2025-04-02 19:02 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-04-02 7:41 [PATCH] mm: page_alloc: Remove redundant READ_ONCE Songtang Liu
2025-04-02 7:59 ` Qi Zheng
2025-04-02 8:30 ` Huang, Ying
2025-04-02 8:53 ` Anshuman Khandual
2025-04-02 9:27 ` Gupta, Pankaj
2025-04-02 9:32 ` Oscar Salvador
2025-04-02 19:01 ` Vishal Moola (Oracle)
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox