Re: [PATCH 2.6.21] cramfs: add cramfs Linear XIP

From: Carsten Otte
Date: Fri Jun 08 2007 - 15:04:34 EST


JÃrn Engel wrote:
Nitbit: Sooner or later the point/unpoint should get replaced by
something with page granularity. Something also needs to keep lists of
mapped pages and invalidate them whenever the device is written to.
That could be done in the filesystem or device driver. I believe the
device driver would be a better solution.
I think it needs to work like this:
- temporary references (for read/write syscalls and friends) get retrieved via get_xip_page and returned again via to-be-invented put_page/page_cache_release
- permanent references (for mapping to userland) get retrieved via get_xip_page and don't get returned until unmap
- the device driver can access page->count via a helper function provided by mm. This way, it can identify which pages are in use.
- In order to get references back, the device driver can call a callback provided by the file system. A default implementation will go to filemap_xip.c. This callback would use rmap to find all mappings, and unmap the page via xip_file_unmap()[mm/filemap_xip.c].

The nice thing about this approach is: we use page->count and rmap, both already exist and are perfectly suited for our purpose.
The downside: We need mem_map[] struct page entries behind all memory segments. Nowerdays we can easily create those via vmem_map/sparsemem.

Opinions?


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