From: "Jason B. Akers" <jason.b.akers@intel.com>
To: linux-ide@vger.kernel.org
Cc: axboe@fb.com, dan.j.williams@intel.com, kapil.karkra@intel.com,
linux-kernel@vger.kernel.org
Subject: [RFC PATCH 2/5] block: ioprio hint to low-level device drivers
Date: Wed, 29 Oct 2014 11:23:53 -0700 [thread overview]
Message-ID: <20141029182353.4879.67152.stgit@stg-AndroidDev-VirtualBox> (raw)
In-Reply-To: <20141029180454.4879.75088.stgit@stg-AndroidDev-VirtualBox>
From: Dan Williams <dan.j.williams@intel.com>
The priority in the io_context is consumed by the io scheduler. For
caching advice we need the request->ioprio field to be up-to-date. Set
the bio ioprio at submit time.
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
Signed-off-by: Jason B. Akers <jason.b.akers@intel.com>
---
block/bio.c | 1 +
block/ioprio.c | 22 ++++++++++++++++------
2 files changed, 17 insertions(+), 6 deletions(-)
diff --git a/block/bio.c b/block/bio.c
index 3e6e198..e133b5c 100644
--- a/block/bio.c
+++ b/block/bio.c
@@ -2009,6 +2009,7 @@ int bio_associate_current(struct bio *bio)
/* acquire active ref on @ioc and associate */
get_io_context_active(ioc);
bio->bi_ioc = ioc;
+ bio_set_prio(bio, ioprio_best(ioc->ioprio, bio_prio(bio)));
/* associate blkcg if exists */
rcu_read_lock();
diff --git a/block/ioprio.c b/block/ioprio.c
index e50170c..fec1202 100644
--- a/block/ioprio.c
+++ b/block/ioprio.c
@@ -159,18 +159,28 @@ int ioprio_best(unsigned short aprio, unsigned short bprio)
{
unsigned short aclass = IOPRIO_PRIO_CLASS(aprio);
unsigned short bclass = IOPRIO_PRIO_CLASS(bprio);
+ unsigned short class, data, advice;
if (aclass == IOPRIO_CLASS_NONE)
aclass = IOPRIO_CLASS_BE;
if (bclass == IOPRIO_CLASS_NONE)
bclass = IOPRIO_CLASS_BE;
- if (aclass == bclass)
- return min(aprio, bprio);
- if (aclass > bclass)
- return bprio;
- else
- return aprio;
+ /* best priority */
+ if (aclass == bclass) {
+ class = aclass;
+ data = min(IOPRIO_PRIO_DATA(aprio), IOPRIO_PRIO_DATA(bprio));
+ } else if (aclass > bclass) {
+ class = bclass;
+ data = IOPRIO_PRIO_DATA(bprio);
+ } else {
+ class = aclass;
+ data = IOPRIO_PRIO_DATA(aprio);
+ }
+
+ /* best cache advice, assumes invalid advice is zero */
+ advice = max(IOPRIO_ADVICE(aprio), IOPRIO_ADVICE(bprio));
+ return IOPRIO_ADVISE(class, data, advice);
}
SYSCALL_DEFINE2(ioprio_get, int, which, int, who)
next prev parent reply other threads:[~2014-10-29 18:23 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-10-29 18:23 [RFC PATCH 0/5] Enable use of Solid State Hybrid Drives Jason B. Akers
2014-10-29 18:23 ` [RFC PATCH 1/5] block, ioprio: include caching advice via ionice Jason B. Akers
2014-10-29 19:02 ` Jeff Moyer
2014-10-29 21:07 ` Dan Williams
2014-10-29 18:23 ` Jason B. Akers [this message]
2014-10-29 18:23 ` [RFC PATCH 3/5] block: untangle ioprio from BLK_CGROUP and BLK_DEV_THROTTLING Jason B. Akers
2014-10-29 18:24 ` [RFC PATCH 4/5] block, mm: Added the necessary plumbing to take ioprio hints down to block layer Jason B. Akers
2014-10-29 18:24 ` [RFC PATCH 5/5] libata: Enabling Solid State Hybrid Drives (SSHDs) based on SATA 3.2 standard Jason B. Akers
2014-10-29 20:14 ` [RFC PATCH 0/5] Enable use of Solid State Hybrid Drives Dave Chinner
2014-10-29 21:10 ` Jens Axboe
2014-10-29 22:09 ` Dave Chinner
2014-10-29 22:24 ` Dan Williams
2014-10-30 7:21 ` Dave Chinner
2014-10-30 14:15 ` Jens Axboe
2014-10-30 17:07 ` Dan Williams
2014-11-10 4:22 ` Dave Chinner
2014-11-12 16:47 ` Dan Williams
2014-10-29 22:49 ` Jens Axboe
2014-10-29 21:11 ` Dan Williams
2014-12-03 15:25 ` Pavel Machek
2014-10-30 2:05 ` Martin K. Petersen
2014-10-30 2:35 ` Jens Axboe
2014-10-30 3:28 ` Martin K. Petersen
2014-10-30 4:19 ` Dan Williams
2014-10-30 14:17 ` Jens Axboe
2014-10-30 14:53 ` Jens Axboe
2014-10-30 16:27 ` Dan Williams
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=20141029182353.4879.67152.stgit@stg-AndroidDev-VirtualBox \
--to=jason.b.akers@intel.com \
--cc=axboe@fb.com \
--cc=dan.j.williams@intel.com \
--cc=kapil.karkra@intel.com \
--cc=linux-ide@vger.kernel.org \
--cc=linux-kernel@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).