From d5a7563a46acf15252929b6a045eef8c58022314 Mon Sep 17 00:00:00 2001 From: Ben Evans Date: Tue, 24 Oct 2017 11:34:06 -0400 Subject: [PATCH] LU-7988 hsm: wake up cdt when requests are empty The coordinator only runs once per second, we need a mechanism to send more work when everything is done (cdt_request_count goes to zero) Without this, there is a hard limit of max_requests per sec requests that can be processed, causing performance issues with small files. Lustre-change: https://review.whamcloud.com/29742 Lustre-commit: 7251fea8dc3c4d29e30c5a3f763c4c33d35f90a7 Signed-off-by: Ben Evans Change-Id: I563666a1a3e53f0ec5908de593de71ff4d925467 Reviewed-by: Frank Zago Reviewed-by: Sergey Cheremencev Signed-off-by: Minh Diep Reviewed-on: https://review.whamcloud.com/30538 Tested-by: Jenkins Reviewed-by: Sergey Cheremencev Tested-by: Maloo Reviewed-by: John L. Hammond --- lustre/mdt/mdt_coordinator.c | 4 +++- lustre/mdt/mdt_hsm_cdt_requests.c | 6 +++++- lustre/mdt/mdt_internal.h | 2 ++ 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/lustre/mdt/mdt_coordinator.c b/lustre/mdt/mdt_coordinator.c index 50f92bc..0251911 100644 --- a/lustre/mdt/mdt_coordinator.c +++ b/lustre/mdt/mdt_coordinator.c @@ -548,9 +548,11 @@ static int mdt_coordinator(void *data) * repeatedly locking/unlocking the catalog for each request * and preventing other HSM operations from happening */ wait_event_interruptible_timeout(cdt->cdt_waitq, - kthread_should_stop(), + kthread_should_stop() || + cdt->cdt_wakeup_coordinator, wait_event_time); + cdt->cdt_wakeup_coordinator = false; CDEBUG(D_HSM, "coordinator resumes\n"); if (kthread_should_stop()) { diff --git a/lustre/mdt/mdt_hsm_cdt_requests.c b/lustre/mdt/mdt_hsm_cdt_requests.c index 8b6dec7..688e827 100644 --- a/lustre/mdt/mdt_hsm_cdt_requests.c +++ b/lustre/mdt/mdt_hsm_cdt_requests.c @@ -432,7 +432,11 @@ int mdt_cdt_remove_request(struct coordinator *cdt, __u64 cookie) mdt_cdt_put_request(car); LASSERT(atomic_read(&cdt->cdt_request_count) >= 1); - atomic_dec(&cdt->cdt_request_count); + if (atomic_dec_and_test(&cdt->cdt_request_count)) { + /* request count is empty, nudge coordinator for more work */ + cdt->cdt_wakeup_coordinator = true; + wake_up_interruptible(&cdt->cdt_waitq); + } RETURN(0); } diff --git a/lustre/mdt/mdt_internal.h b/lustre/mdt/mdt_internal.h index 90732cf..0ec751b 100644 --- a/lustre/mdt/mdt_internal.h +++ b/lustre/mdt/mdt_internal.h @@ -180,6 +180,8 @@ struct coordinator { /* Remove archive on last unlink policy */ bool cdt_remove_archive_on_last_unlink; + + bool cdt_wakeup_coordinator; }; /* mdt state flag bits */ -- 1.8.3.1