Received: by 2002:ab2:6816:0:b0:1f9:5764:f03e with SMTP id t22csp2910479lqo; Tue, 21 May 2024 00:23:51 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUsmVbVbbjs19Ipaki3uA+L1McmjArrqe9EeNWb3HO9O2BVLXfyd71SG828SyB3ehJQqrBudXpXf0GJ5SJghVh74g4PtNeXeazDfE9z6Q== X-Google-Smtp-Source: AGHT+IGBW/py2OIZ+jfvI1a9kLIinmxkhm/s/kBbN0LckubARaAPoUmWf271Vb4tZ5XHxnnwhD20 X-Received: by 2002:a17:906:844a:b0:a62:c02:425a with SMTP id a640c23a62f3a-a620c0242dcmr115452066b.74.1716276231768; Tue, 21 May 2024 00:23:51 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1716276231; cv=pass; d=google.com; s=arc-20160816; b=pBg21yfevfdKx2XfSpJ8wbWlPlTYULP19qxLWHVp5jIeRMeV9PIw7mKaBGXNQCFYib P2bUK58ALipqUlHBc0QI9dq0fxxhESbzHzXYLlf6lxNBgJ0EiWTHc/IZ5wf+2DPyi7xP ENYslP6nmg5nzx6Y1+jx4PO7R4lIGxqLSgeOn8VtW5oNG1aCyArYrBdaHrrWPhK8KNp0 EOJvHgh+3lSoXt4Q4BeWm7Q2zu3UqWocEta43BUrzjs/rEyM+gbCVvUdmJWzr2asZNkV KRMUZBFIx5LawREcg9WC/mFJIQ/5ggwCTDSs+CzD/zcdOgp/jARbEVDDq3pkr387oyVS 762Q== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date:dkim-signature; bh=J+rPY1ML3X1lUPrHmixDWdkjBMvL2k8mOJWV6AHs1l0=; fh=c8Xnl3iRzJiPTveuAiyiGDXwn0RtaTwPkNEFEkBMscs=; b=DnjHX0xU3WC1uOZdhQa1meX5c1PCHR0ItCa1YRqXnE14eGCX4pb7Wi+mjCI5evA2ZU K/8vvEgRvuSOcSb/4g3GM2nK7h2cWYUUz0dVuK8V05ZQ/gbQ9x6PVy3+ABQifBA1XNVS o6RjLeQjtJ8CcQ4a1TX5CpjUMLwaU3cmexwx4Vd1v46ARpDEIxVPrg9LT97nQ6qCMMPv Ls0EAqzchhcRMLtjjZiZfaCs5Looi/aiRb68yTS1i4GRLxNzhJMQPWuTZJRApZjjW/PG 1jKfsKhZCRD0nPZwGfbBPc8wleMAjhGh83497+WxF3ZgtN/BIrVZQ47vGem1VEyJ+XNZ l8TQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=tIQ5nB50; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-184563-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-184563-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id a640c23a62f3a-a5a17bfd46csi1444930266b.874.2024.05.21.00.23.51 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 21 May 2024 00:23:51 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-184563-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=tIQ5nB50; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-184563-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-184563-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 470A51F22483 for ; Tue, 21 May 2024 07:23:51 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id A0A474F5FE; Tue, 21 May 2024 07:23:43 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="tIQ5nB50" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C5AE0179BD; Tue, 21 May 2024 07:23:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716276222; cv=none; b=eVEISVIrDh6et4+3H/EBsBQe4Oca+90ds0gVCLF5LzWSkx6bjPBaUb7h6Hs1LhxcS6u4FyzyEZib6GsWImi0KAlIzQpV2ifWGKyZdYIUcaf6ImOsoTyEsz5a3Ry8CYkvko3kWwmY2bzG6Rt6aM+Q/G25SUkfZzsQY2FPtiplBrM= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716276222; c=relaxed/simple; bh=g5ad6h6fsS1VZMljbHFZQxtWXnD0wuSkOgJPO8o+IWs=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=IGPa4/xQLZO2WToK3OYFwkBNG+KIoLFWMAPNc6ItfFHv9ft4ybS3rLZG2lSEyj/uUzTRIsSN3R8SmxeIwKtUgtqw1ilSyzHbVaNgswVIdw1P0DnoH9R6IWq6XL5KQPILARDpBM71XeQf1APIxDor8m9mgt+ALO7LbeIndp8Wcmw= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=tIQ5nB50; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id C6168C2BD11; Tue, 21 May 2024 07:23:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1716276222; bh=g5ad6h6fsS1VZMljbHFZQxtWXnD0wuSkOgJPO8o+IWs=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=tIQ5nB50A9fzy5aGKXStqGdhlcNXWJDoGm3vdmlYmeIA0Exsw9AAftpoIq0V5PD7P ojLOwe2a0aIn3HYTZAuur0MT4qKOMLOcd6jotkYJ0sQSqEYpAqlDmyr+SvVgkd5VhH rm/o95/zodJ0qYY9z3yHKKhiWK3ASNm4xAF+A1AlLnqSdMK+6s43pbz4z5SvtTkcu0 h8T3JC1arzq5w1Mdp03m4Tm+hSzqdcmo78juAHHutycjkQPjPjIQVhXQA+XzfoVfax b+eNncCUyc5BnkclrrbRVUmS6V6egan9JUCPSrp9exOdPg5hKAsKFbcqZbvrwBLfX4 s74zLa4/EuRKg== Date: Tue, 21 May 2024 10:21:52 +0300 From: Mike Rapoport To: Wei Yang Cc: mpe@ellerman.id.au, npiggin@gmail.com, christophe.leroy@csgroup.eu, aneesh.kumar@kernel.org, naveen.n.rao@linux.ibm.com, arnd@arndb.de, anshuman.khandual@arm.com, linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org, linux-arch@vger.kernel.org, linux-mm@kvack.org Subject: Re: [Patch v2] mm/memblock: discard .text/.data if CONFIG_ARCH_KEEP_MEMBLOCK not set Message-ID: References: <20240510020422.8038-1-richard.weiyang@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20240510020422.8038-1-richard.weiyang@gmail.com> Hi, On Fri, May 10, 2024 at 02:04:22AM +0000, Wei Yang wrote: > When CONFIG_ARCH_KEEP_MEMBLOCK not set, we expect to discard related > code and data. But it doesn't until CONFIG_MEMORY_HOTPLUG not set > neither. > > This patch puts memblock's .text/.data into its own section, so that it > only depends on CONFIG_ARCH_KEEP_MEMBLOCK to discard related code and > data. > > After this, from the log message in mem_init_print_info(), init size > increase from 2420K to 2432K on arch x86. > > Signed-off-by: Wei Yang > > --- > v2: fix orphan section for powerpc > --- > arch/powerpc/kernel/vmlinux.lds.S | 1 + > include/asm-generic/vmlinux.lds.h | 14 +++++++++++++- > include/linux/memblock.h | 8 ++++---- > 3 files changed, 18 insertions(+), 5 deletions(-) > > +#define __init_memblock __section(".mbinit.text") __cold notrace \ > + __latent_entropy > +#define __initdata_memblock __section(".mbinit.data") > + The new .mbinit.* sections should be added to scripts/mod/modpost.c alongside .meminit.* sections and then I expect modpost to report a bunch of section mismatches because many memblock functions are called on memory hotplug even on architectures that don't select ARCH_KEEP_MEMBLOCK. > #ifndef CONFIG_ARCH_KEEP_MEMBLOCK > -#define __init_memblock __meminit > -#define __initdata_memblock __meminitdata > void memblock_discard(void); > #else > -#define __init_memblock > -#define __initdata_memblock > static inline void memblock_discard(void) {} > #endif > > -- > 2.34.1 > > -- Sincerely yours, Mike.