lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
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

Powered by Openwall GNU/*/Linux Powered by OpenVZ