From: Guo Ren <guoren@kernel.org>
To: Huacai Chen <chenhuacai@kernel.org>
Cc: Huacai Chen <chenhuacai@loongson.cn>,
loongarch@lists.linux.dev, Xuefeng Li <lixuefeng@loongson.cn>,
Xuerui Wang <kernel@xen0n.name>,
Jiaxun Yang <jiaxun.yang@flygoat.com>,
Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
stable@vger.kernel.org
Subject: Re: [PATCH] LoongArch: Remove unused code to avoid build warning
Date: Wed, 20 May 2026 11:16:25 +0800 [thread overview]
Message-ID: <CAJF2gTSivSs-3Bd7xCU4mXtVd=8wtuYP+RyF=1jcLpa1CtvF8Q@mail.gmail.com> (raw)
In-Reply-To: <CAAhV-H6jKR-i3w3u9CJMLmzteZURQnazuBEtp9k2UkKRxUrOmQ@mail.gmail.com>
On Tue, May 19, 2026 at 8:42 PM Huacai Chen <chenhuacai@kernel.org> wrote:
>
> On Mon, May 18, 2026 at 7:29 PM Guo Ren <guoren@kernel.org> wrote:
> >
> > On Mon, May 18, 2026 at 10:58 AM Huacai Chen <chenhuacai@kernel.org> wrote:
> > >
> > > On Mon, May 18, 2026 at 9:42 AM Guo Ren <guoren@kernel.org> wrote:
> > > >
> > > >
> > > >
> > > > On Sun, May 17, 2026 at 5:25 PM Huacai Chen <chenhuacai@loongson.cn> 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@vger.kernel.org>
> > > > > Signed-off-by: Huacai Chen <chenhuacai@loongson.cn>
> > > > > ---
> > > > > 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?
> Access unplugged memory region will cause ADE exception.
Thx for the answer.
Reviewed-by: Guo Ren <guoren@kernel.org>
>
> Huacai
> >
> > >
> > >
> > > Huacai
> > > >
> > > > --
> > > >
> > > > Best Regards
> > > >
> > > > GUO Ren
> >
> >
> >
> > --
> > Best Regards
> > Guo Ren
--
Best Regards
Guo Ren
prev parent reply other threads:[~2026-05-20 3:16 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-17 9:24 [PATCH] LoongArch: Remove unused code to avoid build warning Huacai Chen
[not found] ` <CAJF2gTSn-44So=SdVYxvF5ihJjWs9R7vFAyuPNpeLBwBpJrY9Q@mail.gmail.com>
2026-05-18 2:58 ` Huacai Chen
2026-05-18 11:28 ` Guo Ren
2026-05-19 12:42 ` Huacai Chen
2026-05-20 3:16 ` Guo Ren [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='CAJF2gTSivSs-3Bd7xCU4mXtVd=8wtuYP+RyF=1jcLpa1CtvF8Q@mail.gmail.com' \
--to=guoren@kernel.org \
--cc=chenhuacai@kernel.org \
--cc=chenhuacai@loongson.cn \
--cc=jiaxun.yang@flygoat.com \
--cc=kernel@xen0n.name \
--cc=linux-kernel@vger.kernel.org \
--cc=lixuefeng@loongson.cn \
--cc=loongarch@lists.linux.dev \
--cc=stable@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).