Re: [PATCH v2 1/2] LoongArch: kfence: avoid use CONFIG_KFENCE_NUM_OBJECTS
From: Huacai Chen
Date: Thu Dec 18 2025 - 21:13:05 EST
Hi, Enze,
On Thu, Dec 18, 2025 at 2:39 PM yuan linyu <yuanlinyu@xxxxxxxxx> wrote:
>
> use common kfence macro KFENCE_POOL_SIZE for KFENCE_AREA_SIZE definition
>
> Signed-off-by: yuan linyu <yuanlinyu@xxxxxxxxx>
> ---
> arch/loongarch/include/asm/pgtable.h | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/arch/loongarch/include/asm/pgtable.h b/arch/loongarch/include/asm/pgtable.h
> index f41a648a3d9e..e9966c9f844f 100644
> --- a/arch/loongarch/include/asm/pgtable.h
> +++ b/arch/loongarch/include/asm/pgtable.h
> @@ -10,6 +10,7 @@
> #define _ASM_PGTABLE_H
>
> #include <linux/compiler.h>
> +#include <linux/kfence.h>
> #include <asm/addrspace.h>
> #include <asm/asm.h>
> #include <asm/page.h>
> @@ -96,7 +97,7 @@ extern unsigned long empty_zero_page[PAGE_SIZE / sizeof(unsigned long)];
> #define MODULES_END (MODULES_VADDR + SZ_256M)
>
> #ifdef CONFIG_KFENCE
> -#define KFENCE_AREA_SIZE (((CONFIG_KFENCE_NUM_OBJECTS + 1) * 2 + 2) * PAGE_SIZE)
> +#define KFENCE_AREA_SIZE (KFENCE_POOL_SIZE + (2 * PAGE_SIZE))
Can you remember why you didn't use KFENCE_POOL_SIZE at the first place?
Huacai
> #else
> #define KFENCE_AREA_SIZE 0
> #endif
> --
> 2.25.1
>
>