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: <294314f1-d306-0eb9-059c-f10cb79b9e76@arm.com>
Date:   Wed, 1 Jun 2022 12:28:44 +0530
From:   Anshuman Khandual <anshuman.khandual@....com>
To:     Mike Kravetz <mike.kravetz@...cle.com>,
        Muchun Song <songmuchun@...edance.com>,
        Peter Xu <peterx@...hat.com>
Cc:     linux-kernel@...r.kernel.org, linux-mm@...ck.org,
        Michal Hocko <mhocko@...e.com>,
        Naoya Horiguchi <naoya.horiguchi@...ux.dev>,
        James Houghton <jthoughton@...gle.com>,
        Mina Almasry <almasrymina@...gle.com>,
        "Aneesh Kumar K . V" <aneesh.kumar@...ux.vnet.ibm.com>,
        Paul Walmsley <paul.walmsley@...ive.com>,
        Christian Borntraeger <borntraeger@...ux.ibm.com>,
        Andrew Morton <akpm@...ux-foundation.org>
Subject: Re: [RFC PATCH 1/3] hugetlb: skip to end of PT page mapping when pte
 not present



On 5/31/22 22:35, Mike Kravetz wrote:
> On 5/30/22 19:04, Muchun Song wrote:
>> On Mon, May 30, 2022 at 03:56:43PM -0400, Peter Xu wrote:
>>> Hi, Mike,
>>>
>>> On Fri, May 27, 2022 at 03:58:47PM -0700, Mike Kravetz wrote:
>>>> +unsigned long hugetlb_mask_last_hp(struct hstate *h)
>>>> +{
>>>> +	unsigned long hp_size = huge_page_size(h);
>>>> +
>>>> +	if (hp_size == P4D_SIZE)
>>>> +		return PGDIR_SIZE - P4D_SIZE;
>>>> +	else if (hp_size == PUD_SIZE)
>>>> +		return P4D_SIZE - PUD_SIZE;
>>>> +	else if (hp_size == PMD_SIZE)
>>>> +		return PUD_SIZE - PMD_SIZE;
>>>> +
>>>> +	return ~(0);
>>>> +}
>>>
>>> How about:
>>>
>>> unsigned long hugetlb_mask_last_hp(struct hstate *h)
>>> {
>>> 	unsigned long hp_size = huge_page_size(h);
>>>
>>> 	return hp_size * (PTRS_PER_PTE - 1);
>>> }
>>>
>>
>> +1
>>  
> 
> 
> I like this as well, but I wonder if we should put something like the
> following in just to be safe.
> 
> BUILD_BUG_ON(PTRS_PER_PTE != PTRS_PER_PMD);
> BUILD_BUG_ON(PTRS_PER_PTE != PTRS_PER_PUD);
> BUILD_BUG_ON(PTRS_PER_PTE != PTRS_PER_P4D);
Exactly, assuming that PTRS_PER_PTE entries are present per page table page for
all supported HugeTLB levels might be bit risky, particularly for the top level.
Hence rather than all these additional BUILD_BUG_ON() checks for using standard
page table page entries i.e PTRS_PER_PTE, it might be better to just stick with
the original check either via 'if else' as proposed or better with a switch case.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ