From: "Jason B. Akers" <jason.b.akers@intel.com>
To: linux-ide@vger.kernel.org
Cc: axboe@fb.com, kapil.karkra@intel.com, dan.j.williams@intel.com,
linux-kernel@vger.kernel.org
Subject: [RFC PATCH 1/5] block, ioprio: include caching advice via ionice
Date: Wed, 29 Oct 2014 11:23:45 -0700 [thread overview]
Message-ID: <20141029182345.4879.98373.stgit@stg-AndroidDev-VirtualBox> (raw)
In-Reply-To: <20141029180454.4879.75088.stgit@stg-AndroidDev-VirtualBox>
From: Dan Williams <dan.j.williams@intel.com>
Steal one unused bit from the priority class and two bits from the
priority data, to implement a 3 bit cache-advice field. Similar to the
page cache advice from fadvise() these hints are meant to be consumed
by hybrid drives. Solid State Hyrbid-Drives, as defined by the SATA-IO
Specification, implement up to a 4-bit cache priority that can be
specified along with a FPDMA command.
IOPRIO_ADV_NONE: default if ionice hint is not provided
IOPRIO_ADV_EVICT: indicate that if the lba's associated with
this command are in the cache, write them back
and invalidate.
IOPRIO_ADV_DONTNEED: caching this data has little value, but no
need to actively evict
IOPRIO_ADV_NORMAL: perform best-effort / device-default caching
IOPRIO_ADV_RESERVED1: reserved for future use, potentially
IOPRIO_ADV_RESERVED2: permit the kernel to use these for
IOPRIO_ADV_RESERVED3: internal cache priorities, but userspace
owns highest priority override
IOPRIO_ADV_WILLNEED: cache this data at the highest possible priority
The expectation is that a table in the driver is responsible for
translating this advice into transport/device specific priority value.
Signed-off-by: Kapil Karkra <kapil.karkra@intel.com>
Signed-off-by: Jason B. Akers <jason.b.akers@intel.com>
---
include/linux/ioprio.h | 32 ++++++++++++++++++++++++++++----
1 file changed, 28 insertions(+), 4 deletions(-)
diff --git a/include/linux/ioprio.h b/include/linux/ioprio.h
index beb9ce1..752813d 100644
--- a/include/linux/ioprio.h
+++ b/include/linux/ioprio.h
@@ -5,17 +5,27 @@
#include <linux/iocontext.h>
/*
- * Gives us 8 prio classes with 13-bits of data for each class
+ * Gives us 4 prio classes with 11-bits of data for each class
+ * ...additionally a prio can indicate one of 7 cacheability hints
*/
#define IOPRIO_BITS (16)
+#define IOPRIO_CACHE_SHIFT (15) /* msb of the cache-advice mask */
#define IOPRIO_CLASS_SHIFT (13)
-#define IOPRIO_PRIO_MASK ((1UL << IOPRIO_CLASS_SHIFT) - 1)
+#define IOPRIO_ADV_SHIFT (11)
+#define IOPRIO_PRIO_MASK ((1UL << IOPRIO_ADV_SHIFT) - 1)
-#define IOPRIO_PRIO_CLASS(mask) ((mask) >> IOPRIO_CLASS_SHIFT)
+#define IOPRIO_PRIO_CLASS(mask) (((mask) >> IOPRIO_CLASS_SHIFT) & 3)
#define IOPRIO_PRIO_DATA(mask) ((mask) & IOPRIO_PRIO_MASK)
+#define IOPRIO_ADVICE(mask) ((((mask) >> IOPRIO_ADV_SHIFT) & 3) | \
+ (((mask) >> IOPRIO_CACHE_SHIFT & 1) << 2))
#define IOPRIO_PRIO_VALUE(class, data) (((class) << IOPRIO_CLASS_SHIFT) | data)
+#define IOPRIO_ADVISE(class, data, advice) \
+ ((IOPRIO_PRIO_VALUE(class, data) | ((advice) & 3) << IOPRIO_ADV_SHIFT)\
+ | (((advice) & 4) << (IOPRIO_CACHE_SHIFT - 2)))
-#define ioprio_valid(mask) (IOPRIO_PRIO_CLASS((mask)) != IOPRIO_CLASS_NONE)
+#define ioprio_valid(mask) (IOPRIO_PRIO_CLASS((mask)) != \
+ IOPRIO_CLASS_NONE)
+#define ioprio_advice_valid(mask) (IOPRIO_ADVICE(mask) != IOPRIO_ADV_NONE)
/*
* These are the io priority groups as implemented by CFQ. RT is the realtime
@@ -31,6 +41,20 @@ enum {
};
/*
+ * Four cacheability hints that map to their fadvise(2) equivalents
+ */
+enum {
+ IOPRIO_ADV_NONE,
+ IOPRIO_ADV_EVICT, /* actively discard cached data */
+ IOPRIO_ADV_DONTNEED, /* caching this data has little value */
+ IOPRIO_ADV_NORMAL, /* best-effort / device-default cache priority */
+ IOPRIO_ADV_RESERVED1, /* reserved for future use */
+ IOPRIO_ADV_RESERVED2,
+ IOPRIO_ADV_RESERVED3,
+ IOPRIO_ADV_WILLNEED, /* high temporal locality or cache valuable */
+};
+
+/*
* 8 best effort priority levels are supported
*/
#define IOPRIO_BE_NR (8)
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 ` Jason B. Akers [this message]
2014-10-29 19:02 ` [RFC PATCH 1/5] block, ioprio: include caching advice via ionice Jeff Moyer
2014-10-29 21:07 ` Dan Williams
2014-10-29 18:23 ` [RFC PATCH 2/5] block: ioprio hint to low-level device drivers Jason B. Akers
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=20141029182345.4879.98373.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).