Re: [PATCH] Runtime memory barrier patching

Jamie Lokier
2003-04-21T23:45:36Z

Andi Kleen wrote:
> > Such as removing the lock prefix when running non-SMP?
...
> .altinstructions section after load to avoid too much kernel bloat (it
> currently costs 7 byte + the length of the replacement. And lock
> is quite common in the kernel these days.

1. It should cost at most 4 bytes, in a table of "remove me" address,
with topmost bits of each word used to give the length of the
instruction to remove - i.e. to replace with an optimal nop sequence.

2. Not just locks - a lot of spinlock code could be removed completely.
I don't have an opinion on whether this is worth doing - one can
simply run a UP kernel after all.

-- Jamie