]> Gentwo Git Trees - linux/.git/commitdiff
KFENCE: Clarify that sample allocations are not following NUMA or memory policies b4/kfence_doc_update
authorChristoph Lameter <cl@linux.com>
Thu, 23 Jan 2025 22:34:40 +0000 (14:34 -0800)
committerChristoph Lameter <cl@gentwo.org>
Fri, 24 Jan 2025 02:03:37 +0000 (18:03 -0800)
KFENCE manages its own pools and redirects regular memory allocations
to those pools in a sporadic way. The usual memory allocator features
like NUMA, memory policies and pfmemalloc are not supported.
This means that one gets surprising object placement with KFENCE that
may impact performance on some NUMA systems.

Update the description and make KFENCE depend on VM debugging
having been enabled.

Signed-off-by: Christoph Lameter <cl@linux.com>
Documentation/dev-tools/kfence.rst
lib/Kconfig.kfence

index 5418993538653c42df8aad6b1aa4bdb6fd509a03..03062d0941dcbcb11435c305e981231da9286f6c 100644 (file)
@@ -8,7 +8,9 @@ Kernel Electric-Fence (KFENCE) is a low-overhead sampling-based memory safety
 error detector. KFENCE detects heap out-of-bounds access, use-after-free, and
 invalid-free errors.
 
-KFENCE is designed to be enabled in production kernels, and has near zero
+KFENCE is designed to be low overhead but does not implement the typical
+memory allocation features for its samples like memory policies, NUMA and
+management of emergency memory pools. It has near zero
 performance overhead. Compared to KASAN, KFENCE trades performance for
 precision. The main motivation behind KFENCE's design, is that with enough
 total uptime KFENCE will detect bugs in code paths not typically exercised by
index 6fbbebec683ae5fe252b50d2870d7d2cc3407d01..1f9f79df2d0acb38e3fef6d0d095071a45feb285 100644 (file)
@@ -11,8 +11,8 @@ menuconfig KFENCE
        help
          KFENCE is a low-overhead sampling-based detector of heap out-of-bounds
          access, use-after-free, and invalid-free errors. KFENCE is designed
-         to have negligible cost to permit enabling it in production
-         environments.
+         to have negligible cost. KFENCE does not support NUMA features
+         and other memory allocator features for it sample allocations.
 
          See <file:Documentation/dev-tools/kfence.rst> for more details.
 
@@ -21,7 +21,9 @@ menuconfig KFENCE
          detect, albeit at very different performance profiles. If you can
          afford to use KASAN, continue using KASAN, for example in test
          environments. If your kernel targets production use, and cannot
-         enable KASAN due to its cost, consider using KFENCE.
+         enable KASAN due to its cost and you are not using NUMA and have
+         no use of the memory reserve logic of the memory allocators,
+         consider using KFENCE.
 
 if KFENCE