Skip to content

Commit c8477bb

Browse files
bibo-maochenhuacai
authored andcommitted
LoongArch: Set max_pfn with the PFN of the last page
The current max_pfn equals to zero. In this case, it causes user cannot get some page information through /proc filesystem such as kpagecount. The following message is displayed by stress-ng test suite with command "stress-ng --verbose --physpage 1 -t 1". # stress-ng --verbose --physpage 1 -t 1 stress-ng: error: [1691] physpage: cannot read page count for address 0x134ac000 in /proc/kpagecount, errno=22 (Invalid argument) stress-ng: error: [1691] physpage: cannot read page count for address 0x7ffff207c3a8 in /proc/kpagecount, errno=22 (Invalid argument) stress-ng: error: [1691] physpage: cannot read page count for address 0x134b0000 in /proc/kpagecount, errno=22 (Invalid argument) ... After applying this patch, the kernel can pass the test. # stress-ng --verbose --physpage 1 -t 1 stress-ng: debug: [1701] physpage: [1701] started (instance 0 on CPU 3) stress-ng: debug: [1701] physpage: [1701] exited (instance 0 on CPU 3) stress-ng: debug: [1700] physpage: [1701] terminated (success) Cc: stable@vger.kernel.org # 6.8+ Fixes: ff6c3d8 ("NUMA: optimize detection of memory with no node id assigned by firmware") Signed-off-by: Bibo Mao <maobibo@loongson.cn> Signed-off-by: Huacai Chen <chenhuacai@loongson.cn>
1 parent c911743 commit c8477bb

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

arch/loongarch/kernel/setup.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -387,6 +387,9 @@ static void __init check_kernel_sections_mem(void)
387387
*/
388388
static void __init arch_mem_init(char **cmdline_p)
389389
{
390+
/* Recalculate max_low_pfn for "mem=xxx" */
391+
max_pfn = max_low_pfn = PHYS_PFN(memblock_end_of_DRAM());
392+
390393
if (usermem)
391394
pr_info("User-defined physical RAM map overwrite\n");
392395

0 commit comments

Comments
 (0)