No on both counts. The Linux kernel currently has no facility for
throwing out compiled code (it would require at least as and ld
hacks.) Nor could it be built as a module, since there is no way to
get to the point where it could be inserted.
Actually, we could do something like this. I think it was Alan Cox (or
possibly Eric Young) who first suggested that we could use the gcc
attribute feature to put certain procedure into a separate ELF section,
so that at the end of the boot sequence, those pages could be
marked as being reusable. It would require doing some GCC-specific
features, but it shouldn't require any special as or ld hacks.
- Ted