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]
Date:   Tue, 8 Aug 2023 11:08:36 +0800
From:   Miaohe Lin <linmiaohe@...wei.com>
To:     Matthew Wilcox <willy@...radead.org>
CC:     <akpm@...ux-foundation.org>, <linux-mm@...ck.org>,
        <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] mm: remove unneeded __meminit annotation

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.

> then it gets shunted off into a cold section.  So it seems like this
> patch strictly makes things worse.  But maybe I misunderstood.

What about add __cold annotation? Something like:

diff --git a/mm/vmscan.c b/mm/vmscan.c
index eb4db273bf7e..e27ffa22c70f 100644
--- a/mm/vmscan.c
+++ b/mm/vmscan.c
@@ -7902,7 +7902,7 @@ void __meminit kswapd_run(int nid)
  * Called by memory hotplug when all memory in a node is offlined.  Caller must
  * be holding mem_hotplug_begin/done().
  */
-void kswapd_stop(int nid)
+void __cold kswapd_stop(int nid)
 {
        pg_data_t *pgdat = NODE_DATA(nid);
        struct task_struct *kswapd;

Thanks.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ