Re: [PATCH 4/6] ftrace, x86: make kernel text writable only for conversions

From: Andi Kleen
Date: Sun Feb 22 2009 - 19:11:28 EST


> We are changing over 19000 locations in the kernel. This touches almost
> all kernel text pages anyway. You want to map a page in and out for over
> 19000 locations?

Well kernel size / PAGE_SIZE times if you sort locations first and
take a last-hit cache. Or if you want to overoptimize you can
also use 2MB pages when available. Also it can be done much cheaper
than a full flush because it doesn't need to be global over all CPUs
(assuming you disable preempt, which you probably do anyways)
And it can use INVLPG on x86 (or similar directed flushed)
which is much much cheaper than blowing everything away.

I'm not sure which one would be faster, but I suspect the difference
will not be very large. And not changing the kernel has the
advantage that there is no window where it is unprotected.

-Andi

--
ak@xxxxxxxxxxxxxxx -- Speaking for myself only.
--
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/