* [PATCH 1/1] mm: silence data-race in update_hiwater_rss
@ 2025-09-26 9:24 Lance Yang
2025-09-26 9:46 ` Vlastimil Babka
2025-10-13 10:20 ` Lorenzo Stoakes
0 siblings, 2 replies; 3+ messages in thread
From: Lance Yang @ 2025-09-26 9:24 UTC (permalink / raw)
To: akpm
Cc: elver, Liam.Howlett, david, harry.yoo, jannh, linux-kernel,
linux-mm, lorenzo.stoakes, riel, syzkaller-bugs, vbabka,
syzbot+60192c8877d0bc92a92b, Lance Yang
From: Lance Yang <lance.yang@linux.dev>
KCSAN reports a data race on mm_cluster.hiwater_rss, which can be accessed
concurrently from various paths like page migration and memory unmapping
without synchronization.
Since hiwater_rss is a statistical field for accounting purposes, this data
race is benign. Annotate both the read and write accesses with data_race()
to make KCSAN happy.
Reported-by: syzbot+60192c8877d0bc92a92b@syzkaller.appspotmail.com
Closes: https://lore.kernel.org/linux-mm/68d6364e.050a0220.3390a8.000d.GAE@google.com
Signed-off-by: Lance Yang <lance.yang@linux.dev>
---
include/linux/mm.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/include/linux/mm.h b/include/linux/mm.h
index 6b6c6980f46c..dd93335e3a13 100644
--- a/include/linux/mm.h
+++ b/include/linux/mm.h
@@ -2757,7 +2757,7 @@ static inline void update_hiwater_rss(struct mm_struct *mm)
unsigned long _rss = get_mm_rss(mm);
if (data_race(mm->hiwater_rss) < _rss)
- (mm)->hiwater_rss = _rss;
+ data_race(mm->hiwater_rss = _rss);
}
static inline void update_hiwater_vm(struct mm_struct *mm)
--
2.49.0
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH 1/1] mm: silence data-race in update_hiwater_rss
2025-09-26 9:24 [PATCH 1/1] mm: silence data-race in update_hiwater_rss Lance Yang
@ 2025-09-26 9:46 ` Vlastimil Babka
2025-10-13 10:20 ` Lorenzo Stoakes
1 sibling, 0 replies; 3+ messages in thread
From: Vlastimil Babka @ 2025-09-26 9:46 UTC (permalink / raw)
To: Lance Yang, akpm
Cc: elver, Liam.Howlett, david, harry.yoo, jannh, linux-kernel,
linux-mm, lorenzo.stoakes, riel, syzkaller-bugs,
syzbot+60192c8877d0bc92a92b
On 9/26/25 11:24, Lance Yang wrote:
> From: Lance Yang <lance.yang@linux.dev>
>
> KCSAN reports a data race on mm_cluster.hiwater_rss, which can be accessed
> concurrently from various paths like page migration and memory unmapping
> without synchronization.
>
> Since hiwater_rss is a statistical field for accounting purposes, this data
> race is benign. Annotate both the read and write accesses with data_race()
> to make KCSAN happy.
>
> Reported-by: syzbot+60192c8877d0bc92a92b@syzkaller.appspotmail.com
> Closes: https://lore.kernel.org/linux-mm/68d6364e.050a0220.3390a8.000d.GAE@google.com
> Signed-off-by: Lance Yang <lance.yang@linux.dev>
Acked-by: Vlastimil Babka <vbabka@suse.cz>
> ---
> include/linux/mm.h | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/include/linux/mm.h b/include/linux/mm.h
> index 6b6c6980f46c..dd93335e3a13 100644
> --- a/include/linux/mm.h
> +++ b/include/linux/mm.h
> @@ -2757,7 +2757,7 @@ static inline void update_hiwater_rss(struct mm_struct *mm)
> unsigned long _rss = get_mm_rss(mm);
>
> if (data_race(mm->hiwater_rss) < _rss)
> - (mm)->hiwater_rss = _rss;
> + data_race(mm->hiwater_rss = _rss);
> }
>
> static inline void update_hiwater_vm(struct mm_struct *mm)
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH 1/1] mm: silence data-race in update_hiwater_rss
2025-09-26 9:24 [PATCH 1/1] mm: silence data-race in update_hiwater_rss Lance Yang
2025-09-26 9:46 ` Vlastimil Babka
@ 2025-10-13 10:20 ` Lorenzo Stoakes
1 sibling, 0 replies; 3+ messages in thread
From: Lorenzo Stoakes @ 2025-10-13 10:20 UTC (permalink / raw)
To: Lance Yang
Cc: akpm, elver, Liam.Howlett, david, harry.yoo, jannh, linux-kernel,
linux-mm, riel, syzkaller-bugs, vbabka,
syzbot+60192c8877d0bc92a92b
On Fri, Sep 26, 2025 at 05:24:26PM +0800, Lance Yang wrote:
> From: Lance Yang <lance.yang@linux.dev>
>
> KCSAN reports a data race on mm_cluster.hiwater_rss, which can be accessed
> concurrently from various paths like page migration and memory unmapping
> without synchronization.
>
> Since hiwater_rss is a statistical field for accounting purposes, this data
> race is benign. Annotate both the read and write accesses with data_race()
> to make KCSAN happy.
>
> Reported-by: syzbot+60192c8877d0bc92a92b@syzkaller.appspotmail.com
> Closes: https://lore.kernel.org/linux-mm/68d6364e.050a0220.3390a8.000d.GAE@google.com
> Signed-off-by: Lance Yang <lance.yang@linux.dev>
LGTM, so:
Reviewed-by: Lorenzo Stoakes <lorenzo.stoakes@oracle.com>
> ---
> include/linux/mm.h | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/include/linux/mm.h b/include/linux/mm.h
> index 6b6c6980f46c..dd93335e3a13 100644
> --- a/include/linux/mm.h
> +++ b/include/linux/mm.h
> @@ -2757,7 +2757,7 @@ static inline void update_hiwater_rss(struct mm_struct *mm)
> unsigned long _rss = get_mm_rss(mm);
>
> if (data_race(mm->hiwater_rss) < _rss)
> - (mm)->hiwater_rss = _rss;
> + data_race(mm->hiwater_rss = _rss);
> }
>
> static inline void update_hiwater_vm(struct mm_struct *mm)
> --
> 2.49.0
>
>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2025-10-13 10:20 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-09-26 9:24 [PATCH 1/1] mm: silence data-race in update_hiwater_rss Lance Yang
2025-09-26 9:46 ` Vlastimil Babka
2025-10-13 10:20 ` Lorenzo Stoakes
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox