Linux-mm Archive mirror
 help / color / mirror / Atom feed
From: Yang Shi <shy828301@gmail.com>
To: xu.xin16@zte.com.cn
Cc: akpm@linux-foundation.org, david@redhat.com, willy@infradead.org,
	 linux-kernel@vger.kernel.org, linux-mm@kvack.org,
	ziy@nvidia.com
Subject: Re:  [PATCH linux-next] mm/huge_memory: mark racy access on huge_anon_orders_always
Date: Mon, 13 May 2024 13:05:28 -0600	[thread overview]
Message-ID: <CAHbLzkqg=+Dq40-He5ZBCnzrXEJaBUfXtb2jjBoDKERpM-C07w@mail.gmail.com> (raw)
In-Reply-To: <20240511144436754EiKfJM4xjMSTyCbEExwcL@zte.com.cn>

On Sat, May 11, 2024 at 12:44 AM <xu.xin16@zte.com.cn> wrote:
>
> From: Ran Xiaokai <ran.xiaokai@zte.com.cn>
>
> huge_anon_orders_always and huge_anon_orders_always are accessed
> lockless, it is better to use the READ_ONCE() wrapper.
> This is not fixing any visible bug, hopefully this can cease some
> KCSAN complains in the future.

A little bit confused here. Did you see complaints from KCSAN?

> Also do that for huge_anon_orders_madvise.
>
> Signed-off-by: Ran Xiaokai <ran.xiaokai@zte.com.cn>
> ---
>  include/linux/huge_mm.h | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/include/linux/huge_mm.h b/include/linux/huge_mm.h
> index de0c89105076..6573430ea600 100644
> --- a/include/linux/huge_mm.h
> +++ b/include/linux/huge_mm.h
> @@ -122,8 +122,8 @@ static inline bool hugepage_flags_enabled(void)
>          * So we don't need to look at huge_anon_orders_inherit.
>          */
>         return hugepage_global_enabled() ||
> -              huge_anon_orders_always ||
> -              huge_anon_orders_madvise;
> +                       READ_ONCE(huge_anon_orders_always) ||
> +                       READ_ONCE(huge_anon_orders_madvise);
>  }
>
>  static inline int highest_order(unsigned long orders)
> --
> 2.15.2


      parent reply	other threads:[~2024-05-13 19:05 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-05-11  6:44 [PATCH linux-next] mm/huge_memory: mark racy access on huge_anon_orders_always xu.xin16
2024-05-13 16:00 ` David Hildenbrand
2024-05-13 19:05 ` Yang Shi [this message]

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='CAHbLzkqg=+Dq40-He5ZBCnzrXEJaBUfXtb2jjBoDKERpM-C07w@mail.gmail.com' \
    --to=shy828301@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=david@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=willy@infradead.org \
    --cc=xu.xin16@zte.com.cn \
    --cc=ziy@nvidia.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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).