public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: William Lee Irwin III <wli@holomorphy.com>
To: Jesse Barnes <jbarnes@engr.sgi.com>, linux-kernel@vger.kernel.org
Subject: Re: kernbench on 512p
Date: Fri, 20 Aug 2004 10:35:11 -0700	[thread overview]
Message-ID: <20040820173511.GI11200@holomorphy.com> (raw)
In-Reply-To: <20040819230315.GE11200@holomorphy.com>

On Thu, Aug 19, 2004 at 04:03:15PM -0700, William Lee Irwin III wrote:
> Not tremendously intelligent, as concurrent readers of /proc/profile
> can render each other's results gibberish, however, this should
> mitigate some of the cacheline bouncing of prof_buffer.
> Some kind of proper IO should be possible given sufficient effort, but
> I gave up immediately when my first attempt didn't work, and this
> should be enough for getting /proc/profile to stop bouncing madly for
> users that can tolerate the concurrent IO constraint. I suppose that
> in principle one could hackishly guard collation and copying of
> prof_buffer with a semaphore in the per-cpu case. I'll work on fixing
> this eventually.
> Use perpcu_profile on the kernel command line to activate the feature.

This fixes the degenerate collate_per_cpu_profiles() behavior jbarnes
saw with this patch alone.


Index: mm2-2.6.8.1/kernel/profile.c
===================================================================
--- mm2-2.6.8.1.orig/kernel/profile.c	2004-08-19 15:11:40.000000000 -0700
+++ mm2-2.6.8.1/kernel/profile.c	2004-08-20 09:32:08.986630798 -0700
@@ -251,16 +251,15 @@
 
 static void collate_per_cpu_profiles(void)
 {
-	unsigned long i;
+	int cpu;
 
-	for (i = 0; i < prof_len; ++i)  {
-		int cpu;
+	memset(prof_buffer, 0, prof_len * sizeof(atomic_t));
+	for_each_online_cpu(cpu) {
+		unsigned long i;
+		atomic_t *buf per_cpu(cpu_prof_buffer, cpu);
 
-		atomic_set(&prof_buffer[i], 0);
-		for_each_online_cpu(cpu) {
-			atomic_t *buf = per_cpu(cpu_prof_buffer, cpu);
-			atomic_add(atomic_read(&buf[i]), &prof_buffer[i]);
-		}
+		for (i = 0; i < prof_len; ++i)
+			prof_buffer[i].counter += atomic_read(&buf[i]);
 	}
 }
 

  reply	other threads:[~2004-08-20 17:35 UTC|newest]

Thread overview: 35+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-08-19 16:16 kernbench on 512p Jesse Barnes
2004-08-19 16:22 ` William Lee Irwin III
2004-08-19 16:29 ` David Mosberger
2004-08-19 16:37   ` Jesse Barnes
2004-08-19 16:40     ` David Mosberger
2004-08-19 17:55       ` Alan Cox
2004-08-20  7:53         ` David Mosberger
2004-08-19 18:25     ` Martin J. Bligh
2004-08-19 18:42       ` Jesse Barnes
2004-08-19 21:11       ` Jesse Barnes
2004-08-19 21:24         ` Jesse Barnes
2004-08-19 21:56           ` Martin J. Bligh
2004-08-20 19:36             ` Maneesh Soni
2004-08-19 23:38           ` Paul E. McKenney
2004-08-20  0:16             ` Jesse Barnes
2004-08-20 15:57               ` Paul E. McKenney
2004-08-20 17:24                 ` Jesse Barnes
2004-08-20 19:22                   ` Manfred Spraul
2004-08-20 20:19                   ` Manfred Spraul
2004-08-23 21:23                     ` Jesse Barnes
2004-08-23 23:13                       ` Jesse Barnes
2004-09-10 19:01                     ` Greg Edwards
2004-09-13 18:21                       ` Manfred Spraul
2004-09-14 17:52                         ` Greg Edwards
2004-09-14 18:16                           ` Manfred Spraul
2004-09-14 18:43                             ` Greg Edwards
2004-09-14 19:16                               ` Manfred Spraul
2004-08-19 21:50         ` Ray Bryant
2004-08-19 22:00           ` Jesse Barnes
2004-08-19 23:03 ` William Lee Irwin III
2004-08-20 17:35   ` William Lee Irwin III [this message]
2004-08-20  0:56 ` remove dentry_open::file_ra_init_state() duplicated memset was " Marcelo Tosatti
2004-08-20  6:21   ` Andrew Morton
2004-08-20  7:28     ` Marcelo Tosatti
2004-08-20  8:34       ` Andrew Morton

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=20040820173511.GI11200@holomorphy.com \
    --to=wli@holomorphy.com \
    --cc=jbarnes@engr.sgi.com \
    --cc=linux-kernel@vger.kernel.org \
    /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