lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <b57c76b8-aaf5-d245-6c0e-a3afdfd96643@samsung.com>
Date:   Wed, 21 Jun 2023 12:25:45 +0200
From:   Pankaj Raghav <p.raghav@...sung.com>
To:     Hannes Reinecke <hare@...e.de>, <willy@...radead.org>,
        <david@...morbit.com>
CC:     <gost.dev@...sung.com>, <mcgrof@...nel.org>, <hch@....de>,
        <jwong@...nel.org>, <linux-fsdevel@...r.kernel.org>,
        <linux-kernel@...r.kernel.org>
Subject: Re: [RFC 2/4] filemap: use minimum order while allocating folios

>> 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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ