From 485976ab451dd6708d4d46bce3bbed9991f5d356 Mon Sep 17 00:00:00 2001 From: Patrick Farrell Date: Fri, 7 May 2021 11:35:28 -0400 Subject: [PATCH] LU-13799 osc: Don't get time for each page Getting the time when each batch of pages starts is sufficiently accurate, and ktime_get() is several % of the CPU time when doing AIO + DIO. This relies on previous patches in this series. Measuring this in milliseconds/gigabyte lets us measure the improvement in absolute terms, rather than just relative terms. This patch reduces i/o time in ms/GiB by: Write: 17 ms/GiB Read: 6 ms/GiB Totals: Write: 237 ms/GiB Read: 223 ms/GiB IOR: mpirun -np 1 $IOR -w -r -t 64M -b 64G -o ./iorfile --posix.odirect Without the patch: write 4030 MiB/s read 4468 MiB/s With patch: write 4326 MiB/s read 4587 MiB/s Signed-off-by: Patrick Farrell Change-Id: I02897bf810683bc77a7d09156cdb83ba1d25ebf1 Reviewed-on: https://review.whamcloud.com/39437 Reviewed-by: Wang Shilong Tested-by: jenkins Reviewed-by: Andreas Dilger Tested-by: Maloo --- lustre/include/lustre_osc.h | 2 +- lustre/osc/osc_io.c | 3 ++- lustre/osc/osc_page.c | 4 ++-- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/lustre/include/lustre_osc.h b/lustre/include/lustre_osc.h index 0341e13..793c493 100644 --- a/lustre/include/lustre_osc.h +++ b/lustre/include/lustre_osc.h @@ -571,7 +571,7 @@ void osc_index2policy(union ldlm_policy_data *policy, const struct cl_object *ob pgoff_t start, pgoff_t end); void osc_lru_add_batch(struct client_obd *cli, struct list_head *list); void osc_page_submit(const struct lu_env *env, struct osc_page *opg, - enum cl_req_type crt, int brw_flags); + enum cl_req_type crt, int brw_flags, ktime_t submit_time); int lru_queue_work(const struct lu_env *env, void *data); long osc_lru_shrink(const struct lu_env *env, struct client_obd *cli, long target, bool force); diff --git a/lustre/osc/osc_io.c b/lustre/osc/osc_io.c index 07f45bf..88069c2 100644 --- a/lustre/osc/osc_io.c +++ b/lustre/osc/osc_io.c @@ -132,6 +132,7 @@ int osc_io_submit(const struct lu_env *env, const struct cl_io_slice *ios, unsigned int max_pages; unsigned int ppc_bits; /* pages per chunk bits */ unsigned int ppc; + ktime_t submit_time = ktime_get(); bool sync_queue = false; LASSERT(qin->pl_nr > 0); @@ -195,7 +196,7 @@ int osc_io_submit(const struct lu_env *env, const struct cl_io_slice *ios, oap->oap_async_flags |= ASYNC_COUNT_STABLE; spin_unlock(&oap->oap_lock); - osc_page_submit(env, opg, crt, brw_flags); + osc_page_submit(env, opg, crt, brw_flags, submit_time); list_add_tail(&oap->oap_pending_item, &list); if (page->cp_sync_io != NULL) diff --git a/lustre/osc/osc_page.c b/lustre/osc/osc_page.c index 2a57cf0..320c1c6 100644 --- a/lustre/osc/osc_page.c +++ b/lustre/osc/osc_page.c @@ -299,7 +299,7 @@ EXPORT_SYMBOL(osc_page_init); * transfer (i.e., transferred synchronously). */ void osc_page_submit(const struct lu_env *env, struct osc_page *opg, - enum cl_req_type crt, int brw_flags) + enum cl_req_type crt, int brw_flags, ktime_t submit_time) { struct osc_io *oio = osc_env_io(env); struct osc_async_page *oap = &opg->ops_oap; @@ -319,7 +319,7 @@ void osc_page_submit(const struct lu_env *env, struct osc_page *opg, oap->oap_cmd |= OBD_BRW_NOQUOTA; } - opg->ops_submit_time = ktime_get(); + opg->ops_submit_time = submit_time; osc_page_transfer_get(opg, "transfer\0imm"); osc_page_transfer_add(env, opg, crt); } -- 1.8.3.1