linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Michal Rostecki <mrostecki@suse.de>
To: Anand Jain <anand.jain@oracle.com>
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: Fri, 12 Feb 2021 17:12:58 +0000	[thread overview]
Message-ID: <20210212171246.GA20817@wotan.suse.de> (raw)
In-Reply-To: <20210211155533.GB1263@wotan.suse.de>

Hi Anand,

re: inflight calculation

On Thu, Feb 11, 2021 at 03:55:33PM +0000, Michal Rostecki wrote:
> > It is better to have random workloads in the above three categories
> > of configs.
> > 
> > Apart from the above three configs, there is also
> >  all-non-rotational with hetero
> > For example, ssd and nvme together both are non-rotational.
> > And,
> >  all-rotational with hetero
> > For example, rotational disks with different speeds.
> > 
> > 
> > The inflight calculation is local to btrfs. If the device is busy due to
> > external factors, it would not switch to the better performing device.
> > 
> 
> Good point. Maybe I should try to use the part stats instead of storing
> inflight locally in btrfs.

I tried today to reuse the inflight calculation which is done for
iostat. And I came to conclusion that it's impossible without exporting
some methods from the block/ subsystem.

The thing is that there are two methods of calculating inflight. Which
one of them is used, depends on queue_is_mq():

https://github.com/kdave/btrfs-devel/blob/9d294a685fbcb256ce8c5f7fd88a7596d0f52a8a/block/genhd.c#L1163

And if that condition is true, I noticed that part_stats return 0, even
though there are processed requests (I checked with fio inside VM).

In general, those two methods of checking inflight are:

1) part_stats - which would be trivial to reuse, just a matter of one
   simple for_each_possible_cpu() loop with part_stat_local_read_cpu()

https://github.com/kdave/btrfs-devel/blob/9d294a685fbcb256ce8c5f7fd88a7596d0f52a8a/block/genhd.c#L133-L146

2) blk_mq_in_flight() - which has a lot of code and unexported
   structs inside the block/ directory, double function callback;
   definitely not easy to reimplement easily in btrfs without copying
   dozens of lines

https://github.com/kdave/btrfs-devel/blob/9d294a685fbcb256ce8c5f7fd88a7596d0f52a8a/block/blk-mq.c#L115-L123

Well, I tried copying the whole blk_mq_in_flight() function with all
dependencies anyway, hard to do without causing modpost errors.

So, to sum it up, I think that making 2) possible to reuse in btrfs
would require at lest exporting the blk_mq_in_flight() function,
therefore the change would have to go through linux-block tree. Which
maybe would be a good thing to do in long term, not sure if it should
block my patchset entirely.

The question is if we are fine with inflight stats inside btrfs.
Personally I think we sholdn't be concerned too much about it. The
inflight counter in my patches is a percpu counted, used in places which
already do some atomic operations.

Thanks,
Michal

  reply	other threads:[~2021-02-12 17:14 UTC|newest]

Thread overview: 29+ 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 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
2021-02-10  8:20   ` Anand Jain
2021-02-11 15:55     ` Michal Rostecki
2021-02-12 17:12       ` Michal Rostecki [this message]
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=20210212171246.GA20817@wotan.suse.de \
    --to=mrostecki@suse.de \
    --cc=anand.jain@oracle.com \
    --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=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 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).