Mike Snitzer 867da60d46 nfs: avoid i_lock contention in nfs_clear_invalid_mapping
Multi-threaded buffered reads to the same file exposed significant
inode spinlock contention in nfs_clear_invalid_mapping().

Eliminate this spinlock contention by checking flags without locking,
instead using smp_rmb and smp_load_acquire accordingly, but then take
spinlock and double-check these inode flags.

Also refactor nfs_set_cache_invalid() slightly to use
smp_store_release() to pair with nfs_clear_invalid_mapping()'s
smp_load_acquire().

While this fix is beneficial for all multi-threaded buffered reads
issued by an NFS client, this issue was identified in the context of
surprisingly low LOCALIO performance with 4K multi-threaded buffered
read IO.  This fix dramatically speeds up LOCALIO performance:

before: read: IOPS=1583k, BW=6182MiB/s (6482MB/s)(121GiB/20002msec)
after:  read: IOPS=3046k, BW=11.6GiB/s (12.5GB/s)(232GiB/20001msec)

Fixes: 17dfeb911339 ("NFS: Fix races in nfs_revalidate_mapping")
Signed-off-by: Mike Snitzer <snitzer@kernel.org>
Reviewed-by: Jeff Layton <jlayton@kernel.org>
Signed-off-by: Anna Schumaker <anna.schumaker@oracle.com>
2024-11-04 10:24:19 -05:00
..
2017-11-17 14:18:00 -08:00
2017-11-17 14:18:00 -08:00
2024-09-12 12:20:41 +02:00
2024-09-12 12:20:41 +02:00
2024-09-23 15:03:13 -04:00
2021-04-05 09:04:20 -04:00
2024-09-23 15:03:30 -04:00
2023-03-06 09:57:12 +01:00
2024-03-09 09:14:51 -05:00
2015-04-23 15:16:14 -04:00
2024-09-24 15:44:18 -07:00
2023-10-09 16:24:20 +02:00
2024-09-23 15:03:30 -04:00
2024-09-23 15:03:30 -04:00
2024-05-31 12:31:41 +02:00
2023-08-19 10:26:29 -04:00
2024-09-23 15:03:30 -04:00