[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <Y/UK2zRi+WNGrWEs@casper.infradead.org>
Date: Tue, 21 Feb 2023 18:18:03 +0000
From: Matthew Wilcox <willy@...radead.org>
To: Roman Gushchin <roman.gushchin@...ux.dev>
Cc: Shakeel Butt <shakeelb@...gle.com>, Yue Zhao <findns94@...il.com>,
linux-mm@...ck.org, akpm@...ux-foundation.org, hannes@...xchg.org,
mhocko@...nel.org, muchun.song@...ux.dev, cgroups@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH] mm: change memcg->oom_group access with atomic operations
On Tue, Feb 21, 2023 at 09:47:05AM -0800, Roman Gushchin wrote:
> > Wouldn't a compiler be within its rights to implement a one byte store as:
> >
> > load-word
> > modify-byte-in-word
> > store-word
> >
> > and if this is a lockless store to a word which has an adjacent byte also
> > being modified by another CPU, one of those CPUs can lose its store?
> > And WRITE_ONCE would prevent the compiler from implementing the store
> > in that way.
>
> Even then it's not an issue in this case, as we end up with either 0 or 1,
> I don't see how we can screw things up here.
Thread 1:
load word containing oom_group and oom_lock
Thread 2:
store to oom_lock
Thread 1:
store word containing oom_group and oom_lock
Thread 2's store has been lost.
Powered by blists - more mailing lists