• Paul Mackerras's avatar
    perf_counter: Start counting time enabled when group leader gets enabled · 9db85a34
    Paul Mackerras authored
    commit fa289bec upstream.
    
    Currently, if a group is created where the group leader is
    initially disabled but a non-leader member is initially
    enabled, and then the leader is subsequently enabled some time
    later, the time_enabled for the non-leader member will reflect
    the whole time since it was created, not just the time since
    the leader was enabled.
    
    This is incorrect, because all of the members are effectively
    disabled while the leader is disabled, since none of the
    members can go on the PMU if the leader can't.
    
    Thus we have to update the ->tstamp_enabled for all the enabled
    group members when a group leader is enabled, so that the
    time_enabled computation only counts the time since the leader
    was enabled.
    
    Similarly, when disabling a group leader we have to update the
    time_enabled and time_running for all of the group members.
    
    Also, in update_counter_times, we have to treat a counter whose
    group leader is disabled as being disabled.
    Reported-by: default avatarStephane Eranian <eranian@googlemail.com>
    Signed-off-by: default avatarPaul Mackerras <paulus@samba.org>
    Acked-by: default avatarPeter Zijlstra <a.p.zijlstra@chello.nl>
    LKML-Reference: <19091.29664.342227.445006@drongo.ozlabs.ibm.com>
    Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
    Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
    9db85a34
perf_counter.c 114 KB