All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ingo Molnar <mingo@elte.hu>
To: "Paul E. McKenney" <paulmck@linux.vnet.ibm.com>
Cc: Steven Rostedt <rostedt@goodmis.org>,
	Frederic Weisbecker <fweisbec@gmail.com>,
	LKML <linux-kernel@vger.kernel.org>,
	Thomas Gleixner <tglx@linutronix.de>,
	Peter Zijlstra <peterz@infradead.org>
Subject: Re: [PATCH 0/5] [GIT PULL] updates for tip/tracing/ftrace
Date: Sun, 22 Mar 2009 18:02:15 +0100	[thread overview]
Message-ID: <20090322170215.GA4468@elte.hu> (raw)
In-Reply-To: <20090322150657.GA17415@elte.hu>


ok, with Frederic we figured out the problem.

What helped things most was this trace-dump output:

 0) + 15.281 us   |                }
 0)               |                handle_irq() {
 1) + 35.871 us   |                }
 1)               |                timespec_to_ktime() {
 0)   4.608 us    |                  }
 0)               |                  generic_handle_irq_desc() {
 1)   4.097 us    |                  }
 1) + 14.171 us   |                }
 0)   4.450 us    |                      _spin_lock();
 1) + 60.127 us   |              }
 1)               |              ktime_get() {
 0)               |                      ack_apic_edge() {
 1)               |                  getnstimeofday() {
 0)   6.486 us    |                        }
 0)   5.619 us    |                        irq_complete_move();
 1)   5.158 us    |                      jiffies_read();
 0)               |                        move_native_irq() {
 1) + 15.495 us   |                    }
 1) + 26.161 us   |                  }
 0)   5.631 us    |                          }
 1)   5.549 us    |                  set_normalized_timespec();
 0) + 16.304 us   |                        }
 0)               |                        ack_APIC_irq() {
 1) + 48.377 us   |                }
 1)               |                timespec_to_ktime() {
 0)   5.762 us    |                            native_apic_mem_write();
 1)   5.751 us    |                  }
 0) + 16.162 us   |                          }
 1) + 16.413 us   |                }
 0) + 27.185 us   |                        }
 1) + 81.519 us   |              }
 0) + 80.245 us   |                      }
 1) ! 154.606 us  |            }
 0)               |                      _spin_unlock() {
 1)   5.743 us    |            tick_nohz_update_jiffies();
 0)   5.781 us    |                        }
 1) ! 183.912 us  |          }
 0)   5.327 us    |                        preempt_schedule();
 1) ! 202.575 us  |        }
 0) + 25.827 us   |                      }

 [...]
 1) ! 2623.297 us |  }

i.e. all CPUs spend 2-3 milliseconds to handle a single tick. This 
is on a Core2 Extreme Edition 2.93 GHz CPU, so this kind of cost was 
unexpected.

Until i saw this:

 CONFIG_TRACE_BRANCH_PROFILING=y
 CONFIG_PROFILE_ALL_BRANCHES=y

that explains it all. The above sequence is two CPUs 'lock stepped' 
in a very high overhead series of cacheline ping-pongs. The 
ping-pongs happen due to every branch in the kernel doing:

                ______f.miss_hit[______r]++;

where the branch info metadata is defined as global variables:

                static struct ftrace_branch_data                        \
                        __attribute__((__aligned__(4)))                 \
                        __attribute__((section("_ftrace_branch")))      \

not only is it global, it's also false cacheline-shared due to a 4 
byte alignment.

The proper solution would be to use percpu data and percpu_add() 
primitives for this.

Anyway ... i turned off the branch tracer for my tests.

	Ingo

  reply	other threads:[~2009-03-22 17:02 UTC|newest]

Thread overview: 48+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-03-18  3:14 [PATCH 0/5] [GIT PULL] updates for tip/tracing/ftrace Steven Rostedt
2009-03-18  3:14 ` [PATCH 1/5] ring-buffer: add api to allow a tracer to change clock source Steven Rostedt
2009-03-18  3:14 ` [PATCH 2/5] tracing: add global-clock option to provide cross CPU clock to traces Steven Rostedt
2009-03-18  3:14 ` [PATCH 3/5] tracing: optimization of branch tracer Steven Rostedt
2009-03-18  3:14 ` [PATCH 4/5] tracing: make sched_switch stop/start light weight Steven Rostedt
2009-03-18  3:14 ` [PATCH 5/5] tracing: make power tracer start/stop methods lighter weight Steven Rostedt
2009-03-18  5:59 ` [PATCH 0/5] [GIT PULL] updates for tip/tracing/ftrace Ingo Molnar
2009-03-18  7:39   ` Ingo Molnar
2009-03-19  7:33     ` Ingo Molnar
2009-03-19 17:21       ` Steven Rostedt
2009-03-20 17:43         ` Paul E. McKenney
2009-03-20 18:36           ` Ingo Molnar
2009-03-20 18:38             ` Ingo Molnar
2009-03-20 19:19               ` Paul E. McKenney
2009-03-20 19:27                 ` Ingo Molnar
2009-03-20 19:41                   ` Paul E. McKenney
2009-03-20 19:46                   ` Frederic Weisbecker
2009-03-20 19:54                     ` Ingo Molnar
2009-03-20 20:48                       ` Frederic Weisbecker
2009-03-20 21:05                         ` Steven Rostedt
2009-03-21 10:01                           ` Ingo Molnar
2009-03-21 16:58                             ` Ingo Molnar
2009-03-21 17:25                               ` Steven Rostedt
2009-03-21 19:07                                 ` Paul E. McKenney
2009-03-21 20:09                                   ` Ingo Molnar
2009-03-21 21:01                                     ` Paul E. McKenney
2009-03-22 14:24                                       ` Ingo Molnar
2009-03-22 15:06                                         ` Ingo Molnar
2009-03-22 17:02                                           ` Ingo Molnar [this message]
2009-03-22 18:33                                             ` Steven Rostedt
2009-03-22 19:52                                               ` Ingo Molnar
2009-03-23 18:44                                           ` Steven Rostedt
2009-03-21 17:32                               ` Frederic Weisbecker
2009-03-21 17:44                                 ` Steven Rostedt
2009-03-21 17:53                                   ` Frederic Weisbecker
2009-03-21 18:17                                     ` Steven Rostedt
2009-03-21 20:03                                       ` Frederic Weisbecker
2009-03-21 18:18                                 ` Ingo Molnar
2009-03-21 20:09                                   ` Frederic Weisbecker
2009-03-21 20:46                                     ` Frederic Weisbecker
2009-03-22 19:41                               ` Ingo Molnar
2009-03-22 20:41                                 ` Ingo Molnar
2009-03-20 21:39                         ` Paul E. McKenney
2009-03-20 17:05       ` Frederic Weisbecker
2009-03-20 17:57         ` Frederic Weisbecker
2009-03-20 18:22           ` Steven Rostedt
2009-03-20 18:39             ` Frederic Weisbecker
2009-03-20 18:42             ` Ingo Molnar

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20090322170215.GA4468@elte.hu \
    --to=mingo@elte.hu \
    --cc=fweisbec@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=paulmck@linux.vnet.ibm.com \
    --cc=peterz@infradead.org \
    --cc=rostedt@goodmis.org \
    --cc=tglx@linutronix.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.