Re: [PATCH] fix #endif misplacement

From: Ricardo Nabinger Sanchez
Date: Fri Nov 28 2003 - 16:36:37 EST


Quoting Tim Schmielau <tim@xxxxxxxxxxxxxxxxxxxxxx>
Sent on Fri, 28 Nov 2003 17:34:49 +0100 (CET)

> > This patch fixes an #endif misplacement, which leads to dead code in
> > sched_clock() in arch/i386/kernel/timers/timer_tsc.c, due to a return
> > outside the ifdef/endif.
>
> No, this is exactly what is intended: don't use the TSC on NUMA, use
> jiffies instead.
> Look at the comment just above those lines.

I'm breaking things. Sorry.

I think I understood it now: the #ifndef protects only the check for TSC
availability on non-NUMA archs. If it's available, and not under NUMA (so
the ifndef), use it (jump to the rdtscll()), otherwise return the expression
result.

The strange thing to me is that I'm getting 1/10 of the expected value when
measuring tasks timeslices. Instead of getting ~100ms for tasks which just
burn CPU, I'm getting 10ms.

I measure timeslices inside schedule(), updating the average timeslice for
the leaving process, using (now - prev->timestamp).

Any clue of what am I doing wrong?

Regards.


unsigned long long sched_clock(void)
{
unsigned long long this_offset;

/*
* In the NUMA case we dont use the TSC as they are not
* synchronized across all CPUs.
*/
#ifndef CONFIG_NUMA
if (!use_tsc)
#endif
return (unsigned long long)jiffies * (1000000000 / HZ);

/* Read the Time Stamp Counter */
rdtscll(this_offset);

/* return the value in ns */
return cycles_2_ns(this_offset);
}


--
Ricardo Nabinger Sanchez
GNU/Linux #140696 [http://counter.li.org]
Slackware Linux

Warning:
Trespassers will be shot.
Survivors will be shot again.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/