From: Patrick Farrell Date: Thu, 31 Aug 2023 00:07:03 +0000 (-0400) Subject: LU-17078 ldlm: do not spin up thread for local cancels X-Git-Tag: 2.15.61~79 X-Git-Url: https://git.whamcloud.com/?a=commitdiff_plain;h=291ac6e6925e3bdf31f527de2bedf5f19706b230;p=fs%2Flustre-release.git LU-17078 ldlm: do not spin up thread for local cancels When doing lockless IO on the client, the server is responsible for taking LDLM locks for each IO. Currently, the server sends these locks to a separate thread for cancellation. This behavior is necessary on the client where a lock may protect a large number of cached pages, so cancelling it in a user thread may introduce unacceptable delays. But the server doesn't have cached pages, so it makes more sense for the server to do the cancellation in the same thread. We do this by not spinning up an ldlm_bl thread for cancellations of local (server side only) locks. This improves 4K DIO random read performance by about 9%. Without patch, maximum server IOPs on 4K reads: 2864k IOPS With patch: 3118k IOPS This is the maximum performance achieved with many clients and client threads doing 4K random AIO reads from different files. Signed-off-by: Patrick Farrell Change-Id: Ia996732780d278c5d0bc290c5484e3bc325a347a Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/52192 Tested-by: jenkins Tested-by: Maloo Reviewed-by: Alex Zhuravlev Reviewed-by: Oleg Drokin Reviewed-by: Andreas Dilger --- diff --git a/lustre/ldlm/ldlm_lock.c b/lustre/ldlm/ldlm_lock.c index 849e039..987c253 100644 --- a/lustre/ldlm/ldlm_lock.c +++ b/lustre/ldlm/ldlm_lock.c @@ -886,7 +886,7 @@ void ldlm_lock_decref_internal(struct ldlm_lock *lock, enum ldlm_mode mode) if (ldlm_is_fail_loc(lock)) CFS_RACE(OBD_FAIL_LDLM_CP_BL_RACE); - if (ldlm_is_atomic_cb(lock) || + if (ldlm_is_atomic_cb(lock) || ldlm_is_local(lock) || ldlm_bl_to_thread_lock(ns, NULL, lock) != 0) ldlm_handle_bl_callback(ns, NULL, lock); } else if (ns_is_client(ns) &&