linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: "Huang, Ying" <ying.huang@linux.alibaba.com>
To: Songtang Liu <liusongtang@bytedance.com>
Cc: akpm@linux-foundation.org,  linux-mm@kvack.org,
	linux-kernel@vger.kernel.org,  zhengqi.arch@bytedance.com,
	songmuchun@bytedance.com
Subject: Re: [PATCH] mm: page_alloc: Remove redundant READ_ONCE
Date: Wed, 02 Apr 2025 16:30:19 +0800	[thread overview]
Message-ID: <87wmc3ufs4.fsf@DESKTOP-5N7EMDA> (raw)
In-Reply-To: <CAA=HWd1kn01ym8YuVFuAqK2Ggq3itEGkqX8T6eCXs_C7tiv-Jw@mail.gmail.com> (Songtang Liu's message of "Wed, 2 Apr 2025 03:41:16 -0400")

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


  parent reply	other threads:[~2025-04-02  8:30 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-04-02  7:41 Songtang Liu
2025-04-02  7:59 ` Qi Zheng
2025-04-02  8:30 ` Huang, Ying [this message]
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)

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=87wmc3ufs4.fsf@DESKTOP-5N7EMDA \
    --to=ying.huang@linux.alibaba.com \
    --cc=akpm@linux-foundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=liusongtang@bytedance.com \
    --cc=songmuchun@bytedance.com \
    --cc=zhengqi.arch@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox