• Kent Overstreet's avatar
    bcachefs: Run btree updates after write out of write_point · b17d3cec
    Kent Overstreet authored
    In the write path, after the write to the block device(s) complete we
    have to punt to process context to do the btree update.
    
    Instead of using the work item embedded in op->cl, this patch switches
    to a per write-point work item. This helps with two different issues:
    
     - lock contention: btree updates to the same writepoint will (usually)
       be updating the same alloc keys
     - context switch overhead: when we're bottlenecked on btree updates,
       having a thread (running out of a work item) checking the write point
       for completed ops is cheaper than queueing up a new work item and
       waking up a kworker.
    
    In an arbitrary benchmark, 4k random writes with fio running inside a
    VM, this patch resulted in a 10% improvement in total iops.
    Signed-off-by: default avatarKent Overstreet <kent.overstreet@linux.dev>
    b17d3cec
util.h 21.5 KB