All of lore.kernel.org
 help / color / mirror / Atom feed
From: Michal Rostecki <mrostecki@suse.de>
To: "Michał Mirosław" <mirq-linux@rere.qmqm.pl>
Cc: Chris Mason <clm@fb.com>, Josef Bacik <josef@toxicpanda.com>,
	David Sterba <dsterba@suse.com>,
	"open list:BTRFS FILE SYSTEM" <linux-btrfs@vger.kernel.org>,
	open list <linux-kernel@vger.kernel.org>,
	Michal Rostecki <mrostecki@suse.com>
Subject: Re: [PATCH RFC 6/6] btrfs: Add roundrobin raid1 read policy
Date: Thu, 11 Feb 2021 12:35:34 +0000	[thread overview]
Message-ID: <20210211123534.GA1263@wotan.suse.de> (raw)
In-Reply-To: <20210211022738.GB4933@qmqm.qmqm.pl>

On Thu, Feb 11, 2021 at 03:27:38AM +0100, Michał Mirosław wrote:
> On Wed, Feb 10, 2021 at 07:23:04PM +0000, Michal Rostecki wrote:
> > On Wed, Feb 10, 2021 at 01:58:15PM +0100, Michał Mirosław wrote:
> > > On Wed, Feb 10, 2021 at 12:29:25PM +0000, Michal Rostecki wrote:
> > > > On Wed, Feb 10, 2021 at 05:24:28AM +0100, Michał Mirosław wrote:
> > > > > This looks like it effectively decreases queue depth for non-last
> > > > > device. After all devices are filled to queue_depth-penalty, only
> > > > > a single mirror will be selected for next reads (until a read on
> > > > > some other one completes).
> > > > > 
> > > > 
> > > > Good point. And if all devices are going to be filled for longer time,
> > > > this function will keep selecting the last one. Maybe I should select
> > > > last+1 in that case. Would that address your concern or did you have any
> > > > other solution in mind?
> > > 
> > > The best would be to postpone the selection until one device becomes free
> > > again. But if that's not doable, then yes, you could make sure it stays
> > > round-robin after filling the queues (the scheduling will loose the
> > > "penalty"-driven adjustment though).
> > 
> > Or another idea - when all the queues are filled, return the mirror
> > which has the lowest load (inflight + penalty), even though it's greater
> > than queue depth. In that case the scheduling will not lose the penalty
> > adjustment and the load is going to be spreaded more fair.
> > 
> > I'm not sure if postponing the selection is that good idea. I think it's
> > better if the request is added to the iosched queue anyway, even if the
> > disks' queues are filled, and let the I/O scheduler handle that. The
> > length of the iosched queue (nr_requests, attribute of the iosched) is
> > usually greater than queue depth (attribute of the devide), which means
> > that it's fine to schedule more requests for iosched to handle.
> > 
> > IMO btrfs should use the information given by iosched only for heuristic
> > mirror selection, rather than implement its own throttling logic.
> > 
> > Does it make sense to you?
> > 
> > An another idea could be an additional iteration in regard to
> > nr_requests, if all load values are greater than queue depths, though it
> > might be an overkill. I would prefer to stick to my first idea if
> > everyone agrees.
> 
> What if iosched could provide an estimate of request's latency? Then
> btrfs could always select the lowest. For reads from NVME/SSD I would
> normally expect something simple: speed_factor * (pending_bytes + req_bytes).
> For HDDs this could do more computation like looking into what is there
> in the queue already.
> 
> This would deviate from simple round-robin scheme, though.

I think that idea is close to what Anand Jain did in his latency
policy, though instead of trying to predict the latency of the currently
scheduled request, it uses stats about previous read operations:

https://patchwork.kernel.org/project/linux-btrfs/patch/63f6f00e2ecc741efd2200c3c87b5db52c6be2fd.1611114341.git.anand.jain@oracle.com/

Indeed your idea would deviate from the simple round-robin, so maybe it
would be good to try it, but as a separate policy in a separate
patch(set).

Regards,
Michal

  reply	other threads:[~2021-02-11 12:40 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-02-09 20:30 [PATCH RFC 0/6] Add roundrobin raid1 read policy Michal Rostecki
2021-02-09 20:30 ` [PATCH RFC 1/6] btrfs: Add inflight BIO request counter Michal Rostecki
2021-02-09 20:30 ` [PATCH RFC 2/6] btrfs: Store the last device I/O offset Michal Rostecki
2021-02-09 20:30 ` [PATCH RFC 3/6] btrfs: Add stripe_physical function Michal Rostecki
2021-02-09 20:30 ` [PATCH RFC 4/6] btrfs: Check if the filesystem is has mixed type of devices Michal Rostecki
2021-02-10  4:08   ` Michał Mirosław
2021-02-10 12:50     ` Michal Rostecki
2021-02-12 18:26     ` Michal Rostecki
2021-02-12 23:36       ` Michał Mirosław
2021-02-15 14:40         ` Michal Rostecki
2021-02-10  8:09   ` Dan Carpenter
2021-02-10  8:09     ` Dan Carpenter
2021-02-10 10:09   ` Filipe Manana
2021-02-10 12:55     ` Michal Rostecki
2021-02-09 20:30 ` [PATCH RFC 5/6] btrfs: sysfs: Add directory for read policies Michal Rostecki
2021-02-13 10:19   ` Greg KH
2021-02-15 14:35     ` Michal Rostecki
2021-02-15 14:59       ` Greg KH
2021-02-09 20:30 ` [PATCH RFC 6/6] btrfs: Add roundrobin raid1 read policy Michal Rostecki
2021-02-10  4:24   ` Michał Mirosław
2021-02-10 12:29     ` Michal Rostecki
2021-02-10 12:58       ` Michał Mirosław
2021-02-10 19:23         ` Michal Rostecki
2021-02-11  2:27           ` Michał Mirosław
2021-02-11 12:35             ` Michal Rostecki [this message]
2021-02-10  8:20   ` Anand Jain
2021-02-11 15:55     ` Michal Rostecki
2021-02-12 17:12       ` Michal Rostecki
2021-02-10  6:52 ` [PATCH RFC 0/6] " Anand Jain
2021-02-10 12:18   ` Michal Rostecki
2021-02-10 14:00     ` Michal Rostecki

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=20210211123534.GA1263@wotan.suse.de \
    --to=mrostecki@suse.de \
    --cc=clm@fb.com \
    --cc=dsterba@suse.com \
    --cc=josef@toxicpanda.com \
    --cc=linux-btrfs@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mirq-linux@rere.qmqm.pl \
    --cc=mrostecki@suse.com \
    /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.