[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1276612552.2077.7725.camel@twins>
Date: Tue, 15 Jun 2010 16:35:52 +0200
From: Peter Zijlstra <peterz@...radead.org>
To: Andrew Morton <akpm@...ux-foundation.org>
Cc: tytso@....edu, Salman <sqazi@...gle.com>, mingo@...e.hu,
linux-kernel@...r.kernel.org, tytso@...gle.com,
torvalds@...ux-foundation.org, walken@...gle.com,
Chen Liqin <liqin.chen@...plusct.com>,
Lennox Wu <lennox.wu@...il.com>
Subject: Re: [PATCH] Fix a race in pid generation that causes pids to be
reused immediately.
On Mon, 2010-06-14 at 18:55 -0700, Andrew Morton wrote:
> > kernel/sched_clock.c: if (cmpxchg64(&scd->clock, old_clock, clock) != old_cloc
>
> I guess that'll flush out any stragglers.
cmpxchg64() is special, at the time i386 didn't handle the 8 byte
cmpxchg(), although we could easily make it do today.
> I suspect sched_clock.c might be generating fair amounts of code which
> UP builds don't need.
Only sched_clock_remote() and its caller, something like the below, not
much code..
UP machines can still have utterly sucky TSC, although the
inter-cpu-drift thing isn't much of an issue ;-)
---
kernel/sched_clock.c | 4 ++++
1 files changed, 4 insertions(+), 0 deletions(-)
diff --git a/kernel/sched_clock.c b/kernel/sched_clock.c
index 52f1a14..7ff5b56 100644
--- a/kernel/sched_clock.c
+++ b/kernel/sched_clock.c
@@ -170,6 +170,7 @@ again:
return clock;
}
+#ifdef CONFIG_SMP
static u64 sched_clock_remote(struct sched_clock_data *scd)
{
struct sched_clock_data *my_scd = this_scd();
@@ -205,6 +206,7 @@ again:
return val;
}
+#endif
/*
* Similar to cpu_clock(), but requires local IRQs to be disabled.
@@ -226,9 +228,11 @@ u64 sched_clock_cpu(int cpu)
scd = cpu_sdc(cpu);
+#ifdef CONFIG_SMP
if (cpu != smp_processor_id())
clock = sched_clock_remote(scd);
else
+#endif
clock = sched_clock_local(scd);
return clock;
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists