Skip to content
  • Eric Dumazet's avatar
    posix-timers: RCU conversion · 8af08871
    Eric Dumazet authored
    Ben Nagy reported a scalability problem with KVM/QEMU that hit very hard
    a single spinlock (idr_lock) in posix-timers code, on its 48 core
    machine.
    
    Even on a 16 cpu machine (2x4x2), a single test can show 98% of cpu time
    used in ticket_spin_lock, from lock_timer
    
    Ref: http://www.spinics.net/lists/kvm/msg51526.html
    
    
    
    Switching to RCU is quite easy, IDR being already RCU ready. idr_lock
    should be locked only for an insert/delete, not a lookup.
    
    Benchmark on a 2x4x2 machine, 16 processes calling timer_gettime().
    
    Before :
    
    real    1m18.669s
    user    0m1.346s
    sys     1m17.180s
    
    After :
    
    real    0m3.296s
    user    0m1.366s
    sys     0m1.926s
    
    Reported-by: default avatarBen Nagy <ben@iagu.net>
    Signed-off-by: default avatarEric Dumazet <eric.dumazet@gmail.com>
    Tested-by: default avatarBen Nagy <ben@iagu.net>
    Cc: Oleg Nesterov <oleg@redhat.com>
    Cc: Avi Kivity <avi@redhat.com>
    Cc: John Stultz <johnstul@us.ibm.com>
    Cc: Richard Cochran <richard.cochran@omicron.at>
    Cc: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
    Cc: Andrew Morton <akpm@linux-foundation.org>
    Signed-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
    8af08871