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: <9ed0de45f2d7257c56e39efe43606d27@codeaurora.org>
Date:   Fri, 05 Oct 2018 12:54:45 +0530
From:   Arun KS <arunks@...eaurora.org>
To:     Michal Hocko <mhocko@...nel.org>
Cc:     kys@...rosoft.com, haiyangz@...rosoft.com, sthemmin@...rosoft.com,
        boris.ostrovsky@...cle.com, jgross@...e.com,
        akpm@...ux-foundation.org, dan.j.williams@...el.com,
        vbabka@...e.cz, iamjoonsoo.kim@....com, gregkh@...uxfoundation.org,
        osalvador@...e.de, malat@...ian.org,
        kirill.shutemov@...ux.intel.com, jrdr.linux@...il.com,
        yasu.isimatu@...il.com, mgorman@...hsingularity.net,
        aaron.lu@...el.com, devel@...uxdriverproject.org,
        linux-kernel@...r.kernel.org, linux-mm@...ck.org,
        xen-devel@...ts.xenproject.org, vatsa@...eaurora.org,
        vinmenon@...eaurora.org, getarunks@...il.com
Subject: Re: [PATCH v4] memory_hotplug: Free pages as higher order

On 2018-10-04 20:21, Michal Hocko wrote:
> On Wed 03-10-18 19:09:39, Arun KS wrote:
> [...]
>> +static int online_pages_blocks(unsigned long start, unsigned long 
>> nr_pages)
>> +{
>> +	unsigned long end = start + nr_pages;
>> +	int order, ret, onlined_pages = 0;
>> +
>> +	while (start < end) {
>> +		order = min(MAX_ORDER - 1UL, __ffs(start));
>> +
>> +		while (start + (1UL << order) > end)
>> +			order--;
> 
> this really made me scratch my head. Wouldn't it be much simpler to do
> the following?
> 		order = min(MAX_ORDER - 1, get_order(end - start))?

Yes. Much better. Will change to,

                 order = min(MAX_ORDER - 1,
                         get_order(PFN_PHYS(end) - PFN_PHYS(start)));

> 
>> +
>> +		ret = (*online_page_callback)(pfn_to_page(start), order);
>> +		if (!ret)
>> +			onlined_pages += (1UL << order);
>> +		else if (ret > 0)
>> +			onlined_pages += ret;
>> +
>> +		start += (1UL << order);
>> +	}
>> +	return onlined_pages;
>>  }
> [...]
>> -static void __init __free_pages_boot_core(struct page *page, unsigned 
>> int order)
>> +void __free_pages_core(struct page *page, unsigned int order)
>>  {
>>  	unsigned int nr_pages = 1 << order;
>>  	struct page *p = page;
>>  	unsigned int loop;
>> 
>> -	prefetchw(p);
>> -	for (loop = 0; loop < (nr_pages - 1); loop++, p++) {
>> -		prefetchw(p + 1);
>> +	for (loop = 0; loop < nr_pages; loop++, p++) {
>>  		__ClearPageReserved(p);
>>  		set_page_count(p, 0);
>>  	}
>> -	__ClearPageReserved(p);
>> -	set_page_count(p, 0);
>> 
>>  	page_zone(page)->managed_pages += nr_pages;
>>  	set_page_refcounted(page);
> 
> I think this is wort a separate patch as it is unrelated to the patch.
Sure. Will split the patch.

Regards,
Arun

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ