• P
    perf_counter: Fix counter inheritance · 856d56b9
    Peter Zijlstra 提交于
    Srivatsa Vaddagiri reported that a Java workload triggers this
    warning in kernel/exit.c:
    
       WARN_ON_ONCE(!list_empty(&tsk->perf_counter_ctx.counter_list));
    
    Add the inherited counter propagation on self-detach, this could
    cause counter leaks and incomplete stats in threaded code like
    the below:
    
      #include <pthread.h>
      #include <unistd.h>
    
      void *thread(void *arg)
      {
              sleep(5);
              return NULL;
      }
    
      void main(void)
      {
              pthread_t thr;
              pthread_create(&thr, NULL, thread, NULL);
      }
    Reported-by: NSrivatsa Vaddagiri <vatsa@in.ibm.com>
    Signed-off-by: NPeter Zijlstra <a.p.zijlstra@chello.nl>
    Cc: Paul Mackerras <paulus@samba.org>
    Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com>
    Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
    Cc: Marcelo Tosatti <mtosatti@redhat.com>
    Signed-off-by: NIngo Molnar <mingo@elte.hu>
    856d56b9
exit.c 43.5 KB