All of lore.kernel.org
 help / color / mirror / Atom feed
From: Matthew Wilcox <willy@infradead.org>
To: yanghui <yanghui.def@bytedance.com>
Cc: akpm@linux-foundation.org, linux-mm@kvack.org, songmuchun@bytedance.com
Subject: Re: [PATCH] mm/mempolicy: fix a race between offset_il_node and mpol_rebind_task
Date: Fri, 13 Aug 2021 17:57:50 +0100	[thread overview]
Message-ID: <YRakjlObxOOYgfCw@casper.infradead.org> (raw)
In-Reply-To: <20210813164053.51481-1-yanghui.def@bytedance.com>

On Sat, Aug 14, 2021 at 12:40:53AM +0800, yanghui wrote:
> +++ b/mm/mempolicy.c
> @@ -193,7 +193,7 @@ static int mpol_new_interleave(struct mempolicy *pol, const nodemask_t *nodes)
>  {
>  	if (nodes_empty(*nodes))
>  		return -EINVAL;
> -	pol->nodes = *nodes;
> +	WRITE_ONCE(pol->nodes, *nodes);

typedef struct { DECLARE_BITMAP(bits, MAX_NUMNODES); } nodemask_t;

If MAX_NUMNODES is large enough, is WRITE_ONCE going to work?  It could
be 128 bits, and few architectures have an atomic 128-bit store
instruction.



  reply	other threads:[~2021-08-13 16:58 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-13 16:40 [PATCH] mm/mempolicy: fix a race between offset_il_node and mpol_rebind_task yanghui
2021-08-13 16:57 ` Matthew Wilcox [this message]
2021-08-14  2:37   ` Muchun Song
2021-08-14  3:11     ` Matthew Wilcox
2021-08-13 23:16 ` kernel test robot
2021-08-13 23:16   ` kernel test robot
2021-08-14  1:35   ` Nathan Chancellor
2021-08-14  1:35     ` Nathan Chancellor
2021-08-14  1:40 ` kernel test robot
2021-08-14  1:40   ` kernel test robot

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=YRakjlObxOOYgfCw@casper.infradead.org \
    --to=willy@infradead.org \
    --cc=akpm@linux-foundation.org \
    --cc=linux-mm@kvack.org \
    --cc=songmuchun@bytedance.com \
    --cc=yanghui.def@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 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.