From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 908F1EB64DD for ; Tue, 8 Aug 2023 03:28:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231143AbjHHD2d (ORCPT ); Mon, 7 Aug 2023 23:28:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49304 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231533AbjHHD2F (ORCPT ); Mon, 7 Aug 2023 23:28:05 -0400 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 18B8010F6 for ; Mon, 7 Aug 2023 20:26:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=9ee8YYW05CME00ewErNo+UK3igS6KjVnj9z96msv9rA=; b=az3Vx6msxNlYZ1nos7n6Svx9AH p/4XOlHlGWxK3iRcHiHgw1n+jK2cbUQLPZY7FkSSyUQ/JvyME+JSGn3mGuXDn7sLDhvp89o6cHcor 4+CegyF9ccoXkS8FL+QHFBeXU+DZD3a3mEbhpX7Bqd7VqLpok2TtJm7cIjRzH251AJ24IRCt6yykm lIIsstxXAUtDnZgfD/+8Lkl9ENYvQhO0PZwVU8bDmhVEqpWwutNyJL26a06qw/zGqw62HXF1zswbG ISkq0ueA5lvd9DzRA85O2Rov/lP8mgkaRLun+O0OrMeRYXmggp2nal6XWeI5cxiL29m7PXLxjCZcM A0tkbL4g==; Received: from willy by casper.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1qTDMu-00F6HF-D9; Tue, 08 Aug 2023 03:26:48 +0000 Date: Tue, 8 Aug 2023 04:26:48 +0100 From: Matthew Wilcox To: Miaohe Lin Cc: akpm@linux-foundation.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] mm: remove unneeded __meminit annotation Message-ID: References: <20230808015831.608454-1-linmiaohe@huawei.com> <308f326d-c7ae-be49-22af-189a81a89aa2@huawei.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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. 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 So yeah, I think this patch is garbage.