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] [day] [month] [year] [list]
Message-ID: <261604C5-E25E-4216-A9D4-BD5490E5E89A@nvidia.com>
Date:   Tue, 2 Mar 2021 12:47:20 -0500
From:   Zi Yan <ziy@...dia.com>
To:     Matthew Wilcox <willy@...radead.org>
CC:     <linux-fsdevel@...r.kernel.org>, <linux-mm@...ck.org>,
        <linux-kernel@...r.kernel.org>,
        Mike Kravetz <mike.kravetz@...cle.com>
Subject: Re: [PATCH v3 01/25] mm: Introduce struct folio

On 2 Mar 2021, at 8:22, Matthew Wilcox wrote:

> On Mon, Mar 01, 2021 at 03:26:11PM -0500, Zi Yan wrote:
>>> +static inline struct folio *next_folio(struct folio *folio)
>>> +{
>>> +	return folio + folio_nr_pages(folio);
>>
>> Are you planning to make hugetlb use folio too?
>>
>> If yes, this might not work if we have CONFIG_SPARSEMEM && !CONFIG_SPARSEMEM_VMEMMAP
>> with a hugetlb folio > MAX_ORDER, because struct page might not be virtually contiguous.
>> See the experiment I did in [1].
>
> Actually, how about proofing this against a future change?
>
> static inline struct folio *next_folio(struct folio *folio)
> {
> #if defined(CONFIG_SPARSEMEM) && !defined(CONFIG_SPARSEMEM_VMEMMAP)
> 	pfn_t next_pfn = page_to_pfn(&folio->page) + folio_nr_pages(folio);
> 	return (struct folio *)pfn_to_page(next_pfn);
> #else
> 	return folio + folio_nr_pages(folio);
> #endif
> }
>
> (not compiled)

Yes, it should work. A better version might be that in the top half
you check folio order first and if the order >= MAX_ORDER, we use
the complicated code, otherwise just folio+folio_nr_pages(folio).

This CONFIG_SPARSEMEM && !CONFIG_SPARSEMEM_VMEMMAP is really not friendly
to >=MAX_ORDER pages. Most likely I am going to make 1GB THP
rely on CONFIG_SPARSEMEM_VMEMMAP to avoid complicated code.

—
Best Regards,
Yan Zi

Download attachment "signature.asc" of type "application/pgp-signature" (855 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ