[PATCH v7 02/14] KEYS: key_garbage_collector(): process in chunks

Guicai Ma maguicai at kylinos.cn
Mon Nov 30 08:25:25 UTC 2026


On Sun, Nov 29, 2026 at 07:05:31PM +0200, Jarkko Sakkinen wrote:
> Resolve the problem by processing in chunks:
>
> 1. Declare a static variable key_gc_work, which owns the garbage collection
>    in-flight state, and key_schedule_gc_work() for re-scheduling the work.
> 2. Define KEY_GC_CHUNK_SIZE, set to 64 keys, as the bound for the number
>    of items scanned and destroyed.

Walked through the chunked state transitions, KEY_GC_REAP_REQUESTED
wakeups, and gc->end expiry tracking.  Also ran multi-chunk expiry and
unlink churn on arm64 KVM with root_maxkeys=4096 and gc_delay=1 under
the same KASAN, lockdep, UBSAN and kmemleak setup with no warnings or
leaks.

Reviewed-by: Guicai Ma <maguicai at kylinos.cn>
Tested-by: Guicai Ma <maguicai at kylinos.cn>



More information about the Linux-security-module-archive mailing list