Why not implementing page_exist() by simply using mem_map[] ? Whenallocating mem_map[], we can just fill it with a special value. Andthen when registering memory area, we clear this special value withthe "reserved" value. Hence for flatmem model, we can have:

#define page_exist(pfn) (mem_map[pfn] != SPECIAL_VALUE)

and it should work for sparsemem too and other models that will usemem_map[].

Another point, is page_exist() going to replace page_valid() ?I mean page_exist() is going to be something more accurate thanpage_valid(). All tests on page_valid() _only_ will be fine to testpage_exist(). But all tests such:

if (page_valid(x) && page_is_ram(x))can be replaced by

if (page_exist(x))So, again, why not simply improving page_valid() definition ratherthan introduce a new service ?