[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <71416382-2e4c-5e03-df9c-265fda41c2de@suse.cz>
Date: Tue, 18 May 2021 11:28:17 +0200
From: Vlastimil Babka <vbabka@...e.cz>
To: Nathan Chancellor <nathan@...nel.org>,
Hyeonggon Yoo <42.hyeyoo@...il.com>
Cc: akpm@...ux-foundation.org, iamjoonsoo.kim@....com,
rientjes@...gle.com, penberg@...nel.org, cl@...ux.com,
linux-mm@...ck.org, linux-kernel@...r.kernel.org,
naresh.kamboju@...aro.org, clang-built-linux@...glegroups.com,
linux-next@...r.kernel.org, ndesaulniers@...gle.com,
lkft-triage@...ts.linaro.org, sfr@...b.auug.org.au, arnd@...db.de,
Marco Elver <elver@...gle.com>
Subject: Re: [PATCH v3] mm, slub: change run-time assertion in kmalloc_index()
to compile-time
On 5/18/21 2:43 AM, Nathan Chancellor wrote:
> On 5/17/2021 5:38 PM, Hyeonggon Yoo wrote:
>> On Sat, May 15, 2021 at 11:34:49PM -0700, Nathan Chancellor wrote:
>>> This should work I think:
>>
>> compiled well with clang-10.0.1, clang-11.0.0,
>> and gcc-10.2.0 with x86_64 default config.
>>
>> is the condition CONFIG_CLANG_VERSION > 110000,
>> not including 110000 it self?
Good spot.
> Ah sorry, that should definitely be >= :(
>
> That is what I get for writing an email that late... in reality, it probably
> won't matter due to the availability of 11.0.1 and 11.1.0 but it should
> absolutely be changed.
>
> I have not given Nick's patch a go yet but would something like this be
> acceptable?
Yes.
> If so, did you want me to send a formal fixup patch or did you want
> to send a v4? I have no personal preference.
At this point a fixup is the usual way. Andrew might squash it to the original
patch (also with Marco's fixup) before sending to Linus.
>>> diff --git a/include/linux/slab.h b/include/linux/slab.h
>>> index 9d316aac0aba..1b653266f2aa 100644
>>> --- a/include/linux/slab.h
>>> +++ b/include/linux/slab.h
>>> @@ -413,7 +413,7 @@ static __always_inline unsigned int
>>> __kmalloc_index(size_t size,
>>> if (size <= 16 * 1024 * 1024) return 24;
>>> if (size <= 32 * 1024 * 1024) return 25;
>>> - if (size_is_constant)
>>> + if ((IS_ENABLED(CONFIG_CC_IS_GCC) || CONFIG_CLANG_VERSION > 110000) &&
>>> size_is_constant)
>>> BUILD_BUG_ON_MSG(1, "unexpected size in kmalloc_index()");
>>> else
>>> BUG();
>
Powered by blists - more mailing lists