public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Anton Blanchard <anton@samba.org>
To: William Lee Irwin III <wli@holomorphy.com>
Cc: linux-kernel@vger.kernel.org, rddunlap@osdl.org, akpm@osdl.org
Subject: Re: [profile]: [0/23] mmap() support for /proc/profile
Date: Wed, 23 Jun 2004 09:16:46 +1000	[thread overview]
Message-ID: <20040622231646.GA17387@krispykreme> (raw)
In-Reply-To: <0406220816.1a3aYaLbLbXaKbKb1aWa4a1a3a2a3aIb2a0aZaWaHb4aXaXaZa1aKbZaWa5aHb3a15250@holomorphy.com>


> I was trying to profile a mostly-idle workload to get an idea of what
> area of the kernel things were diving into and falling asleep in during
> an OAST run. Without these patches, kerneltop et al showed heavy /proc/
> activity along with copy_to_user() at the top of the profiles.

Interesting stuff. FYI we did some analysis of the hottest addresses in
the kernel and profile_lock featured very high up:

void profile_hook(struct pt_regs * regs)
{
        read_lock(&profile_lock);
        notifier_call_chain(&profile_listeners, 0, regs);
        read_unlock(&profile_lock);
}

Thats 2 atomic operations to the same cacheline per timer interrupt per
cpu. Considering how rarely timer based profiling is used, perhaps RCU
or even just a profiling_enabled sysctl flag would help here. Id prefer
not to compile it out in distro kernels if possible, its a very useful
feature when required.

In the mean time, how about this quick fix?

Anton

--

Cacheline align profile_lock, analysis shows it to be one of the hottest
memory locations on large SMP boxes.

Signed-off-by: Anton Blanchard <anton@samba.org>

===== kernel/profile.c 1.5 vs edited =====
--- 1.5/kernel/profile.c	Wed Jul 16 18:09:04 2003
+++ edited/kernel/profile.c	Wed Jun 23 09:13:28 2004
@@ -8,6 +8,7 @@
 #include <linux/bootmem.h>
 #include <linux/notifier.h>
 #include <linux/mm.h>
+#include <linux/cache.h>
 #include <asm/sections.h>
 
 unsigned int * prof_buffer;
@@ -119,7 +120,7 @@
 }
 
 static struct notifier_block * profile_listeners;
-static rwlock_t profile_lock = RW_LOCK_UNLOCKED;
+static rwlock_t profile_lock __cacheline_aligned_in_smp = RW_LOCK_UNLOCKED;
  
 int register_profile_notifier(struct notifier_block * nb)
 {

  parent reply	other threads:[~2004-06-23  1:48 UTC|newest]

Thread overview: 36+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-06-22 15:16 [profile]: [0/23] mmap() support for /proc/profile William Lee Irwin III
2004-06-22 15:16 ` [profile]: [1/23] move proc_profile_operations to profile.c William Lee Irwin III
2004-06-22 15:16   ` [profile]: [2/23] ppc32 profiling cleanups William Lee Irwin III
2004-06-22 15:16     ` [profile]: [3/23] mips " William Lee Irwin III
2004-06-22 15:16       ` [profile]: [4/23] sparc64 " William Lee Irwin III
2004-06-22 15:16         ` [profile]: [5/23] m68knommu " William Lee Irwin III
2004-06-22 15:16           ` [profile]: [6/23] sparc32 " William Lee Irwin III
2004-06-22 15:16             ` [profile]: [7/23] superh " William Lee Irwin III
2004-06-22 15:17               ` [profile]: [8/23] arm26 " William Lee Irwin III
2004-06-22 15:17                 ` [profile]: [9/23] m68k " William Lee Irwin III
2004-06-22 15:17                   ` [profile]: [10/23] ia64 " William Lee Irwin III
2004-06-22 15:17                     ` [profile]: [11/23] alpha " William Lee Irwin III
2004-06-22 15:17                       ` [profile]: [12/23] ppc64 " William Lee Irwin III
2004-06-22 15:17                         ` [profile]: [13/23] arm " William Lee Irwin III
2004-06-22 15:17                           ` [profile]: [14/23] parisc " William Lee Irwin III
2004-06-22 15:17                             ` [profile]: [15/23] h8300 " William Lee Irwin III
2004-06-22 15:17                               ` [profile]: [16/23] s390 " William Lee Irwin III
2004-06-22 15:17                                 ` [profile]: [17/23] x86-64 " William Lee Irwin III
2004-06-22 15:17                                   ` [profile]: [18/23] i386 " William Lee Irwin III
2004-06-22 15:17                                     ` [profile]: [19/23] remove public decls of profile.c internal state William Lee Irwin III
2004-06-22 15:17                                       ` [profile]: [20/23] clean up profile_init() not to oversize buffer William Lee Irwin III
2004-06-22 15:17                                         ` [profile]: [21/23] use atomic_t for prof_buffer William Lee Irwin III
2004-06-22 15:18                                           ` [profile]: [22/23] put 1 << prof_shift at prof_buffer[0] William Lee Irwin III
2004-06-22 15:18                                             ` [profile]: [23/23] add mmap() support for /proc/profile William Lee Irwin III
2004-06-22 17:03                                               ` William Lee Irwin III
2004-06-22 17:10                                             ` [profile]: [22/23] put 1 << prof_shift at prof_buffer[0] William Lee Irwin III
2004-06-22 17:12                                               ` William Lee Irwin III
2004-06-22 20:01                                           ` [profile]: [21/23] use atomic_t for prof_buffer David S. Miller
2004-06-22 20:16                                             ` William Lee Irwin III
2004-06-22 20:47                                               ` David S. Miller
2004-06-29 18:56                     ` [profile]: [10/23] ia64 profiling cleanups David Mosberger
2004-06-29 19:23                       ` William Lee Irwin III
2004-06-22 23:16 ` Anton Blanchard [this message]
2004-06-23  1:58   ` [profile]: [0/23] mmap() support for /proc/profile David S. Miller
2004-06-23  2:05   ` William Lee Irwin III
2004-06-23  3:00     ` Anton Blanchard

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=20040622231646.GA17387@krispykreme \
    --to=anton@samba.org \
    --cc=akpm@osdl.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rddunlap@osdl.org \
    --cc=wli@holomorphy.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox