From: Miaohe Lin <linmiaohe@huawei.com>
To: Matthew Wilcox <willy@infradead.org>
Cc: <akpm@linux-foundation.org>, <linux-mm@kvack.org>,
<linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] mm: remove unneeded __meminit annotation
Date: Tue, 8 Aug 2023 14:10:43 +0800 [thread overview]
Message-ID: <68b73067-59bf-e25f-448f-79ec60fc6639@huawei.com> (raw)
In-Reply-To: <ZNG1+PV5nG8YZDev@casper.infradead.org>
On 2023/8/8 11:26, Matthew Wilcox wrote:
> On Tue, Aug 08, 2023 at 04:16:57AM +0100, Matthew Wilcox wrote:
>> On Tue, Aug 08, 2023 at 11:08:36AM +0800, Miaohe Lin wrote:
>>> On 2023/8/8 10:31, Matthew Wilcox wrote:
>>>> On Tue, Aug 08, 2023 at 09:58:31AM +0800, Miaohe Lin wrote:
>>>>> kswapd_stop() and kcompactd_stop() are only called when MEMORY_HOTREMOVE
>>>>> is enabled. So wrap them under CONFIG_MEMORY_HOTREMOVE and further remove
>>>>> __meminit annotation. No functional change intended.
>>>>
>>>> I don't understand why this is an improvement. If CONFIG_MEMORY_HOTREMOVE
>>>> is disabled, the linker drops this section (... right?) If it's enabled,
>>>
>>> When CONFIG_MEMORY_HOTREMOVE is disabled, without this patch:
>>>
>>> size mm/compaction.o
>>> text data bss dec hex filename
>>> 103164 30873 0 134037 20b95 mm/compaction.o
>>>
>>> size mm/vmscan.o
>>> text data bss dec hex filename
>>> 158775 49612 64 208451 32e43 mm/vmscan.o
>>>
>>> while with this patch:
>>>
>>> size mm/compaction.o
>>> text data bss dec hex filename
>>> 102915 30865 0 133780 20a94 mm/compaction.o
>>>
>>> size mm/vmscan.o
>>> text data bss dec hex filename
>>> 158534 49604 64 208202 32d4a mm/vmscan.o
>>>
>>> We can reduce each .o by ~250 bytes.
>>
>> But this is before the linker step! That will be where the meminit
>> sections get dropped. Assuming they are; I haven't verified. You need
>> to compare before/after of the vmlinux, not the individual .o files.
When CONFIG_MEMORY_HOTREMOVE is disabled, without patch:
size vmlinux
text data bss dec hex filename
70648396 21668938 17985540 110302874 693169a vmlinux
while with patch:
size vmlinux
text data bss dec hex filename
70648128 21668938 17985540 110302606 693158e vmlinux
vmlinux is still reduced by 268 bytes.
>
> Ah, found it:
>
> #if defined(CONFIG_MEMORY_HOTPLUG)
> #define MEM_KEEP(sec) *(.mem##sec)
> #define MEM_DISCARD(sec)
> #else
> #define MEM_KEEP(sec)
> #define MEM_DISCARD(sec) *(.mem##sec)
> #endif
>
> in include/asm-generic/vmlinux.lds.h
When CONFIG_MEMORY_HOTREMOVE is disabled, without this patch, kswapd_stop() and kcompactd_stop()
are dropped after system init.
But no insist in this patch.
Thanks for your comment.
prev parent reply other threads:[~2023-08-08 6:10 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-08-08 1:58 Miaohe Lin
2023-08-08 2:31 ` Matthew Wilcox
2023-08-08 3:08 ` Miaohe Lin
2023-08-08 3:16 ` Matthew Wilcox
2023-08-08 3:26 ` Matthew Wilcox
2023-08-08 6:10 ` 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=68b73067-59bf-e25f-448f-79ec60fc6639@huawei.com \
--to=linmiaohe@huawei.com \
--cc=akpm@linux-foundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=willy@infradead.org \
/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