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

From: Guicai Ma

Date: Mon Nov 30 2026 - 03:25:47 EST


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@xxxxxxxxxx>
Tested-by: Guicai Ma <maguicai@xxxxxxxxxx>