From: "Yinghai Lu" <yhlu.kernel@gmail.com>
To: "Johannes Weiner" <hannes@saeurebad.de>
Cc: "Andrew Morton" <akpm@linux-foundation.org>,
"Ingo Molnar" <mingo@elte.hu>, "Andi Kleen" <ak@suse.de>,
"Christoph Lameter" <clameter@sgi.com>,
linux-kernel@vger.kernel.org,
"Yasunori Goto" <y-goto@jp.fujitsu.com>,
"KAMEZAWA Hiroyuki" <kamezawa.hiroyu@jp.fujitsu.com>
Subject: Re: [PATCH] mm: make reserve_bootmem can crossed the nodes
Date: Thu, 13 Mar 2008 20:09:16 -0700 [thread overview]
Message-ID: <86802c440803132009q40291587i7a9f41c686f0f10b@mail.gmail.com> (raw)
In-Reply-To: <874pba3tny.fsf@saeurebad.de>
On Thu, Mar 13, 2008 at 7:50 PM, Johannes Weiner <hannes@saeurebad.de> wrote:
>
> Hi,
>
> "Yinghai Lu" <yhlu.kernel@gmail.com> writes:
>
> > On Thu, Mar 13, 2008 at 5:13 PM, Johannes Weiner <hannes@saeurebad.de> wrote:
> >> Hi,
> >>
> >> "Yinghai Lu" <yhlu.kernel@gmail.com> writes:
> >>
> >
> >> > static void __init free_bootmem_core(bootmem_data_t *bdata, unsigned long addr,
> >> > @@ -407,6 +432,11 @@ unsigned long __init init_bootmem_node(p
> >> > void __init reserve_bootmem_node(pg_data_t *pgdat, unsigned long physaddr,
> >> > unsigned long size, int flags)
> >> > {
> >> > + int ret;
> >> > +
> >> > + ret = can_reserve_bootmem_core(pgdat->bdata, physaddr, size, flags);
> >> > + if (ret < 0)
> >> > + return;
> >> > reserve_bootmem_core(pgdat->bdata, physaddr, size, flags);
> >>
> >> I don't get it. Sorry. What is the purpose of
> >> can_reserve_bootmem_core()? It does exactly what reserve_bootmem_core
> >> does besides actually setting the bits. All the pre-checking you wanted
> >> to have out of the way is repeated again in reserve_bootmem_core()
> >> (well, almost all).
> >
> > can_reserve_bootmem_core is check if there is some pages is reserved
> > already with
> >> > + if (flags & BOOTMEM_EXCLUSIVE)
> >> > + return -EBUSY;
> >
> > so it will avoid the restoring later.
>
> Yes, I understood that. But you skipped the lower part of my email:
>
> Your current state now is _not_ that you have one function that
> prechecks the range and another function that reserves it! You have
> _two_ functions checking the range and the second reserving it.
Yes
>
> Why double-check most of the things? If you want to have a pre-check
> function, _move_ all the pre-checks into another function, not
> copy-paste them.
for cross the nodes
>
> And is the condition of trying to reserve a range twice, the second time
> exclusively, so common that it is worth iterating twice over the nodes
> (once for checking, once for reserving) instead of just unwinding the
> reservation if it fails in between?
>
> On something else: is there a bug when a memory range is reserved with
> BOOTMEM_EXCLUSIVE and then again without this flag? The second call
> does not return an error then.
Yes. only provide one direction protection.
so always make sure crash_kernel reserve_bootmem as the last. that is doable.
YH
next prev parent reply other threads:[~2008-03-14 3:09 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-03-13 23:45 Yinghai Lu
2008-03-14 0:13 ` Johannes Weiner
2008-03-14 1:04 ` Yinghai Lu
2008-03-14 2:50 ` Johannes Weiner
2008-03-14 3:09 ` Yinghai Lu [this message]
2008-03-14 1:34 ` KAMEZAWA Hiroyuki
2008-03-14 1:35 ` Yinghai Lu
2008-03-14 1:55 ` KAMEZAWA Hiroyuki
2008-03-14 2:00 ` Yinghai Lu
2008-03-14 2:36 ` KAMEZAWA Hiroyuki
2008-03-14 2:58 ` Johannes Weiner
2008-03-14 3:03 ` Yinghai Lu
2008-03-15 3:08 ` Johannes Weiner
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=86802c440803132009q40291587i7a9f41c686f0f10b@mail.gmail.com \
--to=yhlu.kernel@gmail.com \
--cc=ak@suse.de \
--cc=akpm@linux-foundation.org \
--cc=clameter@sgi.com \
--cc=hannes@saeurebad.de \
--cc=kamezawa.hiroyu@jp.fujitsu.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
--cc=y-goto@jp.fujitsu.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
all inboxes | Powered by JetHome®