The Linux Kernel Mailing List
 help / color / mirror / Atom feed
From: Mike Rapoport <rppt@kernel.org>
To: Tiezhu Yang <yangtiezhu@loongson.cn>
Cc: Andrew Morton <akpm@linux-foundation.org>,
	Huacai Chen <chenhuacai@kernel.org>,
	linux-mm@kvack.org, loongarch@lists.linux.dev,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH v1 2/2] LoongArch: mm: Expand modules virtual address space to 2GB
Date: Sun, 19 Jul 2026 12:01:53 +0300	[thread overview]
Message-ID: <alySgaaQen6ZtwSo@kernel.org> (raw)
In-Reply-To: <20260717075715.25513-3-yangtiezhu@loongson.cn>

Hi,

On Fri, Jul 17, 2026 at 03:57:15PM +0800, Tiezhu Yang wrote:
> Frequent "execmem: unable to allocate memory" warnings are observed
> during kernel module loading when updating the latest kernel.
> 
> This is because the modules virtual address region on LoongArch is
> tightly constrained to 256MB, while ARM64 and RISC-V are natively
> configured with a spacious 2GB region.

The constraint follows architecture ability to address kernel instructions
and data from modules code.

I don't know what are loongarch requirements, but I remember that arm64
added a layer of relocation support to allow 2G module address space.

> Expand the modules virtual address space to 2GB for LoongArch to
> eliminate these allocation bottlenecks.
> 
> This change only applies to 64-bit kernels (CONFIG_64BIT), 32-bit
> kernels (CONFIG_32BIT) are entirely unaffected since they do not
> define separate module address regions.
> 
> With this patch, there are no "execmem: unable to allocate memory"
> warnings anymore for 64-bit kernels.
> 
> Signed-off-by: Tiezhu Yang <yangtiezhu@loongson.cn>
> ---
>  arch/loongarch/include/asm/pgtable.h | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/arch/loongarch/include/asm/pgtable.h b/arch/loongarch/include/asm/pgtable.h
> index 223528c04d73..e5952ecd6a73 100644
> --- a/arch/loongarch/include/asm/pgtable.h
> +++ b/arch/loongarch/include/asm/pgtable.h
> @@ -96,7 +96,7 @@ struct vm_area_struct;
>  #ifdef CONFIG_64BIT
>  
>  #define MODULES_VADDR	(vm_map_base + PCI_IOSIZE + (2 * PAGE_SIZE))
> -#define MODULES_END	(MODULES_VADDR + SZ_256M)
> +#define MODULES_END	(MODULES_VADDR + SZ_2G)
>  
>  #ifdef CONFIG_KFENCE
>  #define KFENCE_AREA_SIZE	(((CONFIG_KFENCE_NUM_OBJECTS + 1) * 2 + 2) * PAGE_SIZE)
> -- 
> 2.42.0
> 

-- 
Sincerely yours,
Mike.

  reply	other threads:[~2026-07-19  9:01 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-17  7:57 [PATCH v1 0/2] Enhance execmem diagnostic and fix LoongArch module bottleneck Tiezhu Yang
2026-07-17  7:57 ` [PATCH v1 1/2] mm/execmem: Print size, align and caller on allocation failure Tiezhu Yang
2026-07-17 18:37   ` Andrew Morton
2026-07-19  8:55     ` Mike Rapoport
2026-07-17  7:57 ` [PATCH v1 2/2] LoongArch: mm: Expand modules virtual address space to 2GB Tiezhu Yang
2026-07-19  9:01   ` Mike Rapoport [this message]
2026-07-19 15:28     ` Xi Ruoyao
2026-07-20  7:16       ` Tiezhu Yang
2026-07-20 10:40       ` Tiezhu Yang

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=alySgaaQen6ZtwSo@kernel.org \
    --to=rppt@kernel.org \
    --cc=akpm@linux-foundation.org \
    --cc=chenhuacai@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=loongarch@lists.linux.dev \
    --cc=yangtiezhu@loongson.cn \
    /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