Skip to content

Commit

Permalink
xfs: Wake CIL push waiters more reliably
Browse files Browse the repository at this point in the history
Threads, which committed items to the CIL, wait in the xc_push_wait
waitqueue when used_space in the push context goes over a limit. These
threads need to be woken when the CIL is pushed.

The CIL push worker tries to avoid the overhead of calling wake_all()
when there are no waiters waiting. It does so by checking the same
condition which caused the waits to happen. This, however, is
unreliable, because ctx->space_used can actually decrease when items are
recommitted. If the value goes below the limit while some threads are
already waiting but before the push worker gets to it, these threads are
not woken.

Always wake all CIL push waiters. Test with waitqueue_active() as an
optimization. This is possible, because we hold the xc_push_lock
spinlock, which prevents additions to the waitqueue.

Signed-off-by: Donald Buczek <buczek@molgen.mpg.de>
  • Loading branch information
donald committed Feb 25, 2022
1 parent accd3a9 commit bc1ba27
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion fs/xfs/xfs_log_cil.c
Original file line number Diff line number Diff line change
Expand Up @@ -670,7 +670,7 @@ xlog_cil_push_work(
/*
* Wake up any background push waiters now this context is being pushed.
*/
if (ctx->space_used >= XLOG_CIL_BLOCKING_SPACE_LIMIT(log))
if (waitqueue_active(&cil->xc_push_wait))
wake_up_all(&cil->xc_push_wait);

/*
Expand Down

0 comments on commit bc1ba27

Please sign in to comment.