mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH 1/3] x86: reserve_crashkernel: use memblock_is_region_reserved to simplify code
@ 2013-04-15  8:06 Wang YanQing
  2013-04-15 20:47 ` Yinghai Lu
  0 siblings, 1 reply; 2+ messages in thread
From: Wang YanQing @ 2013-04-15  8:06 UTC (permalink / raw)
  To: akpm; +Cc: yinghai, linux-kernel

Use memblock_is_region_reserved instead of memblock_find_in_range
to simplify the check codes, and gain a little speed benefit.

Signed-off-by: Wang YanQing <udknight@gmail.com>
---
 arch/x86/kernel/setup.c | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)

diff --git a/arch/x86/kernel/setup.c b/arch/x86/kernel/setup.c
index 90d8cc9..9d60c85 100644
--- a/arch/x86/kernel/setup.c
+++ b/arch/x86/kernel/setup.c
@@ -577,11 +577,7 @@ static void __init reserve_crashkernel(void)
 		}
 
 	} else {
-		unsigned long long start;
-
-		start = memblock_find_in_range(crash_base,
-				 crash_base + crash_size, crash_size, 1<<20);
-		if (start != crash_base) {
+		if (memblock_is_region_reserved(crash_base, crash_size)) {
 			pr_info("crashkernel reservation failed - memory is in use.\n");
 			return;
 		}
-- 
1.7.12.4.dirty

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH 1/3] x86: reserve_crashkernel: use memblock_is_region_reserved to simplify code
  2013-04-15  8:06 [PATCH 1/3] x86: reserve_crashkernel: use memblock_is_region_reserved to simplify code Wang YanQing
@ 2013-04-15 20:47 ` Yinghai Lu
  0 siblings, 0 replies; 2+ messages in thread
From: Yinghai Lu @ 2013-04-15 20:47 UTC (permalink / raw)
  To: Wang YanQing, Andrew Morton, Yinghai Lu, Linux Kernel Mailing List

On Mon, Apr 15, 2013 at 1:06 AM, Wang YanQing <udknight@gmail.com> wrote:
> Use memblock_is_region_reserved instead of memblock_find_in_range
> to simplify the check codes, and gain a little speed benefit.
>
> Signed-off-by: Wang YanQing <udknight@gmail.com>
> ---
>  arch/x86/kernel/setup.c | 6 +-----
>  1 file changed, 1 insertion(+), 5 deletions(-)
>
> diff --git a/arch/x86/kernel/setup.c b/arch/x86/kernel/setup.c
> index 90d8cc9..9d60c85 100644
> --- a/arch/x86/kernel/setup.c
> +++ b/arch/x86/kernel/setup.c
> @@ -577,11 +577,7 @@ static void __init reserve_crashkernel(void)
>                 }
>
>         } else {
> -               unsigned long long start;
> -
> -               start = memblock_find_in_range(crash_base,
> -                                crash_base + crash_size, crash_size, 1<<20);
> -               if (start != crash_base) {
> +               if (memblock_is_region_reserved(crash_base, crash_size)) {
>                         pr_info("crashkernel reservation failed - memory is in use.\n");
>                         return;
>                 }

We need to use memblock_find_in_range here.

As the range [crash_base, crash_base+crash_size) could be not in
memblock.memory.

for example, if the ram only have 16G installed, and user just specify
crash_base to 64g.
and there is no [64g...) in memblock.reserved.
But that does not mean that we can use that range.

Thanks

Yinghai

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2013-04-15 20:47 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-04-15  8:06 [PATCH 1/3] x86: reserve_crashkernel: use memblock_is_region_reserved to simplify code Wang YanQing
2013-04-15 20:47 ` Yinghai Lu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome