提交 95dde501 编写于 作者: Y Yinghai Lu 提交者: Linus Torvalds

memblock: add error return when CONFIG_HAVE_MEMBLOCK is not set

On larger systems, information in the kernel log is lost because there is
so much early text printed, that it overflows the static log buffer before
the log_buf_len kernel parameter can be processed, and a bigger log buffer
allocated.

Distros are relunctant to increase memory usage by increasing the size of
the static log buffer, so minimize the problem by allocating the new log
buffer as early as possible.

This patch:

Add an error return if CONFIG_HAVE_MEMBLOCK is not set instead of having
to add #ifdef CONFIG_HAVE_MEMBLOCK around blocks of code calling that
function.
Signed-off-by: NMike Travis <travis@sgi.com>
Cc: Yinghai Lu <yhlu.kernel@gmail.com>
Cc: "H. Peter Anvin" <hpa@zytor.com>
Cc: Jack Steiner <steiner@sgi.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Ingo Molnar <mingo@elte.hu>
Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
上级 d9be9b90
...@@ -2,6 +2,8 @@ ...@@ -2,6 +2,8 @@
#define _LINUX_MEMBLOCK_H #define _LINUX_MEMBLOCK_H
#ifdef __KERNEL__ #ifdef __KERNEL__
#define MEMBLOCK_ERROR 0
#ifdef CONFIG_HAVE_MEMBLOCK #ifdef CONFIG_HAVE_MEMBLOCK
/* /*
* Logical memory blocks. * Logical memory blocks.
...@@ -20,7 +22,6 @@ ...@@ -20,7 +22,6 @@
#include <asm/memblock.h> #include <asm/memblock.h>
#define INIT_MEMBLOCK_REGIONS 128 #define INIT_MEMBLOCK_REGIONS 128
#define MEMBLOCK_ERROR 0
struct memblock_region { struct memblock_region {
phys_addr_t base; phys_addr_t base;
...@@ -160,6 +161,12 @@ static inline unsigned long memblock_region_reserved_end_pfn(const struct memblo ...@@ -160,6 +161,12 @@ static inline unsigned long memblock_region_reserved_end_pfn(const struct memblo
#define __initdata_memblock #define __initdata_memblock
#endif #endif
#else
static inline phys_addr_t memblock_alloc(phys_addr_t size, phys_addr_t align)
{
return MEMBLOCK_ERROR;
}
#endif /* CONFIG_HAVE_MEMBLOCK */ #endif /* CONFIG_HAVE_MEMBLOCK */
#endif /* __KERNEL__ */ #endif /* __KERNEL__ */
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册