[PATCH] mm: kfence: export kfence_enabled as global variables

Zhenhua Huang quic_zhenhuah at quicinc.com
Tue Feb 7 02:42:44 PST 2023



On 2023/2/7 18:28, Alexander Potapenko wrote:
>>>
>>> What is the problem you have encountered? Is the page-granular direct
>>> map causing issues?
>> We're working on a low memory target, page-granular mapping costed more
>> (2M per 1GB) memory. Due to GKI constraints, it is not easy to disable
>> CONFIG_KFENCE. So my intention was to move the judgement to runtime
>> configurable w/ CONFIG_KFENCE on...
>>
>> Do you have any further suggestion/proposal on this? Many Thanks!
> 
> Right now CONFIG_KFENCE allocates 512Kb for the GKI kernel (only 63
> objects instead of the default 255):
> https://cs.android.com/android/kernel/superproject/+/common-android-mainline:common/arch/arm64/configs/gki_defconfig;l=686?q=CONFIG_KFENCE_NUM_OBJECTS
> Where do 2M come from?
Hi Alexander,
It is not from KFENCE cost itself, but from the requirement it needs 
page-granular mapping.
2M per 1GB cost is from linear mapping for page granularity. You can see 
can_set_direct_map() is used for whether allowing section mapping or not.



More information about the linux-arm-kernel mailing list