[lkml]   [2002]   [Mar]   [3]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
Subject[RFC] Arch option to touch newly allocated pages
What I'd like is for the arch to have __alloc_pages touch all pages that it 
has allocated and is about to return.

The reason for this is that for UML, those pages are backed by host memory,
which may or may not be available when they are finally touched at some
arbitrary place in the kernel. I hit this by tmpfs running out of room
because my UMLs have their memory backed by tmpfs mounted on /tmp. So, I
want to be able to dirty those pages before they are seen by any other code.

My first guess at what I want in the code is for all the places that
__alloc_pages says this:

if (page)
return page;

to change to this:

if (page)
return arch_validate(page);

arch_validate would be defined as basically empty somewhere in a
include/linux/*.h unless the arch has defined one already. And I may want
to add order to the arg list if it can't be inferred from the page alignment.

My arch_validate would look something like this:

struct page_struct *arch_validate(page_struct *page)
unsigned long zero = 0;
unsigned long addr = page_address(page);

for(i = 0; i < 1 << order; i++){
if(copy_to_user(addr + i * PAGE_SIZE, &zero, sizeof(zero))){
free_pages(addr, order);

The use of set_fs/copy_to_user is somewhat hokey, but that's exactly the
effect that I want. Is there a better way of doing that?

So, is this a reasonable thing to do, and is the above the right way of
getting it?

To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to
More majordomo info at
Please read the FAQ at

 \ /
  Last update: 2005-03-22 13:24    [W:0.076 / U:7.624 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site