xfs: tail updates only need to occur when LSN changes
authorDave Chinner <dchinner@redhat.com>
Wed, 25 Mar 2020 03:10:29 +0000 (20:10 -0700)
committerDarrick J. Wong <darrick.wong@oracle.com>
Fri, 27 Mar 2020 15:32:55 +0000 (08:32 -0700)
commit8eb807bd839938b45bf7a97f0568d2a845ba6929
tree31c41e5a41ed1953344bdd5038f8f7cae811788b
parent4165994ac9672d91134675caa6de3645a9ace6c8
xfs: tail updates only need to occur when LSN changes

We currently wake anything waiting on the log tail to move whenever
the log item at the tail of the log is removed. Historically this
was fine behaviour because there were very few items at any given
LSN. But with delayed logging, there may be thousands of items at
any given LSN, and we can't move the tail until they are all gone.

Hence if we are removing them in near tail-first order, we might be
waking up processes waiting on the tail LSN to change (e.g. log
space waiters) repeatedly without them being able to make progress.
This also occurs with the new sync push waiters, and can result in
thousands of spurious wakeups every second when under heavy direct
reclaim pressure.

To fix this, check that the tail LSN has actually changed on the
AIL before triggering wakeups. This will reduce the number of
spurious wakeups when doing bulk AIL removal and make this code much
more efficient.

Signed-off-by: Dave Chinner <dchinner@redhat.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Brian Foster <bfoster@redhat.com>
Reviewed-by: Allison Collins <allison.henderson@oracle.com>
Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
fs/xfs/xfs_inode_item.c
fs/xfs/xfs_trans_ail.c
fs/xfs/xfs_trans_priv.h