• Peter Zijlstra's avatar
    sched: Fix the irqtime code for 32bit · 8e92c201
    Peter Zijlstra authored
    Since the irqtime accounting is using non-atomic u64 and can be read
    from remote cpus (writes are strictly cpu local, reads are not) we
    have to deal with observing partial updates.
    
    When we do observe partial updates the clock movement (in particular,
    ->clock_task movement) will go funny (in either direction), a
    subsequent clock update (observing the full update) will make it go
    funny in the oposite direction.
    
    Since we rely on these clocks to be strictly monotonic we cannot
    suffer backwards motion. One possible solution would be to simply
    ignore all backwards deltas, but that will lead to accounting
    artefacts, most notable: clock_task + irq_time != clock, this
    inaccuracy would end up in user visible stats.
    
    Therefore serialize the reads using a seqcount.
    Reviewed-by: default avatarVenkatesh Pallipadi <venki@google.com>
    Reported-by: default avatarMikael Pettersson <mikpe@it.uu.se>
    Tested-by: default avatarMikael Pettersson <mikpe@it.uu.se>
    Signed-off-by: default avatarPeter Zijlstra <a.p.zijlstra@chello.nl>
    LKML-Reference: <1292242434.6803.200.camel@twins>
    Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
    8e92c201
sched.c 231 KB