linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Arun KS <arunks@codeaurora.org>
To: Michal Hocko <mhocko@kernel.org>
Cc: kys@microsoft.com, haiyangz@microsoft.com,
	sthemmin@microsoft.com, boris.ostrovsky@oracle.com,
	jgross@suse.com, akpm@linux-foundation.org,
	dan.j.williams@intel.com, vbabka@suse.cz, iamjoonsoo.kim@lge.com,
	gregkh@linuxfoundation.org, osalvador@suse.de, malat@debian.org,
	kirill.shutemov@linux.intel.com, jrdr.linux@gmail.com,
	yasu.isimatu@gmail.com, mgorman@techsingularity.net,
	aaron.lu@intel.com, devel@linuxdriverproject.org,
	linux-kernel@vger.kernel.org, linux-mm@kvack.org,
	xen-devel@lists.xenproject.org, vatsa@codeaurora.org,
	vinmenon@codeaurora.org, getarunks@gmail.com
Subject: Re: [PATCH v4] memory_hotplug: Free pages as higher order
Date: Fri, 05 Oct 2018 12:54:45 +0530	[thread overview]
Message-ID: <9ed0de45f2d7257c56e39efe43606d27@codeaurora.org> (raw)
In-Reply-To: <20181004145108.GH22173@dhcp22.suse.cz>

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

      reply	other threads:[~2018-10-05  7:24 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-10-03 13:39 [PATCH v4] memory_hotplug: Free pages as higher order Arun KS
2018-10-04 14:51 ` Michal Hocko
2018-10-05  7:24   ` Arun KS [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=9ed0de45f2d7257c56e39efe43606d27@codeaurora.org \
    --to=arunks@codeaurora.org \
    --cc=aaron.lu@intel.com \
    --cc=akpm@linux-foundation.org \
    --cc=boris.ostrovsky@oracle.com \
    --cc=dan.j.williams@intel.com \
    --cc=devel@linuxdriverproject.org \
    --cc=getarunks@gmail.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=haiyangz@microsoft.com \
    --cc=iamjoonsoo.kim@lge.com \
    --cc=jgross@suse.com \
    --cc=jrdr.linux@gmail.com \
    --cc=kirill.shutemov@linux.intel.com \
    --cc=kys@microsoft.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=malat@debian.org \
    --cc=mgorman@techsingularity.net \
    --cc=mhocko@kernel.org \
    --cc=osalvador@suse.de \
    --cc=sthemmin@microsoft.com \
    --cc=vatsa@codeaurora.org \
    --cc=vbabka@suse.cz \
    --cc=vinmenon@codeaurora.org \
    --cc=xen-devel@lists.xenproject.org \
    --cc=yasu.isimatu@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).