linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Miaohe Lin <linmiaohe@huawei.com>
To: Mike Rapoport <rppt@kernel.org>
Cc: <akpm@linux-foundation.org>, <tglx@linutronix.de>,
	<mingo@redhat.com>, <peterz@infradead.org>,
	<dvhart@infradead.org>, <dave@stgolabs.net>,
	<andrealmeid@igalia.com>, <linux-mm@kvack.org>,
	<linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] mm/mm_init.c: remove obsolete macro HASH_SMALL
Date: Mon, 19 Jun 2023 09:34:30 +0800	[thread overview]
Message-ID: <e9c0f02e-d848-1d7f-624d-311fe0368fc1@huawei.com> (raw)
In-Reply-To: <20230617105137.GX52412@kernel.org>

On 2023/6/17 18:51, Mike Rapoport wrote:
> On Sat, Jun 17, 2023 at 04:39:44PM +0800, Miaohe Lin wrote:
>> On 2023/6/17 15:56, Mike Rapoport wrote:
>>> On Sat, Jun 17, 2023 at 03:09:55PM +0800, Miaohe Lin wrote:
>>>> HASH_SMALL only works when parameter numentries is 0. But the sole caller
>>>> futex_init() never calls alloc_large_system_hash() with numentries set to
>>>> 0. 
>>>
>>
>> Thanks for your quick review.
>>
>>> Doesn't it? 
>>> What happens when CONFIG_BASE_SMALL is set?
>>
>> When CONFIG_BASE_SMALL is set, futex_hashsize is set to 16 and alloc_large_system_hash() is called with
>> numentries == 16 && flags == HASH_SMALL. But in the alloc_large_system_hash(), we have the below logic:
>>
>> alloc_large_system_hash()
>> {
>>   if (!numentries) { /* numentries == 16 here, so this code block is skipped. */
>>     ...
>>     if (unlikely(flags & HASH_SMALL)) { /* So as here. */
>>       ...
>>   }
>>   ...
>> }
>>
>> So HASH_SMALL is just unused. Or am I miss something?
> 
> You are right, I've missed that. 
> 
>> Thanks.
>>
>>>
>>>> So HASH_SMALL is obsolete and remove it.
>>>
>>>> Signed-off-by: Miaohe Lin <linmiaohe@huawei.com>
>>>> ---
>>>>  include/linux/memblock.h |  2 --
>>>>  kernel/futex/core.c      |  3 +--
>>>>  mm/mm_init.c             | 10 +---------
>>>>  3 files changed, 2 insertions(+), 13 deletions(-)
>>>>
>>>> diff --git a/include/linux/memblock.h b/include/linux/memblock.h
>>>> index f71ff9f0ec81..346d80809517 100644
>>>> --- a/include/linux/memblock.h
>>>> +++ b/include/linux/memblock.h
>>>> @@ -581,8 +581,6 @@ extern void *alloc_large_system_hash(const char *tablename,
>>>>  				     unsigned long high_limit);
>>>>  
>>>>  #define HASH_EARLY	0x00000001	/* Allocating during early boot? */
>>>> -#define HASH_SMALL	0x00000002	/* sub-page allocation allowed, min
>>>> -					 * shift passed via *_hash_shift */
>>>>  #define HASH_ZERO	0x00000004	/* Zero allocated hash table */
> 
> Can you update HASH_ZERO to 0x2?

Will do. Thanks.


      reply	other threads:[~2023-06-19  1:34 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-06-17  7:09 Miaohe Lin
2023-06-17  7:56 ` Mike Rapoport
2023-06-17  8:39   ` Miaohe Lin
2023-06-17 10:51     ` Mike Rapoport
2023-06-19  1:34       ` Miaohe Lin [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=e9c0f02e-d848-1d7f-624d-311fe0368fc1@huawei.com \
    --to=linmiaohe@huawei.com \
    --cc=akpm@linux-foundation.org \
    --cc=andrealmeid@igalia.com \
    --cc=dave@stgolabs.net \
    --cc=dvhart@infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mingo@redhat.com \
    --cc=peterz@infradead.org \
    --cc=rppt@kernel.org \
    --cc=tglx@linutronix.de \
    /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