public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Jens Axboe <axboe@kernel.dk>
To: Matthew Wilcox <willy@infradead.org>
Cc: OGAWA Hirofumi <hirofumi@mail.parknet.co.jp>,
	Andrew Morton <akpm@linux-foundation.org>,
	linux-kernel <linux-kernel@vger.kernel.org>,
	fsdevel <linux-fsdevel@vger.kernel.org>
Subject: Re: [PATCH] fat: Avoid oops when bdi->io_pages==0
Date: Mon, 31 Aug 2020 11:00:14 -0600	[thread overview]
Message-ID: <33eb2820-894e-a42f-61a5-c25bc52345d5@kernel.dk> (raw)
In-Reply-To: <20200831165659.GH14765@casper.infradead.org>

On 8/31/20 10:56 AM, Matthew Wilcox wrote:
> On Mon, Aug 31, 2020 at 10:39:26AM -0600, Jens Axboe wrote:
>> We really should ensure that ->io_pages is always set, imho, instead of
>> having to work-around it in other spots.
> 
> Interestingly, there are only three places in the entire kernel which
> _use_ bdi->io_pages.  FAT, Verity and the pagecache readahead code.
> 
> Verity:
>                         unsigned long num_ra_pages =
>                                 min_t(unsigned long, num_blocks_to_hash - i,
>                                       inode->i_sb->s_bdi->io_pages);
> 
> FAT:
>         if (ra_pages > sb->s_bdi->io_pages)
>                 ra_pages = rounddown(ra_pages, sb->s_bdi->io_pages);
> 
> Pagecache:
>         max_pages = max_t(unsigned long, bdi->io_pages, ra->ra_pages);
> and
>         if (req_size > max_pages && bdi->io_pages > max_pages)
>                 max_pages = min(req_size, bdi->io_pages);
> 
> The funny thing is that all three are using it differently.  Verity is
> taking io_pages to be the maximum amount to readahead.  FAT is using
> it as the unit of readahead (round down to the previous multiple) and
> the pagecache uses it to limit reads that exceed the current per-file
> readahead limit (but allows per-file readahead to exceed io_pages,
> in which case it has no effect).
> 
> So how should it be used?  My inclination is to say that the pagecache
> is right, by virtue of being the most-used.

When I added ->io_pages, it was for the page cache use case. The others
grew after that...

-- 
Jens Axboe


  reply	other threads:[~2020-08-31 17:00 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-08-30  0:59 [PATCH] fat: Avoid oops when bdi->io_pages==0 OGAWA Hirofumi
2020-08-30  1:21 ` Matthew Wilcox
2020-08-30  1:54   ` OGAWA Hirofumi
2020-08-30  3:53     ` Matthew Wilcox
2020-08-30  9:04       ` OGAWA Hirofumi
2020-08-30 14:01 ` Sasha Levin
2020-08-30 14:16   ` OGAWA Hirofumi
2020-08-31 15:22 ` Jens Axboe
2020-08-31 16:37   ` OGAWA Hirofumi
2020-08-31 16:39     ` Jens Axboe
2020-08-31 16:56       ` Matthew Wilcox
2020-08-31 17:00         ` Jens Axboe [this message]
2020-08-31 17:39           ` OGAWA Hirofumi
2020-08-31 17:16       ` OGAWA Hirofumi
2020-08-31 17:19         ` Jens Axboe

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=33eb2820-894e-a42f-61a5-c25bc52345d5@kernel.dk \
    --to=axboe@kernel.dk \
    --cc=akpm@linux-foundation.org \
    --cc=hirofumi@mail.parknet.co.jp \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=willy@infradead.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