Re : Re : Re : Re : sparsemem usage

From: moreau francis
Date: Wed Aug 16 2006 - 08:53:37 EST


Andy Whitcroft wrote:
> moreau francis wrote:
>>
>> It's indeed an issue. Could we instead use a combination of flags
>> that can't happen together. For example PG_Free|PG_Reserved ?
>>
>
> You'd need to audit all other users of the bits you wanted to borrow to
> check they would understand. Like if you used PG_buddy (which I assume
> is what you are referring to above) then you'd get non-real memory
> getting merged into your buddies. Badness.
>

It would be great if we could define:

#define page_is_real(p) (p->_count > 0 || p->flags != 0)

Hence mem_map[] would be automatically initialized as full of page without
any real memory instead of initializing it with a magic value.
>>
>> or maybe _because_ we don't have a consistent interface for finding
>> whether a page is real or not, we end up with a strange thing called
>> page_is_ram() which could be the same for all arch and be implemented
>> very simply.
>>
>> BTW, can you try in a linux tree:
>>
>> $ grep -r page_is_ram arch/
>>
>> and see how it's implemented...
>
> Well it depends how you look at it. You are going to need to know which
> pages are ram in each architecture to set the bits in the page*'s to

I don't see the problem there. You can init mem_map[] each time it is
allocated with the magic value (if the above definition can't be used).
Then, as usual, archs free all zone area by initializing all mem_map
entries with something different from the magic value. After that all
entries of mem_map[] with the magic value can be fastly discarded
because they don't have real memory.

Francis


-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/