From: Baoquan He <bhe@redhat.com>
To: Mike Rapoport <rppt@linux.ibm.com>
Cc: Pingfan Liu <kernelfans@gmail.com>,
linux-mm@kvack.org, kexec@lists.infradead.org,
Tang Chen <tangchen@cn.fujitsu.com>,
"Rafael J. Wysocki" <rjw@rjwysocki.net>,
Len Brown <lenb@kernel.org>,
Andrew Morton <akpm@linux-foundation.org>,
Mike Rapoport <rppt@linux.vnet.ibm.com>,
Michal Hocko <mhocko@suse.com>, Jonathan Corbet <corbet@lwn.net>,
Yaowei Bai <baiyaowei@cmss.chinamobile.com>,
Pavel Tatashin <pasha.tatashin@oracle.com>,
Nicholas Piggin <npiggin@gmail.com>,
Naoya Horiguchi <n-horiguchi@ah.jp.nec.com>,
Daniel Vacek <neelx@redhat.com>,
Mathieu Malaterre <malat@debian.org>,
Stefan Agner <stefan@agner.ch>, Dave Young <dyoung@redhat.com>,
yinghai@kernel.org, vgoyal@redhat.com,
linux-kernel@vger.kernel.org
Subject: Re: [PATCHv5] x86/kdump: bugfix, make the behavior of crashkernel=X consistent with kaslr
Date: Tue, 8 Jan 2019 17:01:38 +0800 [thread overview]
Message-ID: <20190108090138.GB18718@MiWiFi-R3L-srv> (raw)
In-Reply-To: <20190108080538.GB4396@rapoport-lnx>
Hi Mike,
On 01/08/19 at 10:05am, Mike Rapoport wrote:
> I'm not thrilled by duplicating this code (yet again).
> I liked the v3 of this patch [1] more, assuming we allow bottom-up mode to
> allocate [0, kernel_start) unconditionally.
> I'd just replace you first patch in v3 [2] with something like:
In initmem_init(), we will restore the top-down allocation style anyway.
While reserve_crashkernel() is called after initmem_init(), it's not
appropriate to adjust memblock_find_in_range_node(), and we really want
to find region bottom up for crashkernel reservation, no matter where
kernel is loaded, better call __memblock_find_range_bottom_up().
Create a wrapper to do the necessary handling, then call
__memblock_find_range_bottom_up() directly, looks better.
Thanks
Baoquan
>
> diff --git a/mm/memblock.c b/mm/memblock.c
> index 7df468c..d1b30b9 100644
> --- a/mm/memblock.c
> +++ b/mm/memblock.c
> @@ -274,24 +274,14 @@ phys_addr_t __init_memblock memblock_find_in_range_node(phys_addr_t size,
> * try bottom-up allocation only when bottom-up mode
> * is set and @end is above the kernel image.
> */
> - if (memblock_bottom_up() && end > kernel_end) {
> - phys_addr_t bottom_up_start;
> -
> - /* make sure we will allocate above the kernel */
> - bottom_up_start = max(start, kernel_end);
> -
> + if (memblock_bottom_up()) {
> /* ok, try bottom-up allocation first */
> - ret = __memblock_find_range_bottom_up(bottom_up_start, end,
> + ret = __memblock_find_range_bottom_up(start, end,
> size, align, nid, flags);
> if (ret)
> return ret;
>
> /*
> - * we always limit bottom-up allocation above the kernel,
> - * but top-down allocation doesn't have the limit, so
> - * retrying top-down allocation may succeed when bottom-up
> - * allocation failed.
> - *
> * bottom-up allocation is expected to be fail very rarely,
> * so we use WARN_ONCE() here to see the stack trace if
> * fail happens.
>
> [1] https://lore.kernel.org/lkml/1545966002-3075-3-git-send-email-kernelfans@gmail.com/
> [2] https://lore.kernel.org/lkml/1545966002-3075-2-git-send-email-kernelfans@gmail.com/
>
> > +
> > + return ret;
> > +}
> > +
> > /**
> > * __memblock_find_range_top_down - find free area utility, in top-down
> > * @start: start of candidate range
> > --
> > 2.7.4
> >
>
> --
> Sincerely yours,
> Mike.
>
next prev parent reply other threads:[~2019-01-08 9:01 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-01-07 8:04 Pingfan Liu
2019-01-08 8:05 ` Mike Rapoport
2019-01-08 9:01 ` Baoquan He [this message]
2019-01-08 15:48 ` Mike Rapoport
2019-01-09 13:02 ` Pingfan Liu
2019-01-09 13:02 ` Pingfan Liu
2019-01-10 7:56 ` Mike Rapoport
2019-01-11 2:37 ` Pingfan Liu
2019-01-11 2:37 ` Pingfan Liu
2019-01-09 14:25 ` Baoquan He
2019-01-11 2:41 ` Pingfan Liu
2019-01-11 2:41 ` Pingfan Liu
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=20190108090138.GB18718@MiWiFi-R3L-srv \
--to=bhe@redhat.com \
--cc=akpm@linux-foundation.org \
--cc=baiyaowei@cmss.chinamobile.com \
--cc=corbet@lwn.net \
--cc=dyoung@redhat.com \
--cc=kernelfans@gmail.com \
--cc=kexec@lists.infradead.org \
--cc=lenb@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=malat@debian.org \
--cc=mhocko@suse.com \
--cc=n-horiguchi@ah.jp.nec.com \
--cc=neelx@redhat.com \
--cc=npiggin@gmail.com \
--cc=pasha.tatashin@oracle.com \
--cc=rjw@rjwysocki.net \
--cc=rppt@linux.ibm.com \
--cc=rppt@linux.vnet.ibm.com \
--cc=stefan@agner.ch \
--cc=tangchen@cn.fujitsu.com \
--cc=vgoyal@redhat.com \
--cc=yinghai@kernel.org \
/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