• Kent Overstreet's avatar
    bcachefs: Tweak btree key cache shrinker so it actually frees · adfe9357
    Kent Overstreet authored
    Freeing key cache items is a multi stage process; we need to wait for an
    SRCU grace period to elapse, and we handle this ourselves - partially to
    avoid callback overhead, but primarily so that when allocating we can
    first allocate from the freed items waiting for an SRCU grace period.
    
    Previously, the shrinker was counting the items on the 'waiting for SRCU
    grace period' lists as items being scanned, but this meant that too many
    items waiting for an SRCU grace period could prevent it from doing any
    work at all.
    
    After this, we're seeing that items skipped due to the accessed bit are
    the main cause of the shrinker not making any progress, and we actually
    want the key cache shrinker to run quite aggressively because reclaimed
    items will still generally be found (more compactly) in the btree node
    cache - so we also tweak the shrinker to not count those against
    nr_to_scan.
    Signed-off-by: default avatarKent Overstreet <kent.overstreet@linux.dev>
    adfe9357
btree_key_cache.c 26.4 KB