From: "Leizhen (ThunderTown)" <thunder.leizhen@huawei.com>
To: Vlastimil Babka <vbabka@suse.cz>,
Christoph Lameter <cl@linux.com>,
Pekka Enberg <penberg@kernel.org>,
David Rientjes <rientjes@google.com>,
Joonsoo Kim <iamjoonsoo.kim@lge.com>,
Andrew Morton <akpm@linux-foundation.org>,
Roman Gushchin <roman.gushchin@linux.dev>,
Hyeonggon Yoo <42.hyeyoo@gmail.com>, <linux-mm@kvack.org>,
<linux-kernel@vger.kernel.org>
Subject: Re: [PATCH 1/1] mm/slab: remove duplicate check in create_cache()
Date: Tue, 8 Oct 2024 11:29:31 +0800 [thread overview]
Message-ID: <bce65264-40f2-4b38-839f-e0d58eda03a8@huawei.com> (raw)
In-Reply-To: <4dadf9be-a349-4a19-ae9c-652ade9e2198@suse.cz>
On 2024/10/2 20:09, Vlastimil Babka wrote:
> On 8/21/24 05:26, Zhen Lei wrote:
>> The WARN_ON() check in static function create_cache() is done by its only
>> parent kmem_cache_create_usercopy() before calling it.
>> if (...
>> WARN_ON(size < usersize || size - usersize < useroffset))
>> usersize = useroffset = 0;
>> ...
>> s = create_cache(..., size, ..., useroffset, usersize, ...);
>>
>> Therefore, the WARN_ON() check in create_cache() can be safely removed.
>>
>> Signed-off-by: Zhen Lei <thunder.leizhen@huawei.com>
>
> Hi, sorry for the late reply.
It doesn't matter, because the compiler will optimize it. It just saves
the reader a little time.
> This code was heavily refactored as of 6.12-rc1. Can you check if it's still
> the case and send updated patch?
It is still there. I'll post v2 later.
> Thanks,
> Vlastimil
>
>> ---
>> mm/slab_common.c | 3 ---
>> 1 file changed, 3 deletions(-)
>>
>> diff --git a/mm/slab_common.c b/mm/slab_common.c
>> index 40b582a014b8f2f..3069c9095523484 100644
>> --- a/mm/slab_common.c
>> +++ b/mm/slab_common.c
>> @@ -210,9 +210,6 @@ static struct kmem_cache *create_cache(const char *name,
>> struct kmem_cache *s;
>> int err;
>>
>> - if (WARN_ON(useroffset + usersize > object_size))
>> - useroffset = usersize = 0;
>> -
>> err = -ENOMEM;
>> s = kmem_cache_zalloc(kmem_cache, GFP_KERNEL);
>> if (!s)
>
> .
>
--
Regards,
Zhen Lei
prev parent reply other threads:[~2024-10-08 3:29 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-08-21 3:26 Zhen Lei
2024-10-02 12:09 ` Vlastimil Babka
2024-10-08 3:29 ` Leizhen (ThunderTown) [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=bce65264-40f2-4b38-839f-e0d58eda03a8@huawei.com \
--to=thunder.leizhen@huawei.com \
--cc=42.hyeyoo@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=cl@linux.com \
--cc=iamjoonsoo.kim@lge.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=penberg@kernel.org \
--cc=rientjes@google.com \
--cc=roman.gushchin@linux.dev \
--cc=vbabka@suse.cz \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®