linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* about sanitize_e820_map()
@ 2006-01-12  2:02 Toshiyuki Ishii
  0 siblings, 0 replies; 2+ messages in thread
From: Toshiyuki Ishii @ 2006-01-12  2:02 UTC (permalink / raw)
  To: linux-kernel


Good evening.
I am Toshiyuki Ishii at Kurashiki in Japan.

I am a beginner of kernel source code,
so sorry if I am misunderstanding.

In sanitize_e820_map(),
When sorting change_point[] by address and swapping
two maps that represets the same memory region
and have a different address, end address for privious change_point
and start address for current change_point,
"if" statement is

if ((change_point[i]->addr < change_point[i-1]->addr) ||

     ((change_point[i]->addr == change_point[i-1]->addr) &&
      (change_point[i]->addr == change_point[i]->pbios->addr) &&
      (change_point[i-1]->addr != change_point[i-1]->pbios->addr))

There are two conditions and I think the first one is sorting by address.
I have a qestion in the second condition.

I think second line

change_point[i]->addr == change_point[i]->pbios->addr

checks that current change_point represents start address.
and third line

change_point[i-1]->addr != change_point[i-1]->pbios->addr

checks that previous change_point represents end address.
If this "if" statement intends to swap maps for "the same" region
that match these condition, the first line should be

change_point[i]->pbios->addr == change_point[i-1]->pbios->addr

I think.

Am I wrong?


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

* RE: about sanitize_e820_map()
@ 2006-01-19 20:47 Pallipadi, Venkatesh
  0 siblings, 0 replies; 2+ messages in thread
From: Pallipadi, Venkatesh @ 2006-01-19 20:47 UTC (permalink / raw)
  To: psbfan, linux-kernel; +Cc: Andrew Morton

 

>Date: Thu, 12 Jan 2006 11:02:49 +0900 (JST)
>From: Toshiyuki Ishii <psbfan@po.harenet.ne.jp>
>To: linux-kernel@vger.kernel.org
>Subject: about sanitize_e820_map()
>
>
>
>Good evening.
>I am Toshiyuki Ishii at Kurashiki in Japan.
>
>I am a beginner of kernel source code,
>so sorry if I am misunderstanding.
>
>In sanitize_e820_map(),
>When sorting change_point[] by address and swapping
>two maps that represets the same memory region
>and have a different address, end address for privious change_point
>and start address for current change_point,
>"if" statement is
>
>if ((change_point[i]->addr < change_point[i-1]->addr) ||
>
>     ((change_point[i]->addr == change_point[i-1]->addr) &&
>      (change_point[i]->addr == change_point[i]->pbios->addr) &&
>      (change_point[i-1]->addr != change_point[i-1]->pbios->addr))
>
>There are two conditions and I think the first one is sorting 
>by address.
>I have a qestion in the second condition.
>
>I think second line
>
>change_point[i]->addr == change_point[i]->pbios->addr
>
>checks that current change_point represents start address.
>and third line
>
>change_point[i-1]->addr != change_point[i-1]->pbios->addr
>
>checks that previous change_point represents end address.
>If this "if" statement intends to swap maps for "the same" region
>that match these condition,

As I understand this code, this is trying to swap the start and end of
"different" regions. Start and end of same region will always be sorted 
and end will appear after start (As we check for non-zero size and 
setup change_point in a way that start is before end).

But, there can be end of one region coinciding with start of next
region. 
In which case, this sorting puts the start before the end so that we 
can properly find out overlaps later.

I think the existing code is doing the right thing.

Thanks,
Venki

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

end of thread, other threads:[~2006-01-19 20:48 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-01-12  2:02 about sanitize_e820_map() Toshiyuki Ishii
2006-01-19 20:47 Pallipadi, Venkatesh

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).