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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <cbbaa3f3-bbb2-4dab-8cd2-72a55df7a3a8@suse.cz>
Date: Mon, 17 Mar 2025 11:09:36 +0100
From: Vlastimil Babka <vbabka@...e.cz>
To: Suren Baghdasaryan <surenb@...gle.com>
Cc: "Liam R. Howlett" <Liam.Howlett@...cle.com>,
 Christoph Lameter <cl@...ux.com>, David Rientjes <rientjes@...gle.com>,
 Roman Gushchin <roman.gushchin@...ux.dev>,
 Hyeonggon Yoo <42.hyeyoo@...il.com>, Uladzislau Rezki <urezki@...il.com>,
 linux-mm@...ck.org, linux-kernel@...r.kernel.org, rcu@...r.kernel.org,
 maple-tree@...ts.infradead.org
Subject: Re: [PATCH RFC v2 01/10] slab: add opt-in caching layer of percpu
 sheaves

On 3/12/25 16:14, Suren Baghdasaryan wrote:
> On Wed, Mar 12, 2025 at 7:58 AM Vlastimil Babka <vbabka@...e.cz> wrote:
>> > I find the program flow in this function quite complex and hard to
>> > follow. I think refactoring the above block starting from "pcs =
>> > this_cpu_ptr(s->cpu_sheaves)" would somewhat simplify it. That
>> > eliminates the need for the "got_empty" label and makes the
>> > locking/unlocking sequence of s->cpu_sheaves->lock a bit more clear.
>>
>> I'm a bit lost, refactoring how exactly?
> 
> I thought moving the code above into a function above starting from
> "pcs = this_cpu_ptr(s->cpu_sheaves)" into its own function would
> simplify the flow. But as I said, it's a nit. If you try and don't
> like that feel free to ignore this suggestion.

OK did it and although I didn't manage to remove the got_empty label, it's
better and I realized I can handle the cases there in a better order and add
one extra possible fallback in the unlikely cases. Please check the result
when I send v3? thanks

>>
>> >> +       }
>> >> +
>> >> +do_free:
>> >> +       pcs->main->objects[pcs->main->size++] = object;
>> >> +
>> >> +       local_unlock_irqrestore(&s->cpu_sheaves->lock, flags);
>> >> +
>> >> +       stat(s, FREE_PCS);
>> >> +}


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ