From: Eric Wheeler <git@linux.ewheeler.net>
To: linux-block@vger.kernel.org
Subject: [PATCH 08/19] bcache: documentation for sysfs entries describing bcache cache hinting
Date: Tue, 11 Oct 2016 12:08:13 -0700 [thread overview]
Message-ID: <20170629221206.9461F100127@ware.dreamhost.com> (raw)
In-Reply-To: <20170629134510.GA32385@infradead.org>
Signed-off-by: Eric Wheeler <bcache@linux.ewheeler.net>
---
Documentation/bcache.txt | 80 ++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 80 insertions(+)
diff --git a/Documentation/bcache.txt b/Documentation/bcache.txt
index a9259b5..c78c012 100644
--- a/Documentation/bcache.txt
+++ b/Documentation/bcache.txt
@@ -133,6 +133,86 @@ the backing devices to passthrough mode.
writeback mode). It currently doesn't do anything intelligent if it fails to
read some of the dirty data, though.
+SSD LONGEVITY: PER-PROCESS CACHE HINTING WITH IO PRIORITY
+---------------------------------------------------------
+
+Processes can be assigned an IO priority using `ionice` and bcache will
+either try to writeback or bypass the cache based on the IO priority
+level assigned to the process and the configuration of the syfs ioprio
+hints. If configured properly for your workload, this can both increase
+performance and reduce SSD wear (erase/write cycles).
+
+Having idle IOs bypass the cache can increase performance elsewhere
+since you probably don't care about their performance. In addition,
+this prevents idle IOs from promoting into (polluting) your cache and
+evicting blocks that are more important elsewhere.
+
+Default sysfs values:
+ 2,7: ioprio_bypass is hinted for process IOs at-or-below best-effort-7.
+ 0,0: ioprio_writeback hinting is disabled by default.
+
+Cache hinting is configured by writing 'class,level' pairs to sysfs.
+In this example, we write the following:
+
+ echo 2,7 > /sys/block/bcache0/bcache/ioprio_bypass
+ echo 2,0 > /sys/block/bcache0/bcache/ioprio_writeback
+
+Thus, processes with the following IO class (ionice -c) and level (-n)
+will the behave as shown in this table:
+
+ (-c) IO Class (-n) Class level Action
+ -----------------------------------------------------
+ (1) Realtime 0-7 Writeback
+ (2) Best-effort 0 Writeback
+ (2) Best-effort 1-6 Normal, as if hinting were disabled
+ (2) Best-effort 7 Bypass cache
+ (3) Idle n/a Bypass cache
+
+For processes at-or-below best-effort-7 (ionice -c2 -n7), the
+ioprio_bypass behavior is as follows:
+
+* Reads will come from the backing device and will not promote into
+ (pollute) your cache. If the block being read was already in the cache,
+ then it will be read from the cache (and remain cached).
+
+* If you are using writeback mode, then low-priority bypass-hinted writes
+ will go directly to the backing device. If the write was dirty in
+ cache, it will cache-invalidate and write directly to the backing
+ device. If a high-priority task later writes the same block then it
+ will writeback so no performance is lost for write-after-write.
+
+ For read-after-bypassed-write, the block will be read from the backing
+ device (not cached) so there may be a miss penalty when a low-priority
+ process write bypasses the cache followed by a high-priority read that
+ would otherwise have hit. In practice, this is not an issue; to date,
+ none have wanted low-priority writes and high-priority reads of the
+ same block.
+
+For processes in our example at-or-above best-effort-0 (ionice -c2 -n0),
+the ioprio_writeback behavior is as follows:
+
+* The writeback hint has no effect unless your 'cache_mode' is writeback.
+ Assuming writeback mode, all writes at this priority will writeback.
+ Of course this will increase SSD wear, so only use writeback hinting
+ if you need it.
+
+* Reads are unaffected by ioprio_writeback, except that read-after-write
+ will of course read from the cache.
+
+Linux assigns processes the best-effort class with a level of 4 if
+no process is assigned Thus, without `ionice` your processes will
+follow normal bcache should_writeback/should_bypass symantecs as if the
+ioprio_writeback/ioprio_bypass sysfs flags were disabled.
+
+Also note that in order to be hinted by ioprio_writeback/ioprio_bypass,
+the process must have a valid ioprio setting as returned by
+get_task_io_context()->ioprio. Thus, a process without an IO context
+will be ignored by the ioprio_writeback/ioprio_bypass hints even if your
+sysfs hints specify that best-effort-4 should be flagged for bypass
+or writeback. If in doubt, explicitly set the process IO priority with
+`ionice`.
+
+See `man ionice` for more detail about per-process IO priority in Linux.
HOWTO/COOKBOOK
--------------
--
1.8.3.1
next prev parent reply other threads:[~2017-06-30 10:16 UTC|newest]
Thread overview: 120+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-05-25 19:10 [PULL] bcache updates based on git.kernel.dk/linux-block:for-next Eric Wheeler
2017-06-28 23:06 ` [PULL] bcache fixes and updates for-4.13 Eric Wheeler
2017-06-28 23:06 ` Eric Wheeler
2017-06-29 13:45 ` Christoph Hellwig
2016-10-11 19:04 ` [PATCH 07/19] bcache: introduce bcache sysfs entries for ioprio-based bypass/writeback hints Eric Wheeler
2016-10-11 19:04 ` Eric Wheeler
2016-10-11 19:08 ` Eric Wheeler [this message]
2016-10-11 19:08 ` [PATCH 08/19] bcache: documentation for sysfs entries describing bcache cache hinting Eric Wheeler
2016-10-20 0:36 ` [PATCH 09/19] bcache: update bio->bi_opf bypass/writeback REQ_ flag hints Eric Wheeler
2016-10-20 0:36 ` Eric Wheeler
2017-05-09 19:03 ` [PATCH 01/19] bcache: Fix leak of bdev reference Jan Kara
2017-05-09 19:03 ` Jan Kara
2017-05-09 19:05 ` [PATCH 02/19] bcache: fix sequential large write IO bypass Tang Junhui
2017-05-09 19:05 ` Tang Junhui
2017-05-09 19:07 ` [PATCH 03/19] bcache: do not subtract sectors_to_gc for bypassed IO Tang Junhui
2017-05-09 19:07 ` Tang Junhui
2017-05-09 19:14 ` [PATCH 05/19] bcache: fix calling ida_simple_remove() with incorrect minor Tang Junhui
2017-05-09 19:14 ` Tang Junhui
2017-06-01 8:48 ` [PATCH 10/19] bcache: initialize stripe_sectors_dirty correctly for thin flash device Tang Junhui
2017-06-01 8:48 ` Tang Junhui
2017-06-12 21:18 ` [PATCH 14/19] bcache: Correct return value for sysfs attach errors Tony Asleson
2017-06-12 21:18 ` Tony Asleson
2017-06-28 0:30 ` [PATCH 13/19] bcache: delete redundant calling set_gc_sectors() Tang Junhui
2017-06-28 0:30 ` Tang Junhui
2017-06-28 0:37 ` [PATCH 16/19] bcache: increase the number of open buckets Tang Junhui
2017-06-28 0:37 ` Tang Junhui
2017-06-28 0:41 ` [PATCH 17/19] bcache: fix for gc and write-back race Tang Junhui
2017-06-28 0:41 ` Tang Junhui
2017-06-28 11:47 ` [PATCH 18/19] bcache: silence static checker warning Dan Carpenter
2017-06-28 11:47 ` Dan Carpenter
2017-06-28 11:48 ` [PATCH 19/19] bcache: Update continue_at() documentation Dan Carpenter
2017-06-28 11:48 ` Dan Carpenter
2017-06-29 16:19 ` [PULL] bcache fixes and updates for-4.13 Coly Li
2017-06-29 22:12 ` Eric Wheeler
2017-06-29 22:12 ` Eric Wheeler
2017-06-29 22:25 ` Eric Wheeler
2017-06-29 23:28 ` Nick Alcock
2017-06-30 20:42 ` [PATCH 01/19] bcache: Fix leak of bdev reference bcache
2017-06-30 20:42 ` [PATCH 02/19] bcache: fix sequential large write IO bypass bcache
2017-07-05 18:25 ` Christoph Hellwig
2017-06-30 20:42 ` [PATCH 03/19] bcache: do not subtract sectors_to_gc for bypassed IO bcache
2017-07-01 17:26 ` Coly Li
2017-07-05 18:25 ` Christoph Hellwig
2017-06-30 20:42 ` [PATCH 04/19] bcache: fix wrong cache_misses statistics bcache
2017-07-01 17:58 ` Coly Li
2017-07-13 4:09 ` Eric Wheeler
2017-10-27 19:14 ` Eric Wheeler
2017-06-30 20:42 ` [PATCH 05/19] bcache: fix calling ida_simple_remove() with incorrect minor bcache
2017-07-05 18:26 ` Christoph Hellwig
2017-07-06 6:21 ` tang.junhui
2017-06-30 20:42 ` [PATCH 06/19] bcache: explicitly destory mutex while exiting bcache
2017-07-01 18:43 ` Coly Li
2017-07-05 11:58 ` Liang Chen
2017-07-05 11:58 ` Liang Chen
2017-07-11 7:22 ` Coly Li
2017-07-05 18:27 ` Christoph Hellwig
2017-07-06 1:56 ` Liang Chen
2017-06-30 20:42 ` [PATCH 07/19] bcache: introduce bcache sysfs entries for ioprio-based bypass/writeback hints bcache
2017-07-05 18:47 ` Christoph Hellwig
2017-07-05 21:49 ` Eric Wheeler
2017-06-30 20:42 ` [PATCH 08/19] bcache: documentation for sysfs entries describing bcache cache hinting bcache
2017-07-05 18:27 ` Christoph Hellwig
2017-06-30 20:42 ` [PATCH 09/19] bcache: update bio->bi_opf bypass/writeback REQ_ flag hints bcache
2017-07-01 18:49 ` Coly Li
2017-07-01 19:39 ` Eric Wheeler
2017-07-02 6:51 ` Coly Li
2017-07-03 22:51 ` [PATCH 09/19 v2] " bcache
2017-07-04 4:08 ` Coly Li
2017-07-05 18:48 ` Christoph Hellwig
2017-07-06 7:35 ` Coly Li
2017-07-06 15:24 ` Christoph Hellwig
2017-07-11 3:48 ` Coly Li
2017-07-12 9:18 ` Coly Li
2017-06-30 20:42 ` [PATCH 10/19] bcache: initialize stripe_sectors_dirty correctly for thin flash device bcache
2017-07-01 18:52 ` Coly Li
2017-07-13 4:10 ` Eric Wheeler
2017-06-30 20:43 ` [PATCH 11/19] bcache: Subtract dirty sectors of thin flash from cache_sectors in calculating writeback rate bcache
2017-07-10 18:11 ` Coly Li
[not found] ` <OF92BDA950.86AA00FA-ON4825815A.001F33D9-4825815A.001F5C89@zte.com.cn>
2017-07-13 4:12 ` Eric Wheeler
2017-07-13 4:15 ` Coly Li
2017-10-27 19:12 ` Eric Wheeler
2017-06-30 20:43 ` [PATCH 12/19] bcache: update bucket_in_use periodically bcache
2017-07-11 5:05 ` Coly Li
[not found] ` <OF5C19A8FA.5FF48E0C-ON4825815A.001E6DB1-4825815A.001F14F2@zte.com.cn>
2017-07-11 7:20 ` Coly Li
2017-07-11 13:06 ` Coly Li
2017-07-13 4:13 ` Eric Wheeler
2017-07-13 4:27 ` Coly Li
2017-10-27 19:11 ` Eric Wheeler
2017-10-27 19:45 ` Eric Wheeler
2017-06-30 20:43 ` [PATCH 13/19] bcache: delete redundant calling set_gc_sectors() bcache
2017-07-13 3:41 ` Eric Wheeler
2017-06-30 20:43 ` [PATCH 14/19] bcache: Correct return value for sysfs attach errors bcache
2017-06-30 20:43 ` [PATCH 15/19] bcache: fix issue of writeback rate at minimum 1 key per second bcache
2017-07-16 10:04 ` Coly Li
2017-10-27 19:07 ` Eric Wheeler
2017-10-27 19:09 ` Eric Wheeler
2017-10-28 8:58 ` Coly Li
2017-06-30 20:43 ` [PATCH 16/19] bcache: increase the number of open buckets bcache
2017-06-30 20:43 ` bcache
2017-07-13 9:56 ` Coly Li
2017-06-30 20:43 ` [PATCH 17/19] bcache: fix for gc and write-back race bcache
2017-08-03 16:20 ` Coly Li
2017-06-30 20:43 ` [PATCH 18/19] bcache: silence static checker warning bcache
2017-07-13 9:44 ` Coly Li
2017-06-30 20:43 ` [PATCH 19/19] bcache: Update continue_at() documentation bcache
2017-07-05 18:48 ` Christoph Hellwig
2017-07-08 18:12 ` Coly Li
2017-07-01 16:55 ` [PATCH 01/19] bcache: Fix leak of bdev reference Coly Li
2017-07-05 18:24 ` Christoph Hellwig
2017-09-04 17:30 ` Coly Li
2017-09-05 6:43 ` Christoph Hellwig
2017-09-05 6:55 ` Coly Li
2017-09-06 5:25 ` Coly Li
2017-07-14 11:40 ` [PULL] bcache updates based on git.kernel.dk/linux-block:for-next Eddie Chapman
2017-07-14 15:07 ` Coly Li
2017-07-14 17:33 ` Eddie Chapman
[not found] ` <OF92BA0158.87BDF9E3-ON4825815E.000736BF-4825815E.000833F7@zte.com.cn>
2017-07-18 18:24 ` Eddie Chapman
2017-07-18 18:31 ` Eddie Chapman
2017-07-18 20:06 ` Greg KH
2017-07-18 20:36 ` Eddie Chapman
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=20170629221206.9461F100127@ware.dreamhost.com \
--to=git@linux.ewheeler.net \
--cc=linux-block@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.