From: Pankaj Raghav <p.raghav@samsung.com>
To: Hannes Reinecke <hare@suse.de>, <willy@infradead.org>,
<david@fromorbit.com>
Cc: <gost.dev@samsung.com>, <mcgrof@kernel.org>, <hch@lst.de>,
<jwong@kernel.org>, <linux-fsdevel@vger.kernel.org>,
<linux-kernel@vger.kernel.org>
Subject: Re: [RFC 2/4] filemap: use minimum order while allocating folios
Date: Wed, 21 Jun 2023 12:25:45 +0200 [thread overview]
Message-ID: <b57c76b8-aaf5-d245-6c0e-a3afdfd96643@samsung.com> (raw)
In-Reply-To: <d0b77326-e93f-c1dc-c46c-1213bfafd7ee@suse.de>
>> index 47afbca1d122..090b810ddeed 100644
>> --- a/mm/readahead.c
>> +++ b/mm/readahead.c
>> @@ -245,7 +245,8 @@ void page_cache_ra_unbounded(struct readahead_control *ractl,
>> continue;
>> }
>> - folio = filemap_alloc_folio(gfp_mask, 0);
>> + folio = filemap_alloc_folio(gfp_mask,
>> + mapping_min_folio_order(mapping));
>> if (!folio)
>> break;
>> if (filemap_add_folio(mapping, folio, index + i,
>> @@ -259,7 +260,8 @@ void page_cache_ra_unbounded(struct readahead_control *ractl,
>> if (i == nr_to_read - lookahead_size)
>> folio_set_readahead(folio);
>> ractl->_workingset |= folio_test_workingset(folio);
>> - ractl->_nr_pages++;
>> + ractl->_nr_pages += folio_nr_pages(folio);
>> + i += folio_nr_pages(folio) - 1;
>> }
>> /*
> This is incomplete, as the loop above has some exit statements which blindly step backwards by one
> page.
>
> I found it better to rework the 'for' into a 'while' loop; please check the attached patch.
>
Taken from your patch:
@@ -240,8 +240,8 @@ void page_cache_ra_unbounded(struct readahead_control *ractl,
* not worth getting one just for that.
*/
read_pages(ractl);
- ractl->_index++;
- i = ractl->_index + ractl->_nr_pages - index - 1;
+ ractl->_index += folio_nr_pages(folio);
+ i = ractl->_index + ractl->_nr_pages - index;
IIUC, we don't need to update the _index after read_pages() as it already modifies it. We just need
to move ractl->_index by 1 to move to the next index.
> Cheers,
>
> Hannes
next prev parent reply other threads:[~2023-06-21 10:26 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <CGME20230621083825eucas1p1b05a6d7e0bf90e7a3d8e621f6578ff0a@eucas1p1.samsung.com>
2023-06-21 8:38 ` [RFC 0/4] minimum folio order support in filemap Pankaj Raghav
[not found] ` <CGME20230621083826eucas1p11fc8d3e023caafa8b30fd04c66c9c7d0@eucas1p1.samsung.com>
2023-06-21 8:38 ` [RFC 1/4] fs: Allow fine-grained control of folio sizes Pankaj Raghav
2023-06-21 9:02 ` Hannes Reinecke
[not found] ` <CGME20230621083827eucas1p2948b4efaf55064c3761c924b5b049219@eucas1p2.samsung.com>
2023-06-21 8:38 ` [RFC 2/4] filemap: use minimum order while allocating folios Pankaj Raghav
2023-06-21 8:59 ` Hannes Reinecke
2023-06-21 10:25 ` Pankaj Raghav [this message]
[not found] ` <CGME20230621083828eucas1p23222cae535297f9536f12dddd485f97b@eucas1p2.samsung.com>
2023-06-21 8:38 ` [RFC 3/4] block: set mapping order for the block cache in set_init_blocksize Pankaj Raghav
2023-06-21 9:05 ` Hannes Reinecke
2023-06-21 10:42 ` Pankaj Raghav
2023-06-21 11:02 ` Hannes Reinecke
2023-06-21 12:02 ` Pankaj Raghav
2023-06-24 8:35 ` kernel test robot
[not found] ` <CGME20230621083830eucas1p1c7e6ea9e23949a9688aac6f9f3ea25fb@eucas1p1.samsung.com>
2023-06-21 8:38 ` [RFC 4/4] nvme: enable logical block size > PAGE_SIZE Pankaj Raghav
2023-06-21 9:07 ` Hannes Reinecke
2023-06-21 10:47 ` Pankaj Raghav
2023-06-21 9:00 ` [RFC 0/4] minimum folio order support in filemap Hannes Reinecke
2023-06-21 22:07 ` Dave Chinner
2023-06-22 5:51 ` Hannes Reinecke
2023-06-22 6:50 ` Hannes Reinecke
2023-06-22 10:20 ` Dave Chinner
2023-06-22 10:23 ` Hannes Reinecke
2023-06-22 22:33 ` Dave Chinner
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=b57c76b8-aaf5-d245-6c0e-a3afdfd96643@samsung.com \
--to=p.raghav@samsung.com \
--cc=david@fromorbit.com \
--cc=gost.dev@samsung.com \
--cc=hare@suse.de \
--cc=hch@lst.de \
--cc=jwong@kernel.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mcgrof@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
all inboxes | Powered by JetHome®