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]
Date:   Wed, 18 Nov 2020 14:54:25 -0800
From:   Mike Kravetz <mike.kravetz@...cle.com>
To:     Oscar Salvador <osalvador@...e.de>,
        Muchun Song <songmuchun@...edance.com>
Cc:     corbet@....net, tglx@...utronix.de, mingo@...hat.com, bp@...en8.de,
        x86@...nel.org, hpa@...or.com, dave.hansen@...ux.intel.com,
        luto@...nel.org, peterz@...radead.org, viro@...iv.linux.org.uk,
        akpm@...ux-foundation.org, paulmck@...nel.org,
        mchehab+huawei@...nel.org, pawan.kumar.gupta@...ux.intel.com,
        rdunlap@...radead.org, oneukum@...e.com, anshuman.khandual@....com,
        jroedel@...e.de, almasrymina@...gle.com, rientjes@...gle.com,
        willy@...radead.org, mhocko@...e.com, duanxiongchun@...edance.com,
        linux-doc@...r.kernel.org, linux-kernel@...r.kernel.org,
        linux-mm@...ck.org, linux-fsdevel@...r.kernel.org
Subject: Re: [PATCH v4 04/21] mm/hugetlb: Introduce nr_free_vmemmap_pages in
 the struct hstate

On 11/16/20 5:33 AM, Oscar Salvador wrote:
> On Fri, Nov 13, 2020 at 06:59:35PM +0800, Muchun Song wrote:
>> +void __init hugetlb_vmemmap_init(struct hstate *h)
>> +{
>> +	unsigned int order = huge_page_order(h);
>> +	unsigned int vmemmap_pages;
>> +
>> +	vmemmap_pages = ((1 << order) * sizeof(struct page)) >> PAGE_SHIFT;
>> +	/*
>> +	 * The head page and the first tail page are not to be freed to buddy
>> +	 * system, the others page will map to the first tail page. So there
> "the remaining pages" might be more clear.
> 
>> +	 * are (@vmemmap_pages - RESERVE_VMEMMAP_NR) pages can be freed.
> "that can be freed"
> 
>> +	 *
>> +	 * Could RESERVE_VMEMMAP_NR be greater than @vmemmap_pages? This is
>> +	 * not expected to happen unless the system is corrupted. So on the
>> +	 * safe side, it is only a safety net.
>> +	 */
>> +	if (likely(vmemmap_pages > RESERVE_VMEMMAP_NR))
>> +		h->nr_free_vmemmap_pages = vmemmap_pages - RESERVE_VMEMMAP_NR;
>> +	else
>> +		h->nr_free_vmemmap_pages = 0;
> 
> This made think of something.
> Since struct hstate hstates is global, all the fields should be defined to 0.
> So, the following assignments in hugetlb_add_hstate:
> 
>         h->nr_huge_pages = 0;
>         h->free_huge_pages = 0;
> 
> should not be needed.
> Actually, we do not initialize other values like resv_huge_pages
> or surplus_huge_pages.
> 
> If that is the case, the "else" could go.
> 
> Mike?

Correct.  Those assignments have been in the code for a very long time.

> The changes itself look good to me.
> I think that putting all the vemmap stuff into hugetlb-vmemmap.* was
> the right choice.

Agree!
-- 
Mike Kravetz

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ