• Ingo Molnar's avatar
    [PATCH] x86 TSS: io port caching · dd826030
    Ingo Molnar authored
    There's one additional step we can do ontop of the ports-max code to get rid
    of copying in X.org's case: cache the last task that set up the IO bitmap. 
    This means we can set the offset to invalid and keep the IO bitmap of that
    task, and switch back to a valid offset (without any copying) when switching
    back to that task.  (or do a copy if there is another ioperm task we switch
    to.)
    
    I've attached ioport-cache-2.6.8.1.patch that implements this. When
    there's a single active ioperm() using task in the system then the
    context-switch overhead is very low and constant:
    
     # ./ioperm-latency
     default no ioperm:             scheduling latency: 2478 cycles
     turning on port 80 ioperm:     scheduling latency: 2499 cycles
     turning on port 65535 ioperm:  scheduling latency: 2481 cycles
    
    This single-ioperm-user situation matches 99% of the actual ioperm()
    usage scenarios and gets rid of any copying whatsoever - without relying
    on any fault mechanism. I can see no advantage of the GPF approach over
    this patch.
    Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
    Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
    Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
    dd826030
process.c 19.3 KB