All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@linux-foundation.org>
To: Qian Cai <cai@lca.pw>
Cc: elver@google.com, linux-mm@kvack.org,
	linux-kernel@vger.kernel.org,
	Paul E. McKenney <paulmck@kernel.org>
Subject: Re: [PATCH -next] mm/swap_state: mark various intentional data races
Date: Sun, 9 Feb 2020 18:00:53 -0800	[thread overview]
Message-ID: <20200209180053.784806e3bf028caa8bc584b3@linux-foundation.org> (raw)
In-Reply-To: <20200207003715.1578-1-cai@lca.pw>

On Thu,  6 Feb 2020 19:37:15 -0500 Qian Cai <cai@lca.pw> wrote:

> swap_cache_info.* could be accessed concurrently as noticed by
> KCSAN,
> 
>  BUG: KCSAN: data-race in lookup_swap_cache / lookup_swap_cache
> 
>  write to 0xffffffff85517318 of 8 bytes by task 94138 on cpu 101:
>   lookup_swap_cache+0x12e/0x460
>   lookup_swap_cache at mm/swap_state.c:322
>   do_swap_page+0x112/0xeb0
>   __handle_mm_fault+0xc7a/0xd00
>   handle_mm_fault+0xfc/0x2f0
>   do_page_fault+0x263/0x6f9
>   page_fault+0x34/0x40
> 
> ...
>
> --- a/mm/swap_state.c
> +++ b/mm/swap_state.c
> @@ -58,8 +58,8 @@ static bool enable_vma_readahead __read_mostly = true;
>  #define GET_SWAP_RA_VAL(vma)					\
>  	(atomic_long_read(&(vma)->swap_readahead_info) ? : 4)
>  
> -#define INC_CACHE_INFO(x)	do { swap_cache_info.x++; } while (0)
> -#define ADD_CACHE_INFO(x, nr)	do { swap_cache_info.x += (nr); } while (0)
> +#define INC_CACHE_INFO(x)	data_race(swap_cache_info.x++)
> +#define ADD_CACHE_INFO(x, nr)	data_race(swap_cache_info.x += (nr))

The data_race() macro appears to be stuck in Paul's linx-next tree. 
Can we expect this to be mainlined soon, or is there an issue?



  reply	other threads:[~2020-02-10  2:00 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-02-07  0:37 [PATCH -next] mm/swap_state: mark various intentional data races Qian Cai
2020-02-10  2:00 ` Andrew Morton [this message]
2020-02-10  2:56   ` Qian Cai
2020-02-10  4:03     ` Andrew Morton

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=20200209180053.784806e3bf028caa8bc584b3@linux-foundation.org \
    --to=akpm@linux-foundation.org \
    --cc=cai@lca.pw \
    --cc=elver@google.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=paulmck@kernel.org \
    /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.