Skip to contentSkip to conversation

Pinning kernel memory

DISCUSSION Thomas Schlichter 1 participant 1 message Dec 12, 2002

lore
Share & tools
lore
#0 lore raw

Hello,

I want to create a big area of unswappable, physical continuous kernel memory for hardware testing purposes. Currently I allocate the memory using alloc_pages(GFP_KERNEL, order) and after this I pin it using SetPageReserved(page) for each page.

Is this acceptable, or may it happen that after the alloc_pages()-call the kswapd begins to swap out this memory and just any other memory is pinned?? Do I perhaps have to lock the mm->page_table_lock and test each page before I pin it?? If it is swapped out, how can I assure to get this page back swapped in?

is SetPageReserved the right way to pin a memory page, or should SetPageActive(page) or even LockPage(page) be used??

I hope anyone can help me...
Thank you!

Sincerely yours
Thomas Schlichter