From b3af0798682b24d0f39424a7db12c9710a0e64b4 Mon Sep 17 00:00:00 2001 From: Li Dongyang Date: Fri, 14 Dec 2018 12:36:22 +1100 Subject: [PATCH] LU-11775 osc: check if opg is in lru list without locking osc_lru_use is called for every page queued for io, we can just check if the osc_page is in the lru list without taking the cl_lru_list_lock and return if not as a fast path. Note we still need to do the check again after locking as it could be removed from the lru list by another thread. Signed-off-by: Li Dongyang Change-Id: I1587b6b5547ae5a7a8bfe32a78361bb888c85d5b Reviewed-on: https://review.whamcloud.com/33860 Reviewed-by: Patrick Farrell Tested-by: Jenkins Tested-by: Maloo Reviewed-by: Alexey Lyashkov Reviewed-by: Oleg Drokin --- lustre/osc/osc_page.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lustre/osc/osc_page.c b/lustre/osc/osc_page.c index ff64374..cd4107b 100644 --- a/lustre/osc/osc_page.c +++ b/lustre/osc/osc_page.c @@ -516,6 +516,8 @@ static void osc_lru_use(struct client_obd *cli, struct osc_page *opg) /* If page is being transferred for the first time, * ops_lru should be empty */ if (opg->ops_in_lru) { + if (list_empty(&opg->ops_lru)) + return; spin_lock(&cli->cl_lru_list_lock); if (!list_empty(&opg->ops_lru)) { __osc_lru_del(cli, opg); -- 1.8.3.1