Re: [patch 11/21] Xen-paravirt: Add apply_to_page_range() which appliesa function to a pte range.
From: Nick Piggin
Date: Fri Feb 16 2007 - 02:32:14 EST
Andrew Morton wrote:
On Thu, 15 Feb 2007 18:25:00 -0800 Jeremy Fitzhardinge <jeremy@xxxxxxxx> wrote:
Add a new mm function apply_to_page_range() which applies a given
function to every pte in a given virtual address range in a given mm
structure. This is a generic alternative to cut-and-pasting the Linux
idiomatic pagetable walking code in every place that a sequence of
PTEs must be accessed.
Although this interface is intended to be useful in a wide range of
situations, it is currently used specifically by several Xen
subsystems, for example: to ensure that pagetables have been allocated
for a virtual address range, and to construct batched special
pagetable update requests to map I/O memory (in ioremap()).
There was some discussion about this sort of thing last week. The
consensus was that it's better to run the callback against a whole pmd's
worth of ptes, mainly to amortise the callback's cost (a lot).
It was implemented in
Speaking of that patch, I missed the discussion, but I'd hope it doesn't
go upstream in its current form.
We now have one way of walking range of ptes. The code may be duplicated a
few times, but it is simple, we know how it works, and it is easy to get
right because everyone does the same thing.
We used to have about a dozen slightly different ways of doing this until
Hugh spent the effort to standardise it all. Isn't it nice?
If we want an ever-so-slightly lower performing interface for those paths
that don't care to count every cycle -- which I think is a fine idea BTW
-- it should be implemented in mm/memory.c and it should use our standard
form of pagetable walking.
SUSE Labs, Novell Inc.
Send instant messages to your online friends http://au.messenger.yahoo.com
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/