• Qian Cai's avatar
    mm/list_lru: fix a data race in list_lru_count_one · a1f45935
    Qian Cai authored
    struct list_lru_one l.nr_items could be accessed concurrently as noticed
    by KCSAN,
    
     BUG: KCSAN: data-race in list_lru_count_one / list_lru_isolate_move
    
     write to 0xffffa102789c4510 of 8 bytes by task 823 on cpu 39:
      list_lru_isolate_move+0xf9/0x130
      list_lru_isolate_move at mm/list_lru.c:180
      inode_lru_isolate+0x12b/0x2a0
      __list_lru_walk_one+0x122/0x3d0
      list_lru_walk_one+0x75/0xa0
      prune_icache_sb+0x8b/0xc0
      super_cache_scan+0x1b8/0x250
      do_shrink_slab+0x256/0x6d0
      shrink_slab+0x41b/0x4a0
      shrink_node+0x35c/0xd80
      balance_pgdat+0x652/0xd90
      kswapd+0x396/0x8d0
      kthread+0x1e0/0x200
      ret_from_fork+0x27/0x50
    
     read to 0xffffa102789c4510 of 8 bytes by task 6345 on cpu 56:
      list_lru_count_one+0x116/0x2f0
      list_lru_count_one at mm/list_lru.c:193
      super_cache_count+0xe8/0x170
      do_shrink_slab+0x95/0x6d0
      shrink_slab+0x41b/0x4a0
      shrink_node+0x35c/0xd80
      do_try_to_free_pages+0x1f7/0xa10
      try_to_free_pages+0x26c/0x5e0
      __alloc_pages_slowpa...
    a1f45935
list_lru.c 14.4 KB