From: Christoph Hellwig <hch@infradead.org>
To: bcache@lists.ewheeler.net
Cc: linux-block@vger.kernel.org, linux-bcache@vger.kernel.org,
hch@infradead.org, axboe@kernel.dk,
Eric Wheeler <git@linux.ewheeler.net>,
Eric Wheeler <bcache@linux.ewheeler.net>,
nix@esperi.org.uk
Subject: Re: [PATCH 07/19] bcache: introduce bcache sysfs entries for ioprio-based bypass/writeback hints
Date: Wed, 5 Jul 2017 11:47:19 -0700 [thread overview]
Message-ID: <20170705184719.GA3234@infradead.org> (raw)
In-Reply-To: <1498855388-16990-7-git-send-email-bcache@lists.ewheeler.net>
On Fri, Jun 30, 2017 at 01:42:56PM -0700, bcache@lists.ewheeler.net wrote:
> From: Eric Wheeler <git@linux.ewheeler.net>
>
> Add sysfs entries to support to hint for bypass/writeback by the ioprio
> assigned to the bio. If the bio is unassigned, use current's io-context
> ioprio for cache writeback or bypass (configured per-process with
> `ionice`).
>
> 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.
>
> If you really nead the performance at the expense of SSD wearout,
> then configure ioprio_writeback and set your `ionice` appropriately.
>
> For example:
> echo 2,7 > /sys/block/bcache0/bcache/ioprio_bypass
> echo 2,0 > /sys/block/bcache0/bcache/ioprio_writeback
>
> See the documentation commit for details.
I'm really worried about this interface, as it basically uses the
ioprio field for side channel communication - your app must know
which value it wants, and you need to configure bcache to fit
exacltly that scheme.
> + /* If the ioprio already exists on the bio, use that. We assume that
> + * the upper layer properly assigned the calling process's ioprio to
> + * the bio being passed to bcache. Otherwise, use current's ioc. */
Please make this fit the normal kernel comment style.
> + ioprio = bio_prio(bio);
> + if (!ioprio_valid(ioprio)) {
> + ioc = get_task_io_context(current, GFP_NOIO, NUMA_NO_NODE);
> + if (ioc) {
> + if (ioprio_valid(ioc->ioprio))
> + ioprio = ioc->ioprio;
> + put_io_context(ioc);
> + ioc = NULL;
> + }
> + }
While get_task_io_context currently is exported it really should not
be - we should only allocate on when setting the io priority or when
forking.
What this code really wants is the ioprio related lines of code from
blk_init_request_from_bio, which should be factored into a new helper.
> + if (ioprio_valid(ioprio) && ioprio_valid(dc->ioprio_writeback)
> + && ioprio >= dc->ioprio_bypass) {
> + return true;
> + }
Incorrect indentation, this shold be:
if (ioprio_valid(ioprio) && ioprio_valid(dc->ioprio_writeback) &&
ioprio >= dc->ioprio_bypass)
return true;
And there is some more of this in this and the following patches.
Please run them through something like checkpatch.pl
> +
> SHOW(__bch_cached_dev)
> {
> struct cached_dev *dc = container_of(kobj, struct cached_dev,
> @@ -183,6 +186,17 @@ SHOW(__bch_cached_dev)
> return strlen(buf);
> }
>
> + if (attr == &sysfs_ioprio_bypass)
> + return snprintf(buf, PAGE_SIZE-1, "%d,%ld\n",
> + IOPRIO_PRIO_CLASS(dc->ioprio_bypass),
> + IOPRIO_PRIO_DATA(dc->ioprio_bypass));
> +
> + if (attr == &sysfs_ioprio_writeback)
> + return snprintf(buf, PAGE_SIZE-1, "%d,%ld\n",
> + IOPRIO_PRIO_CLASS(dc->ioprio_writeback),
> + IOPRIO_PRIO_DATA(dc->ioprio_writeback));
> +
> +
Please implement separate sysfs show and store function for your new
attributes instead of overloading all of them into a giant mess.
next prev parent reply other threads:[~2017-07-05 18:47 UTC|newest]
Thread overview: 86+ 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-29 13:45 ` Christoph Hellwig
2017-06-29 16:19 ` Coly Li
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 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-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 [this message]
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-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
[not found] ` <1498855388-16990-5-git-send-email-bcache@lists.ewheeler.net>
2017-07-05 18:26 ` [PATCH 05/19] bcache: fix calling ida_simple_remove() with incorrect minor Christoph Hellwig
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=20170705184719.GA3234@infradead.org \
--to=hch@infradead.org \
--cc=axboe@kernel.dk \
--cc=bcache@linux.ewheeler.net \
--cc=bcache@lists.ewheeler.net \
--cc=git@linux.ewheeler.net \
--cc=linux-bcache@vger.kernel.org \
--cc=linux-block@vger.kernel.org \
--cc=nix@esperi.org.uk \
/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).