From: Mark Rutland <mark.rutland@arm.com>
To: Anshuman Khandual <anshuman.khandual@arm.com>
Cc: Steve Capper <Steve.Capper@arm.com>,
"linux-mm@kvack.org" <linux-mm@kvack.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"linux-arm-kernel@lists.infradead.org"
<linux-arm-kernel@lists.infradead.org>,
"akpm@linux-foundation.org" <akpm@linux-foundation.org>,
Catalin Marinas <Catalin.Marinas@arm.com>,
Will Deacon <Will.Deacon@arm.com>,
"mhocko@suse.com" <mhocko@suse.com>,
"ira.weiny@intel.com" <ira.weiny@intel.com>,
"david@redhat.com" <david@redhat.com>, "cai@lca.pw" <cai@lca.pw>,
"logang@deltatee.com" <logang@deltatee.com>,
James Morse <James.Morse@arm.com>,
"cpandya@codeaurora.org" <cpandya@codeaurora.org>,
"arunks@codeaurora.org" <arunks@codeaurora.org>,
"dan.j.williams@intel.com" <dan.j.williams@intel.com>,
"mgorman@techsingularity.net" <mgorman@techsingularity.net>,
"osalvador@suse.de" <osalvador@suse.de>,
Ard Biesheuvel <Ard.Biesheuvel@arm.com>, nd <nd@arm.com>
Subject: Re: [PATCH V6 3/3] arm64/mm: Enable memory hot remove
Date: Tue, 25 Jun 2019 11:31:29 +0100 [thread overview]
Message-ID: <20190625103128.GA12207@lakrids.cambridge.arm.com> (raw)
In-Reply-To: <48f39fa1-c369-c8e2-4572-b7e016dca2d6@arm.com>
On Tue, Jun 25, 2019 at 10:57:07AM +0530, Anshuman Khandual wrote:
> On 06/24/2019 10:22 PM, Mark Rutland wrote:
> > On Fri, Jun 21, 2019 at 03:35:53PM +0100, Steve Capper wrote:
> >> On Wed, Jun 19, 2019 at 09:47:40AM +0530, Anshuman Khandual wrote:
> >>> +static void free_hotplug_page_range(struct page *page, size_t size)
> >>> +{
> >>> + WARN_ON(!page || PageReserved(page));
> >>> + free_pages((unsigned long)page_address(page), get_order(size));
> >>> +}
> >>
> >> We are dealing with power of 2 number of pages, it makes a lot more
> >> sense (to me) to replace the size parameter with order.
> >>
> >> Also, all the callers are for known compile-time sizes, so we could just
> >> translate the size parameter as follows to remove any usage of get_order?
> >> PAGE_SIZE -> 0
> >> PMD_SIZE -> PMD_SHIFT - PAGE_SHIFT
> >> PUD_SIZE -> PUD_SHIFT - PAGE_SHIFT
> >
> > Now that I look at this again, the above makes sense to me.
> >
> > I'd requested the current form (which I now realise is broken), since
> > back in v2 the code looked like:
> >
> > static void free_pagetable(struct page *page, int order)
> > {
> > ...
> > free_pages((unsigned long)page_address(page), order);
> > ...
> > }
> >
> > ... with callsites looking like:
> >
> > free_pagetable(pud_page(*pud), get_order(PUD_SIZE));
> >
> > ... which I now see is off by PAGE_SHIFT, and we inherited that bug in
> > the current code, so the calculated order is vastly larger than it
> > should be. It's worrying that doesn't seem to be caught by anything in
> > testing. :/
>
> get_order() returns the minimum page allocation order for a given size
> which already takes into account PAGE_SHIFT i.e get_order(PAGE_SIZE)
> returns 0.
Phew.
Let's leave this as is then -- it's clearer/simpler than using the SHIFT
constants, performance isn't a major concern in this path, and it's very
likely that GCC will inline and constant-fold this away regardless.
Sorry for the noise, and thanks for correcting me.
Mark.
prev parent reply other threads:[~2019-06-25 10:31 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-06-19 4:17 [PATCH V6 0/3] arm64/mm: Enable memory hot remove Anshuman Khandual
2019-06-19 4:17 ` [PATCH V6 1/3] mm/hotplug: Reorder memblock_[free|remove]() calls in try_remove_memory() Anshuman Khandual
2019-06-19 4:17 ` [PATCH V6 2/3] arm64/mm: Hold memory hotplug lock while walking for kernel page table dump Anshuman Khandual
2019-06-19 4:17 ` [PATCH V6 3/3] arm64/mm: Enable memory hot remove Anshuman Khandual
2019-06-21 12:53 ` Anshuman Khandual
2019-06-21 14:35 ` Steve Capper
2019-06-24 3:12 ` Anshuman Khandual
2019-06-24 16:52 ` Mark Rutland
2019-06-25 5:27 ` Anshuman Khandual
2019-06-25 10:31 ` Mark Rutland [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=20190625103128.GA12207@lakrids.cambridge.arm.com \
--to=mark.rutland@arm.com \
--cc=Ard.Biesheuvel@arm.com \
--cc=Catalin.Marinas@arm.com \
--cc=James.Morse@arm.com \
--cc=Steve.Capper@arm.com \
--cc=Will.Deacon@arm.com \
--cc=akpm@linux-foundation.org \
--cc=anshuman.khandual@arm.com \
--cc=arunks@codeaurora.org \
--cc=cai@lca.pw \
--cc=cpandya@codeaurora.org \
--cc=dan.j.williams@intel.com \
--cc=david@redhat.com \
--cc=ira.weiny@intel.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=logang@deltatee.com \
--cc=mgorman@techsingularity.net \
--cc=mhocko@suse.com \
--cc=nd@arm.com \
--cc=osalvador@suse.de \
/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).