[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <4B2BE348.207@kernel.org>
Date: Fri, 18 Dec 2009 12:17:12 -0800
From: Yinghai Lu <yinghai@...nel.org>
To: "H. Peter Anvin" <hpa@...or.com>
CC: Ingo Molnar <mingo@...e.hu>, Thomas Gleixner <tglx@...utronix.de>,
Andrew Morton <akpm@...ux-foundation.org>,
Jesse Barnes <jbarnes@...tuousgeek.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH 1/9] x86: move range related operation to one file
H. Peter Anvin wrote:
> On 12/18/2009 01:46 AM, Yinghai Lu wrote:
>> +
>> +struct range {
>> + u64 start;
>> + u64 end;
>> +};
>
> Okay, this does bring up two things that I have long griped about.
>
> Firstly, I don't think this is the proper data structure. Even worse,
> the range operations take *inclusive* ranges (e.g. 0x0000 to 0xffff is
> 64K, not 0x0000 to 0x10000). It would be one thing if it only affected
> the internal representation, but as written, this is exposed through the
> interfaces, too.
>
> As far as the choice of data structures, I have used in other places,
> with very good success, a data structure which looks like:
>
> struct {
> u64 start;
> u32 attr;
> };
>
> Note that there is no end: the end is always given by an end token. The
> "attr" here was an e820 attribute (or 0 for no attribute), but the
> payload can be almost anything -- for a simple include/exclude it can
> just be boolean.
>
> This data structures doesn't permit things like out-of-order ranges,
> overlapping ranges, and so on, and that's a good thing; it means the
> data structure itself can never be ambiguous, and the interfaces clean
> out most errors inherently.
yes here is we have [start, end] instead of [start, end)
those range operation is used for one purpose:
add several ranges, and subtract some other ranges, it will take out overlap between those two sets.
and leave out the range that could be used.
and it is array based...for early stage.
YH
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists