public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Ingo Molnar <mingo@kernel.org>
To: Wei Yang <richard.weiyang@gmail.com>
Cc: tglx@linutronix.de, mingo@redhat.com, hpa@zytor.com,
	x86@kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [Resend PATCH] x86/e820: break the loop when the region is less then current region
Date: Fri, 27 Jan 2017 09:47:23 +0100	[thread overview]
Message-ID: <20170127084723.GD25162@gmail.com> (raw)
In-Reply-To: <20170127024724.38506-1-richard.weiyang@gmail.com>


* 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

  reply	other threads:[~2017-01-27  8:48 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-01-27  2:47 [Resend PATCH] x86/e820: break the loop when the region is less then current region Wei Yang
2017-01-27  8:47 ` Ingo Molnar [this message]
2017-01-27 18:09   ` Wei Yang

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=20170127084723.GD25162@gmail.com \
    --to=mingo@kernel.org \
    --cc=hpa@zytor.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=richard.weiyang@gmail.com \
    --cc=tglx@linutronix.de \
    --cc=x86@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