Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1567963

Re: [Resend PATCH] x86/e820: break the loop when the region is less then current region

From Ingo Molnar <mingo@kernel.org>
Newsgroups linux.kernel
Subject Re: [Resend PATCH] x86/e820: break the loop when the region is less then current region
Date 2017-01-27 10:00 +0100
Message-ID <t4axY-1Vz-7@gated-at.bofh.it> (permalink)
References <t44LT-6Tn-3@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


* Wei Yang <richard.weiyang@gmail.com> wrote:

> e820_all_mapped() iterates the e820 table to check whether a region is
> mapped or not. Since the e820 table is sorted, when the region is less than
> the current region, no need to continue the iteration.
> 
> The patch breaks the loop accordingly.
> 
> Signed-off-by: Wei Yang <richard.weiyang@gmail.com>
> ---
>  arch/x86/kernel/e820.c | 8 +++++++-
>  1 file changed, 7 insertions(+), 1 deletion(-)
> 
> diff --git a/arch/x86/kernel/e820.c b/arch/x86/kernel/e820.c
> index 90e8dde..f4fb197 100644
> --- a/arch/x86/kernel/e820.c
> +++ b/arch/x86/kernel/e820.c
> @@ -86,10 +86,16 @@ int __init e820_all_mapped(u64 start, u64 end, unsigned type)
>  	for (i = 0; i < e820->nr_map; i++) {
>  		struct e820entry *ei = &e820->map[i];
>  
> +		/* Since the e820 table is sorted, when the region is less
> +		 * than the current region, break it.
> +		 */
> +		if (ei->addr >= end)
> +			break;

Please have a look at the relevant sections in Documentation/CodingStyle. (And 
yes, this file violates it in a number of ways, but that's no reason to add to the 
mess.)

But, more importantly, the reason I have not applied the patch before is that 
while it's true that the e820 map is _eventually_ sorted, have you made certain 
that all calls to e820_all_mapped() are done when the map is already sorted?

Thanks,

	Ingo

Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

[Resend PATCH] x86/e820: break the loop when the region is less then current region Wei Yang <richard.weiyang@gmail.com> - 2017-01-27 03:50 +0100
  Re: [Resend PATCH] x86/e820: break the loop when the region is less  then current region Ingo Molnar <mingo@kernel.org> - 2017-01-27 10:00 +0100
    Re: [Resend PATCH] x86/e820: break the loop when the region is less  then current region Wei Yang <richard.weiyang@gmail.com> - 2017-01-27 19:10 +0100

csiph-web