Re: [PATCH] LoongArch: Remove unused code to avoid build warning
From: Guo Ren
Date: Mon May 18 2026 - 07:29:29 EST
On Mon, May 18, 2026 at 10:58 AM Huacai Chen <chenhuacai@xxxxxxxxxx> wrote:
>
> On Mon, May 18, 2026 at 9:42 AM Guo Ren <guoren@xxxxxxxxxx> wrote:
> >
> >
> >
> > On Sun, May 17, 2026 at 5:25 PM Huacai Chen <chenhuacai@xxxxxxxxxxx> wrote:
> > >
> > > After commit feee6b2989165631b1 ("mm/memory_hotplug: shrink zones when
> > > offlining memory"), __remove_pages() doesn't need the "zone" parameter
> > > so the "page" variable is also unused. Remove the unused code to avoid
> > > such build warning:
> > >
> > > arch/loongarch/mm/init.c: In function 'arch_remove_memory':
> > > arch/loongarch/mm/init.c:134:22: warning: variable 'page' set but not used [-Wunused-but-set-variable=]
> > > 134 | struct page *page = pfn_to_page(start_pfn);
> > >
> > > Cc: <stable@xxxxxxxxxxxxxxx>
> > > Signed-off-by: Huacai Chen <chenhuacai@xxxxxxxxxxx>
> > > ---
> > > arch/loongarch/mm/init.c | 4 ----
> > > 1 file changed, 4 deletions(-)
> > >
> > > diff --git a/arch/loongarch/mm/init.c b/arch/loongarch/mm/init.c
> > > index 3f9ab54114c5..031b39eb081c 100644
> > > --- a/arch/loongarch/mm/init.c
> > > +++ b/arch/loongarch/mm/init.c
> > > @@ -123,11 +123,7 @@ void arch_remove_memory(u64 start, u64 size, struct vmem_altmap *altmap)
> > > {
> > > unsigned long start_pfn = start >> PAGE_SHIFT;
> > > unsigned long nr_pages = size >> PAGE_SHIFT;
> > > - struct page *page = pfn_to_page(start_pfn);
> > >
> > > - /* With altmap the first mapped page is offset from @start */
> > > - if (altmap)
> > > - page += vmem_altmap_offset(altmap);
> > > __remove_pages(start_pfn, nr_pages, altmap);
> >
> > Good cleanup, but does LoongArch forget to remove the linear mapping? If the memory is unplugged, the mapping is still there. How does the core fetch data from there?
> LoongArch's linear mapping is based on DMW rather than TLB, so
> removing linear mapping is unnecessary.
Do you mean SSEG tech? mips & csky also have that. But my question is:
how does the core fetch data/instructions from an unplugged memory
region, given that the mapping is established by DMW?
>
>
> Huacai
> >
> > --
> >
> > Best Regards
> >
> > GUO Ren
--
Best Regards
Guo Ren