Skip to contentSkip to conversation

2.6.9-rc2-mm1

DISCUSSION Andi Kleen 1 participant 1 message Sep 20, 2004 7 messages not in the archive

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

A message that is not in the archive (sent off-list or not yet received): [email protected]

A message that is not in the archive (sent off-list or not yet received): [email protected]

A message that is not in the archive (sent off-list or not yet received): [email protected]

A message that is not in the archive (sent off-list or not yet received): [email protected]

A message that is not in the archive (sent off-list or not yet received): [email protected]

A message that is not in the archive (sent off-list or not yet received): [email protected]

Andi Kleen

author
#7 lore raw
Quoted 9 lines · Terence Ripperda

this is some ugly code. we're doing a lookup on a physical address to see if this is memory we previously allocated and returning a kernel pointer to the page.

the particular snippet in question (that uses MAXMEM) is an ugly attempt to verify the address is a real physical address, before using __va() on something like an i/o region. A better approach than comparing MAXMEM would probably be to convert the address to a mapnr and compare to max_mapnr.

pfn_valid() is intended for that. However it cannot work when you have more than 4GB memory and IO memory holes below 4GB. Testing the reserved bit of the struct page * may work in that case, although it can give false positives when you try this with random memory (some people set reserved on real memory for other reason)

-Andi