From: Michal Hocko <mhocko@kernel.org>
To: Arun KS <arunks@codeaurora.org>
Cc: Alexander Duyck <alexander.h.duyck@linux.intel.com>,
arunks.linux@gmail.com, akpm@linux-foundation.org,
vbabka@suse.cz, osalvador@suse.de, linux-kernel@vger.kernel.org,
linux-mm@kvack.org, getarunks@gmail.com
Subject: Re: [PATCH v9] mm/page_alloc.c: memory_hotplug: free pages as higher order
Date: Mon, 14 Jan 2019 15:32:51 +0100 [thread overview]
Message-ID: <20190114143251.GI21345@dhcp22.suse.cz> (raw)
In-Reply-To: <fa3dc06536a8ba980c4434806204017a@codeaurora.org>
On Mon 14-01-19 19:29:39, Arun KS wrote:
> On 2019-01-10 21:53, Alexander Duyck wrote:
[...]
> > Couldn't you just do something like the following:
> > if ((end - start) >= (1UL << (MAX_ORDER - 1))
> > order = MAX_ORDER - 1;
> > else
> > order = __fls(end - start);
> >
> > I would think this would save you a few steps in terms of conversions
> > and such since you are already working in page frame numbers anyway so
> > a block of 8 pfns would represent an order 3 page wouldn't it?
> >
> > Also it seems like an alternative to using "end" would be to just track
> > nr_pages. Then you wouldn't have to do the "end - start" math in a few
> > spots as long as you remembered to decrement nr_pages by the amount you
> > increment start by.
>
> Thanks for that. How about this?
>
> static int online_pages_blocks(unsigned long start, unsigned long nr_pages)
> {
> unsigned long end = start + nr_pages;
> int order;
>
> while (nr_pages) {
> if (nr_pages >= (1UL << (MAX_ORDER - 1)))
> order = MAX_ORDER - 1;
> else
> order = __fls(nr_pages);
>
> (*online_page_callback)(pfn_to_page(start), order);
> nr_pages -= (1UL << order);
> start += (1UL << order);
> }
> return end - start;
> }
I find this much less readable so if this is really a big win
performance wise then make it a separate patch with some nubbers please.
--
Michal Hocko
SUSE Labs
next prev parent reply other threads:[~2019-01-14 14:32 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-01-10 5:35 Arun KS
2019-01-10 9:51 ` Michal Hocko
2019-01-10 16:23 ` Alexander Duyck
2019-01-10 16:23 ` Alexander Duyck
2019-01-14 13:59 ` Arun KS
2019-01-14 14:32 ` Michal Hocko [this message]
2019-01-14 16:41 ` Alexander Duyck
2019-01-14 16:41 ` Alexander Duyck
2019-01-14 16:15 ` Alexander Duyck
2019-01-14 16:15 ` Alexander Duyck
2019-01-14 16:32 ` Arun KS
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=20190114143251.GI21345@dhcp22.suse.cz \
--to=mhocko@kernel.org \
--cc=akpm@linux-foundation.org \
--cc=alexander.h.duyck@linux.intel.com \
--cc=arunks.linux@gmail.com \
--cc=arunks@codeaurora.org \
--cc=getarunks@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=osalvador@suse.de \
--cc=vbabka@suse.cz \
/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