Re: [PATCH v2 2/2] LoongArch: Skip address pairing for non-exec sections

Tiezhu Yang <[email protected]>
Newsgroups org.kvack.linux-mm,dev.linux.lists.loongarch,org.kernel.vger.linux-kernel
Message-ID <[email protected]>
On 2026/7/31 下午3:38, Huacai Chen wrote:
> Hi, Tiezhu,
> 
> On Fri, Jul 24, 2026 at 2:07 PM Tiezhu Yang <[email protected]> wrote:
>>
>> On 2026/7/21 下午5:06, Tiezhu Yang wrote:
>>> The module loader currently runs expensive address pairing logic for all
>>> sections blindly during relocation. For massive modules like amdgpu, this
>>> causes the loader to waste lots of CPU cycles analyzing non-exec sections.

...

>> Using the section flag check reduces the operation to a single check for
>> massive data sections; otherwise, the loader would have to perform six
>> redundant type comparisons across the if-statement and switch-case for
>> every single relocation entry.
> Please just drop this patch and make the first one better.

OK.

> Now the first patch has a risk that the distance between .init.text
> and .text of the same module exceeds 128MB. I solved it and you can
> verify:
> https://github.com/chenhuacai/linux/commit/f87f9d82869ebc71dca4c02bdff1cd203913a98f

Looks good to me, I think it is safe.

static int module_memory_alloc(struct module *mod, enum mod_mem_type type)
{
...

	if (mod_mem_type_is_data(type))
		execmem_type = EXECMEM_MODULE_DATA;
	else
		execmem_type = EXECMEM_MODULE_TEXT;

	ptr = execmem_alloc_rw(execmem_type, size);
	if (!ptr)
		return -ENOMEM;

...
}

Thanks,
Tiezhu
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.