[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <061405e5-8670-2873-9b6f-0f152863adfc@gentwo.org>
Date: Tue, 2 Sep 2025 10:39:54 -0700 (PDT)
From: "Christoph Lameter (Ampere)" <cl@...two.org>
To: Vlad Dumitrescu <vdumitrescu@...dia.com>
cc: Dennis Zhou <dennis@...nel.org>, Tejun Heo <tj@...nel.org>,
Baoquan He <bhe@...hat.com>, Andrew Morton <akpm@...ux-foundation.org>,
linux-mm@...ck.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] percpu: fix race on alloc failed warning limit
On Fri, 22 Aug 2025, Vlad Dumitrescu wrote:
> + if (do_warn && atomic_read(&warn_limit) > 0) {
> + int remaining = atomic_dec_return(&warn_limit);
The code creates a race condition since another atomic_dec_return() can
happen on another cpu between these two lines. warn_limit can go negative.
Use a single atomic operation instead?
Powered by blists - more mailing lists