lkml.org 
[lkml]   [2004]   [Aug]   [20]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
SubjectRe: kernbench on 512p
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]);
}
}

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
\
 
 \ /
  Last update: 2005-03-22 14:05    [W:0.078 / U:0.176 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site