From: Yinghai Lu <yinghai@kernel.org>
To: Avery Pennarun <apenwarr@gmail.com>
Cc: Andrew Morton <akpm@linux-foundation.org>,
Josh Triplett <josh@joshtriplett.org>,
"Paul E. McKenney" <paulmck@linux.vnet.ibm.com>,
Ingo Molnar <mingo@elte.hu>,
"David S. Miller" <davem@davemloft.net>,
Peter Zijlstra <a.p.zijlstra@chello.nl>,
"Fabio M. Di Nitto" <fdinitto@redhat.com>,
Johannes Weiner <hannes@cmpxchg.org>,
Olaf Hering <olaf@aepfle.de>,
Paul Gortmaker <paul.gortmaker@windriver.com>,
Tejun Heo <tj@kernel.org>, "H. Peter Anvin" <hpa@linux.intel.com>,
linux-kernel@vger.kernel.org, linux-mm@kvack.org
Subject: Re: [PATCH 4/5] printk: use alloc_bootmem() instead of memblock_alloc().
Date: Mon, 12 Mar 2012 23:13:24 -0700 [thread overview]
Message-ID: <CAE9FiQUakjaxE3fTm1w3SuuE-cAXAg2fePmEdwmjomAgp88Psg@mail.gmail.com> (raw)
In-Reply-To: <1331617001-20906-5-git-send-email-apenwarr@gmail.com>
On Mon, Mar 12, 2012 at 10:36 PM, Avery Pennarun <apenwarr@gmail.com> wrote:
> The code in setup_log_buf() had two memory allocation branches, depending
> on the value of 'early'. If early==1, it would use memblock_alloc(); if
> early==0, it would use alloc_bootmem_nopanic().
>
> bootmem should already configured by the time setup_log_buf(early=1) is
> called, so there's no reason to have the separation. Furthermore, on
> arches with nobootmem, memblock_alloc is essentially the same as
> alloc_bootmem anyway. x86 is one such arch, and also the only one
> that uses early=1.
>
> Signed-off-by: Avery Pennarun <apenwarr@gmail.com>
> ---
> kernel/printk.c | 13 +------------
> 1 files changed, 1 insertions(+), 12 deletions(-)
>
> diff --git a/kernel/printk.c b/kernel/printk.c
> index 32690a0..bf96a7d 100644
> --- a/kernel/printk.c
> +++ b/kernel/printk.c
> @@ -31,7 +31,6 @@
> #include <linux/smp.h>
> #include <linux/security.h>
> #include <linux/bootmem.h>
> -#include <linux/memblock.h>
> #include <linux/syscalls.h>
> #include <linux/kexec.h>
> #include <linux/kdb.h>
> @@ -195,17 +194,7 @@ void __init setup_log_buf(int early)
> if (!new_log_buf_len)
> return;
>
> - if (early) {
> - unsigned long mem;
> -
> - mem = memblock_alloc(new_log_buf_len, PAGE_SIZE);
> - if (!mem)
> - return;
> - new_log_buf = __va(mem);
> - } else {
> - new_log_buf = alloc_bootmem_nopanic(new_log_buf_len);
> - }
> -
> + new_log_buf = alloc_bootmem_nopanic(new_log_buf_len);
> if (unlikely(!new_log_buf)) {
> pr_err("log_buf_len: %ld bytes not available\n",
> new_log_buf_len);
> --
that seems not right.
for x86, setup_log_buf(1) is quite early called in setup_arch() before
bootmem is there.
bootmem should be killed after memblock is supported for arch that
current support bootmem.
Yinghai
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
next prev parent reply other threads:[~2012-03-13 6:13 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-03-13 5:36 [PATCH 0/5] Persist printk buffer across reboots Avery Pennarun
2012-03-13 5:36 ` [PATCH 1/5] mm: bootmem: BUG() if you try to allocate bootmem too late Avery Pennarun
2012-03-13 5:36 ` [PATCH 2/5] mm: bootmem: it's okay to reserve_bootmem an invalid address Avery Pennarun
2012-03-13 5:36 ` [PATCH 3/5] mm: nobootmem: implement reserve_bootmem() in terms of memblock Avery Pennarun
2012-03-13 5:36 ` [PATCH 4/5] printk: use alloc_bootmem() instead of memblock_alloc() Avery Pennarun
2012-03-13 6:13 ` Yinghai Lu [this message]
2012-03-13 6:40 ` Avery Pennarun
2012-03-13 8:26 ` Ingo Molnar
2012-03-13 21:50 ` Yinghai Lu
2012-03-14 2:23 ` Avery Pennarun
2012-03-13 5:36 ` [PATCH 5/5] printk: CONFIG_PRINTK_PERSIST: persist printk buffer across reboots Avery Pennarun
2012-03-13 5:53 ` [PATCH 0/5] Persist " David Miller
2012-03-13 6:00 ` Avery Pennarun
2012-03-13 6:50 ` David Miller
2012-03-13 7:14 ` Avery Pennarun
2012-03-13 7:18 ` David Miller
2012-03-13 8:10 ` Avery Pennarun
2012-03-13 8:16 ` David Miller
2012-03-13 13:50 ` Peter Zijlstra
2012-03-14 1:57 ` Daniel Walker
2012-03-13 8:32 ` Stephen Boyd
2012-03-13 17:08 ` Daniel Walker
2012-03-13 22:10 ` Andrew Morton
2012-03-14 2:19 ` Daniel Walker
2012-03-15 22:10 ` Seiji Aguchi
2012-03-14 2:21 ` Avery Pennarun
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=CAE9FiQUakjaxE3fTm1w3SuuE-cAXAg2fePmEdwmjomAgp88Psg@mail.gmail.com \
--to=yinghai@kernel.org \
--cc=a.p.zijlstra@chello.nl \
--cc=akpm@linux-foundation.org \
--cc=apenwarr@gmail.com \
--cc=davem@davemloft.net \
--cc=fdinitto@redhat.com \
--cc=hannes@cmpxchg.org \
--cc=hpa@linux.intel.com \
--cc=josh@joshtriplett.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=mingo@elte.hu \
--cc=olaf@aepfle.de \
--cc=paul.gortmaker@windriver.com \
--cc=paulmck@linux.vnet.ibm.com \
--cc=tj@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;
as well as URLs for NNTP newsgroup(s).