This patchset supports the following two features:
1. The number of kfence objects is a key factor to balance kfence bug
detection capabilities and performance loss, and often needs to be
optimized according to actual business scenarios. The number of
kfence objects can be dynamically configured kfence.num_objects
cmdline, so as to reduce the release of kernel versions in actual use,
thereby reducing costs.
2. The kfence feature under arm64 supports dynamic opening after system
startup, which will turn all the kernel memblock memory into page-mapped
mapping and increase the memory overhead, in order to save the page
table memory usage, only the kfence pool supports page-mapped mapping,
which can be enabled at kernel startup by setting
kfence.sample _interval=-1 at kernel startup to enable the dynamic on
capability, at this time it will allocate memory for kfence by default.
The kfence will be allocated memory by default. Subsequent dynamic
enablement and disabling will no longer consume additional memory.
This feature has been tested under ARM64, x86_64 and ARM architectures,
and the Kfence Kunit test results are consistent with the native ones.
ChangeLog:
- Add config kfence_must_early_init to perform code isolation for
non-functional purposes.
- Some minor changes about document, no functional changes.
Ze Zuo (2):
kfence: Add a module parameter to adjust kfence objects
arm64: kfence: scale sample_interval to support early init for kfence.
Documentation/dev-tools/kfence.rst | 8 +-
arch/arm64/include/asm/kfence.h | 3 +
arch/arm64/mm/mmu.c | 5 +
include/linux/kfence.h | 13 +-
lib/Kconfig.kfence | 28 +++++
mm/kfence/core.c | 189 +++++++++++++++++++++++++----
mm/kfence/kfence.h | 4 +-
mm/kfence/kfence_test.c | 2 +-
8 files changed, 222 insertions(+), 30 deletions(-)
--
2.25.1