1. 09 3月, 2009 1 次提交
    • K
      tracing: Don't use tracing_record_cmdline() in workqueue tracer · c3ffc7a4
      KOSAKI Motohiro 提交于
      Impact: improve workqueue tracer output
      
      Currently, /sys/kernel/debug/tracing/trace_stat/workqueues can display
      wrong and strange thread names.
      
      Why?
      
      Currently, ftrace has tracing_record_cmdline()/trace_find_cmdline()
      convenience function that implements a task->comm string cache.
      
      This can avoid unnecessary memcpy overhead and the workqueue tracer
      uses it.
      
      However, in general, any trace statistics feature shouldn't use
      tracing_record_cmdline() because trace statistics can display
      very old process. Then comm cache can return wrong string because
      recent process overrides the cache.
      
      Fortunately, workqueue trace guarantees that displayed processes
      are live. Thus we can search comm string from PID at display time.
      
      <before>
      
      % cat workqueues
       # CPU  INSERTED  EXECUTED   NAME
       # |      |         |          |
      
         7 431913     431913       kondemand/7
         7      0          0       tail
         7     21         21       git
         7      0          0       ls
         7      9          9       cat
         7 832632     832632       unix_chkpwd
         7 236292     236292       ls
      
      Note: tail, git, ls, cat unix_chkpwd are obiously not workqueue thread.
      
      <after>
      
      % cat workqueues
       # CPU  INSERTED  EXECUTED   NAME
       # |      |         |          |
      
         7    510        510       kondemand/7
         7      0          0       kmpathd/7
         7     15         15       ata/7
         7      0          0       aio/7
         7     11         11       kblockd/7
         7   1063       1063       work_on_cpu/7
         7    167        167       events/7
      Signed-off-by: NKOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
      Cc: Lai Jiangshan <laijs@cn.fujitsu.com>
      Cc: Steven Rostedt <srostedt@redhat.com>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      c3ffc7a4
  2. 20 1月, 2009 1 次提交
  3. 14 1月, 2009 1 次提交
    • F
      tracing: add a new workqueue tracer · e1d8aa9f
      Frederic Weisbecker 提交于
      Impact: new tracer
      
      The workqueue tracer provides some statistical informations
      about each cpu workqueue thread such as the number of the
      works inserted and executed since their creation. It can help
      to evaluate the amount of work each of them have to perform.
      For example it can help a developer to decide whether he should
      choose a per cpu workqueue instead of a singlethreaded one.
      
      It only traces statistical informations for now but it will probably later
      provide event tracing too.
      
      Such a tracer could help too, and be improved, to help rt priority sorted
      workqueue development.
      
      To have a snapshot of the workqueues state at any time, just do
      
      cat /debugfs/tracing/trace_stat/workqueues
      
      Ie:
      
        1    125        125       reiserfs/1
        1      0          0       scsi_tgtd/1
        1      0          0       aio/1
        1      0          0       ata/1
        1    114        114       kblockd/1
        1      0          0       kintegrityd/1
        1   2147       2147       events/1
      
        0      0          0       kpsmoused
        0    105        105       reiserfs/0
        0      0          0       scsi_tgtd/0
        0      0          0       aio/0
        0      0          0       ata_aux
        0      0          0       ata/0
        0      0          0       cqueue
        0      0          0       kacpi_notify
        0      0          0       kacpid
        0    149        149       kblockd/0
        0      0          0       kintegrityd/0
        0   1000       1000       khelper
        0   2270       2270       events/0
      
      Changes in V2:
      
      _ Drop the static array based on NR_CPU and dynamically allocate the stat array
        with num_possible_cpus() and other cpu mask facilities....
      _ Trace workqueue insertion at a bit lower level (insert_work instead of queue_work) to handle
        even the workqueue barriers.
      Signed-off-by: NFrederic Weisbecker <fweisbec@gmail.com>
      Signed-off-by: NSteven Rostedt <srostedt@redhat.com>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      e1d8aa9f