Skip to content

Commit

Permalink
mm/slub: mark racy access on slab->freelist
Browse files Browse the repository at this point in the history
In deactivate_slab(), slab->freelist can be changed concurrently. Mark
data race on slab->freelist as benign using READ_ONCE.

This patch is aimed at reducing the number of benign races reported by
KCSAN in order to focus future debugging effort on harmful races.

Signed-off-by: linke li <lilinke99@qq.com>
Signed-off-by: Vlastimil Babka <vbabka@suse.cz>
  • Loading branch information
linke li authored and Vlastimil Babka committed May 2, 2024
1 parent b3d8a8e commit 844776c
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion mm/slub.c
Original file line number Diff line number Diff line change
Expand Up @@ -2806,7 +2806,7 @@ static void deactivate_slab(struct kmem_cache *s, struct slab *slab,
struct slab new;
struct slab old;

if (slab->freelist) {
if (READ_ONCE(slab->freelist)) {
stat(s, DEACTIVATE_REMOTE_FREES);
tail = DEACTIVATE_TO_TAIL;
}
Expand Down

0 comments on commit 844776c

Please sign in to comment.