On Thu, May 26, 2011 at 09:29:51AM -0400, Nicolas Pitre wrote:
On Thu, 26 May 2011, Dave Martin wrote:
The core logic spans 5 instructions. Only 3 of them are actually the same in both cases i.e. those with no references to 1b or 2b, and they're perfectly interlaced in between the others. Trying to make this into common runtime code would result in even bigger code I'm afraid. This could be made into common source code via a macro though.
Fair enough -- a macro might be worth a try _if_ it simplifies things in the source, but I think you're right that merging the actual code probably isn't worth it just to save a few words in the vectors page (which eats up 4K regardless of what we put in it) and a few cycles per fault (which already costs many, many cycles).
In the normal cases, there is no additional cycles per fault as the inline check remains unchanged, and it goes like this:
@ Make sure our user space atomic helper is restarted @ if it was interrupted in a critical region. Here we @ perform a quick test inline since it should be false @ 99.9999% of the time. The rest is done out of line. cmp r2, #TASK_SIZE blhs kuser_cmpxchg_fixup
In most cases the branch is not taken.
True!
---Dave