lkml.org 
[lkml]   [2020]   [Dec]   [15]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [v2 PATCH 3/9] mm: vmscan: guarantee shrinker_slab_memcg() sees valid shrinker_maps for online memcg
On Mon, Dec 14, 2020 at 02:37:16PM -0800, Yang Shi wrote:
> The shrink_slab_memcg() races with mem_cgroup_css_online(). A visibility of CSS_ONLINE flag
> in shrink_slab_memcg()->mem_cgroup_online() does not guarantee that we will see
> memcg->nodeinfo[nid]->shrinker_maps != NULL. This may occur because of processor reordering
> on !x86.
>
> This seems like the below case:
>
> CPU A CPU B
> store shrinker_map load CSS_ONLINE
> store CSS_ONLINE load shrinker_map
>
> So the memory ordering could be guaranteed by smp_wmb()/smp_rmb() pair.
>
> The memory barriers pair will guarantee the ordering between shrinker_deferred and CSS_ONLINE
> for the following patches as well.
>
> Signed-off-by: Yang Shi <shy828301@gmail.com>

As per previous feedback, please move the misplaced shrinker
allocation callback from .css_online to .css_alloc. This will get you
the necessary ordering guarantees from the cgroup core code.

Thanks

\
 
 \ /
  Last update: 2020-12-15 13:44    [W:0.180 / U:0.268 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site