Skip to contentSkip to conversation

addresses returned by __get_free_pages()

DISCUSSION Martin Maletinsky 2 participants 2 messages Feb 8, 2002 Memory management

lore
Share & tools
lore
#0 lore raw

Hello,

In the 2.4.x kernel, can I apply the virt_to_page() macro to any address allocated by __get_free_pages() (i.e. when calling ret = __get_free_pages(flags, order), to any address in the interval [retval, 2^order * PAGE_SIZE])?

In other words are those addresses guaranteed to be kernel logical addresses (i.e. between PAGE_OFFSET and PAGE_OFFSET + high_memory (on ix86))?

I know that in the 2.2.x kernel this used to be the case (i.e. __get_free_pages() returned kernel logical addresses, to which virt_to_page() could be applied), but I don't quite understand the memory managment of 2.4.x yet.

Thanks in advance for any help
regards
Martin

--

Supercomputing System AG          email: [email protected]
Martin Maletinsky                 phone: +41 (0)1 445 16 05
Technoparkstrasse 1               fax:   +41 (0)1 445 16 10

CH-8005 Zurich

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/

#1 lore raw

Hi,

Quoted 2 lines · Martin Maletinsky

In the 2.4.x kernel, can I apply the virt_to_page() macro to any address allocated by __get_free_pages() (i.e. when calling ret = __get_free_pages(flags, order), to any address in the interval [retval, 2^order * PAGE_SIZE])?

Yes, but it's easier just to call "alloc_pages(flags, order)", which returns a struct page in the first place.

Quoted 1 line

In other words are those addresses guaranteed to be kernel logical addresses (i.e. between PAGE_OFFSET and PAGE_OFFSET + high_memory (on ix86))?

Yes, unless you specify GFP_HIGHMEM in the allocation flags.

Cheers,
Stephen
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/