Re: question on memory map cleanup stuff

From: William Lee Irwin III
Date: Mon Oct 18 2004 - 18:16:05 EST


On Mon, Oct 18, 2004 at 04:57:20PM -0600, Chris Friesen wrote:
> I've got a small feature that maps a page of kernel memory to userspace via
> a syscall, then uses that page for various things.
> Currently, I'm marking the page reserved, then exporting it via
> remap_page_range(). This means that I need to clean up my mapping whenever
> the memory map is destroyed (process death, exec(), daemonize, etc.).
> It appears that I should be able to put my cleanup code in exit_mmap().
> Since the cleanup code calls do_munmap() on the address, I would want to
> call it before taking mm->page_table_lock, correct?
> Also, normally I would hold mm->mmap_sem before calling do_munmap(). Would
> I still need this if I'm calling it from exit_mmap()? Presumably nobody
> else can get at it anymore...

vma->vm_ops->close() often suffices for such without disturbing the core.


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