On Tue, 9 Oct 2012, H. Peter Anvin wrote: > On 10/09/2012 02:33 PM, Yinghai Lu wrote: > >> > >> make_range_readwrite is particularly toxic, though, because it makes it > >> sound like it something along the lines of set_memory_rw(), which it > >> most distinctly is not. > > > > it just change some page range from RO back to RW. > > > > so how about update_range_ro_to_rw? > > > > You're focusing on what the low-level mechanics of one particular > implementation (Xen) of the hook, and then try to make it describe the > hook itself. > > What the hook does, if I am reading it correctly, is take a range that > used to be page tables and turn it back to "ordinary memory". As such, > assuming I'm following the logic correctly, something like > pagetable_unreserve() seems like a reasonable name. > > However, why during initialization, why do we have to unreserve memory > that has already been reserved for pagetables? (Keep in mind there may > very well be an entirely sensible answer for that question -- I just > can't tell from the patchset without a much more in-depth analysis. > Keep in mind that that in-depth analysis sucks up time, and it doesn't > scale to expect the maintainer to have to do that.)
I can give some hints: find_early_table_space allocates more memory than needed for pagetable pages, the allocated range is pgt_buf_start-pgt_buf_top. In fact init_memory_mapping doesn't use all the memory in that range, and after building the pagetables calls pagetable_reserve to reserve only the range of memory that actually used. On native is just a memblock_reserve, to make sure that pagetable pages are not reused as normal memory. On Xen, in addition to that, we also make RW the rest of the range pgt_buf_start-pgt_buf_top. The first problem that I can see with this scheme is that pgt_buf_start-pgt_buf_top is assumed to be the pagetable pages range by the Xen subsystem while it should be exported with a more appropriate hook. If we had a hook in find_early_table_space called "pagetable_reserve" that tells everybody what is the pagetable pages range in memory, then we could have a "pagetable_unreserve" hook to release the unused portions of that memory range. This would make more sense to me. -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/