From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (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 D2AE933998 for ; Sun, 5 Jul 2026 09:17:16 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1783243037; cv=none; b=BGxHi963b8CFyfL+XpRvFhMoBiKPOhJ7kYSzmi/1p3Y6zjD3sLZsvWJnPvwwo8AMFmGQltWGUsftgsML/MJfWg/6oHP0ElAEPBm02VmxA6WydRz3RF8Q5zBJiIUgBrcaaF+JIcSWKcX6/fDcMtXJZoZ4ZiyU5kMqghlT/aMi8EU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1783243037; c=relaxed/simple; bh=RxwZ1KRbehKonq48d02kGJsd2K1lkFan/BEqQbd0IZM=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=bDm+XbJs3pXcEykdV92F6dhuGYExsdlT2UtgPALidNzcOMrYLgAOniTItRyOEg47yZ0xNV5/tYuEoII0nN3sRIsWM6iIF6/lmJzr0sbi4dGbXctYl0aN9UnU5V3arDHDcaOYyHrfBNjKhnLZ0ToyerUHGs6gvKsSTH9bQhWKgoc= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=VAuLMVEY; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="VAuLMVEY" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9ECCA1F000E9; Sun, 5 Jul 2026 09:17:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1783243036; bh=1IpFmqExRpxSV8z6aiknhr9wo+Fgy2npUiahXkL8Phs=; h=Date:From:To:Cc:Subject:References:In-Reply-To; b=VAuLMVEYo8TwyvMl9BuOQPRB8oVu13Q6owOStv6lFC4TRCjV/ZLuPxa0tKU1hDIrm dg0gtaUkMbqbt3L33a/kicGqU8qnEB6cIM7O7oNdp7bjX1G9WeY5A+ZSE6EHTz/Cw9 sJT5d2OYfC5uER6oS/xOGKE9YEBlWcEsVKmFD8+DHMBh5Hd/wQlSdcmDatHc+a3H15 ZVteBAdSETEBoTA9RUGpWhRrObCrMcdw3A179vqyQGUim7qjXlf4OwPDQ/xVitAKRc JNqjYRA2Oc+uqjByXkfY4k2DIEvZLWMOcjg1z98kKf9ymkVARtX+dpeiOJN4xK7ppo tm37/JOtOf5FQ== Date: Sun, 5 Jul 2026 12:17:10 +0300 From: Mike Rapoport To: Anuradha Weeraman Cc: Andrew Morton , David Hildenbrand , linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] mm: avoid shadowing global mem_map in sparse_init_one_section() Message-ID: References: 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: On Sat, Jul 04, 2026 at 11:54:51PM +0530, Anuradha Weeraman wrote: > With W=2, sparse_init_one_section() warns because its mem_map parameter > shadows the global mem_map declaration in linux/mmzone.h. > > Rename it to section_mem_map to make that scope explicit and avoid the > shadowing warning. I suspect that the comment in mmzone.h saying that mem_map is must be declared for SPARSEMEM is stale and it can be guarded by #ifdef CONFIG_FLATMEM which will be a more correct fix. > No functional change. > > Signed-off-by: Anuradha Weeraman > --- > mm/internal.h | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/mm/internal.h b/mm/internal.h > index 181e79f1d6a2..4943def97167 100644 > --- a/mm/internal.h > +++ b/mm/internal.h > @@ -957,7 +957,7 @@ void sparse_init(void); > int sparse_index_init(unsigned long section_nr, int nid); > > static inline void sparse_init_one_section(struct mem_section *ms, > - unsigned long pnum, struct page *mem_map, > + unsigned long pnum, struct page *section_mem_map, > struct mem_section_usage *usage, unsigned long flags) > { > unsigned long coded_mem_map; > @@ -969,7 +969,7 @@ static inline void sparse_init_one_section(struct mem_section *ms, > * page_to_pfn() on !CONFIG_SPARSEMEM_VMEMMAP can simply subtract it > * from the page pointer to obtain the PFN. > */ > - coded_mem_map = (unsigned long)(mem_map - section_nr_to_pfn(pnum)); > + coded_mem_map = (unsigned long)(section_mem_map - section_nr_to_pfn(pnum)); > VM_WARN_ON_ONCE(coded_mem_map & ~SECTION_MAP_MASK); > > ms->section_mem_map &= ~SECTION_MAP_MASK; > -- > 2.53.0 > > -- Sincerely yours, Mike.