[prev in list] [next in list] [prev in thread] [next in thread] 

List:       linux-kernel
Subject:    help with cleanup of pages mapped to userspace
From:       Chris Friesen <cfriesen () nortelnetworks ! com>
Date:       2004-08-27 15:42:08
Message-ID: 412F5650.3050003 () nortelnetworks ! com
[Download RAW message or body]


I would like to have a page of memory accessable from both kernel space and 
userspace.  Ideally it would be nice to have the page allocated from the kernel 
address space so as to be able to use pte_offset_kernel() rather than 
pte_offset_map().

It has been suggested that we could do something like:


mypage =  __get_free_page(GFP_KERNEL);
SetPageReserved(virt_to_page(mypage));
remap_page_range(vma->vm_start, virt_to_phys((void *) mypage), PAGE_SIZE, 
vma->vm_page_prot);

When the task dies, how much cleanup will be done on the page?  Does the memory 
subsystem handle everything, or do I need to explicitly do something like:

reservedClearPageReserved(virt_to_page(mypage));
free_page(mypage);

Is there a better way of doing this?  I had considered mmap(), but I think that 
could give me pages with their page tables up in high memory, necessitating the 
use of pte_offset_map().


Thanks,

Chris
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic