Skip to contentSkip to conversation

how to tell which pages were allocated from kernel?

DISCUSSION Nathan Friess 1 participant 1 message Jul 31, 2002 Memory management

lore
Share & tools
lore
#0 lore raw

Please CC to me, as I'm not subscribed to the list.

Short version:

I know how to see a list of all memory pages in the variable mem_map, but how do I tell which pages are allocated for the kernel, and which pages are allocated for user space processes?

Long version:

I recently learned about a project (patch) that gives the linux kernel the ability to suspend to disk. I'm planning to make some changes to see if I can improve it's performance on my laptop. I've looked through the code and relevent protions of the kernel, and googled for some help, but I still don't seem to have all of the information I'm looking for. In particular, currently the suspending code just allocates a new page for every existing one, and copies every existing page to a newly allocated page, then writes all of the newly allocated pages to swap. As a result, the suspend requires that at least 1/2 of the physical RAM is free, so these temporary pages can be allocated in RAM before writing to swap.

If there is some way that I could tell which pages belong to user space processes, then I could write those pages directly to swap without copying them. So, how would I find out where they came from? I don't see any field in the page struct to indicate this, although I did notice that there is a #define called GFP_USER which I believe is passed to the alloc functions when the kernel allocates space on behalf of a user process. If need be, I might try to add something so that I could keep track of the pages, like add a field to the page struct.

Sorry if this seems trivial, but I figure I can spend more hours searching the web and mm code, or I can just ask the experts directly.

Thanks,

Nathan Friess

--
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/