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] [thread-next>] [day] [month] [year] [list]
Message-ID: <1dc544a0-5c32-43dc-8f6c-d0bf130cecad@suse.cz>
Date: Tue, 27 Aug 2024 16:57:10 +0200
From: Vlastimil Babka <vbabka@...e.cz>
To: "Christoph Lameter (Ampere)" <cl@...two.org>, Yan Zhen <yanzhen@...o.com>
Cc: penberg@...nel.org, rientjes@...gle.com, iamjoonsoo.kim@....com,
 akpm@...ux-foundation.org, roman.gushchin@...ux.dev, 42.hyeyoo@...il.com,
 linux-mm@...ck.org, linux-kernel@...r.kernel.org,
 opensource.kernel@...o.com, Kees Cook <keescook@...omium.org>
Subject: Re: [PATCH v1] mm:slab:use kmem_cache_free() to free

On 8/27/24 16:49, Vlastimil Babka wrote:
> On 8/22/24 18:59, Christoph Lameter (Ampere) wrote:
>> On Thu, 22 Aug 2024, Yan Zhen wrote:
>> 
>>> The kmem_cache_alloc() is typically used to free memory allocated through
>>> the kernel memory cache (slab allocator).

oh but _alloc() is used to alloc, not free.

>> 
>> Well yes but since we removed SLOB we can use kfree() on any slab object.
>> 
>>> Using kmem_cache_free() for deallocation may be more reasonable.

so I've reworded the commit log a bit.

    mm, slab: use kmem_cache_free() to free from kmem_buckets_cache

    In kmem_buckets_create(), the kmem_buckets object is allocated by
    kmem_cache_alloc() from kmem_buckets_cache, but in the failure case,
    it's freed by kfree(), which is not wrong, but using kmem_cache_free()
    is the more common pattern, so use it.



>> It is more symmetric and looks better.
> 
> Right, added to slab/for-next, thanks.
> 
>> Reviewed-by: Christoph Lameter <cl@...ux.com>
> 


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ