All of lore.kernel.org
 help / color / mirror / Atom feed
From: Niklas Cassel <Niklas.Cassel@wdc.com>
To: "axboe@kernel.dk" <axboe@kernel.dk>
Cc: "fio@vger.kernel.org" <fio@vger.kernel.org>,
	"damien.lemoal@opensource.wdc.com"
	<damien.lemoal@opensource.wdc.com>,
	Niklas Cassel <Niklas.Cassel@wdc.com>
Subject: [PATCH v2 02/18] backend: do ioprio_set() before calling the ioengine init callback
Date: Thu, 3 Feb 2022 19:28:24 +0000	[thread overview]
Message-ID: <20220203192814.18552-3-Niklas.Cassel@wdc.com> (raw)
In-Reply-To: <20220203192814.18552-1-Niklas.Cassel@wdc.com>

From: Niklas Cassel <niklas.cassel@wdc.com>

To be able to report clat stats on a per priority granularity (instead of
only high/low priority), we need to do ioprio_set(), and the matching
td->ioprio assignment, before calling the io engine init callback.

When a thread is using more than a single priority (e.g. option
cmdprio_percentage is used), fio_cmdprio_init() will need to allocate and
initialize an array that will hold the clat stats for all the different
priorities that will be used by the struct td.

For fio_cmdprio_init() to be able to initialize a per priority clat array
properly, we need to assign td->ioprio before calling td_io_init().

Signed-off-by: Niklas Cassel <niklas.cassel@wdc.com>
Reviewed-by: Damien Le Moal <damien.lemoal@opensource.wdc.com>
---
 backend.c | 21 +++++++++++----------
 1 file changed, 11 insertions(+), 10 deletions(-)

diff --git a/backend.c b/backend.c
index c167f908..f7398b23 100644
--- a/backend.c
+++ b/backend.c
@@ -1777,6 +1777,17 @@ static void *thread_main(void *data)
 	if (!init_iolog(td))
 		goto err;
 
+	/* ioprio_set() has to be done before td_io_init() */
+	if (fio_option_is_set(o, ioprio) ||
+	    fio_option_is_set(o, ioprio_class)) {
+		ret = ioprio_set(IOPRIO_WHO_PROCESS, 0, o->ioprio_class, o->ioprio);
+		if (ret == -1) {
+			td_verror(td, errno, "ioprio_set");
+			goto err;
+		}
+		td->ioprio = ioprio_value(o->ioprio_class, o->ioprio);
+	}
+
 	if (td_io_init(td))
 		goto err;
 
@@ -1789,16 +1800,6 @@ static void *thread_main(void *data)
 	if (o->verify_async && verify_async_init(td))
 		goto err;
 
-	if (fio_option_is_set(o, ioprio) ||
-	    fio_option_is_set(o, ioprio_class)) {
-		ret = ioprio_set(IOPRIO_WHO_PROCESS, 0, o->ioprio_class, o->ioprio);
-		if (ret == -1) {
-			td_verror(td, errno, "ioprio_set");
-			goto err;
-		}
-		td->ioprio = ioprio_value(o->ioprio_class, o->ioprio);
-	}
-
 	if (o->cgroup && cgroup_setup(td, cgroup_list, &cgroup_mnt))
 		goto err;
 
-- 
2.34.1

  reply	other threads:[~2022-02-03 19:32 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-02-03 19:28 [PATCH v2 00/18] multiple priority latency stats support Niklas Cassel
2022-02-03 19:28 ` Niklas Cassel [this message]
2022-02-03 19:28 ` [PATCH v2 01/18] init: verify option lat_percentiles consistency for all jobs in group Niklas Cassel
2022-02-03 19:28 ` [PATCH v2 03/18] stat: save the default ioprio in struct thread_stat Niklas Cassel
2022-02-03 19:28 ` [PATCH v2 04/18] client/server: convert ss_data to use an offset instead of fixed position Niklas Cassel
2022-02-03 19:28 ` [PATCH v2 05/18] stat: add a new function to allocate a clat_prio_stat array Niklas Cassel
2022-02-03 19:28 ` [PATCH v2 06/18] os: define min/max prio class and level for systems without ioprio Niklas Cassel
2022-02-03 19:28 ` [PATCH v2 07/18] options: add a parsing function for an additional cmdprio_bssplit format Niklas Cassel
2022-02-03 19:28 ` [PATCH v2 08/18] cmdprio: add support for a new cmdprio_bssplit entry format Niklas Cassel
2022-02-03 19:28 ` [PATCH v2 09/18] examples: add new cmdprio_bssplit format examples Niklas Cassel
2022-02-03 19:28 ` [PATCH v2 10/18] stat: use enum fio_ddir consistently Niklas Cassel
2022-02-03 19:28 ` [PATCH v2 12/18] stat: add helper for resetting the latency buckets Niklas Cassel
2022-02-03 19:28 ` [PATCH v2 11/18] stat: increment members counter after call to sum_thread_stats() Niklas Cassel
2022-02-03 19:28 ` [PATCH v2 14/18] stat: report clat stats on a per priority granularity Niklas Cassel
2022-02-03 19:28 ` [PATCH v2 13/18] stat: disable per prio stats where not needed Niklas Cassel
2022-02-03 19:28 ` [PATCH v2 15/18] stat: convert json output to a new per priority granularity format Niklas Cassel
2022-02-03 19:28 ` [PATCH v2 16/18] gfio: drop support for high/low priority latency results Niklas Cassel
2022-02-03 19:28 ` [PATCH v2 17/18] stat: remove unused high/low prio struct members Niklas Cassel
2022-02-03 19:28 ` [PATCH v2 18/18] t/latency_percentiles.py: add tests for the new cmdprio_bssplit format Niklas Cassel
2022-02-03 22:31 ` [PATCH v2 00/18] multiple priority latency stats support Jens Axboe

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220203192814.18552-3-Niklas.Cassel@wdc.com \
    --to=niklas.cassel@wdc.com \
    --cc=axboe@kernel.dk \
    --cc=damien.lemoal@opensource.wdc.com \
    --cc=fio@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.