[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20230417123740.GP25053@google.com>
Date: Mon, 17 Apr 2023 21:37:40 +0900
From: Sergey Senozhatsky <senozhatsky@...omium.org>
To: Yosry Ahmed <yosryahmed@...gle.com>
Cc: Sergey Senozhatsky <senozhatsky@...omium.org>,
Minchan Kim <minchan@...nel.org>,
Andrew Morton <akpm@...ux-foundation.org>,
linux-kernel@...r.kernel.org, linux-mm@...ck.org
Subject: Re: [PATCH] zsmalloc: allow only one active pool compaction context
Hi,
On (23/04/17 04:53), Yosry Ahmed wrote:
> > Introduce pool compaction mutex and permit only one compaction
> > context at a time.
>
> I am not sure what's the best practice here, but if the only use of
> the mutex is a trylock, do we need a mutex here? It seems like a
> simple atomic would do the trick. Perhaps something like:
>
> static atomic_t ongoing_compaction = ATOMIC_INIT(0);
> ...
> if (atomic_xchg(&ongoing_compaction, 1))
> return;
> ....
> atomic_set(&ongoing_compaction, 0);
Looks good to me. Will switch to atomic_t in v2.
Powered by blists - more mailing lists