[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <AANLkTimbh3CsxAh9egF0etp0-uMDGb5Z9qkoltPZ6Nay@mail.gmail.com>
Date: Fri, 28 May 2010 11:11:24 -0700
From: Chad Talbott <ctalbott@...gle.com>
To: Peter Zijlstra <peterz@...radead.org>
Cc: Andrew Morton <akpm@...ux-foundation.org>,
Jens Axboe <jens.axboe@...cle.com>,
Divyesh Shah <dpshah@...gle.com>, Ingo Molnar <mingo@...e.hu>,
LKML <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] sched_clock: Provide local_clock() and improve
documentation
On Fri, May 28, 2010 at 6:13 AM, Peter Zijlstra <peterz@...radead.org> wrote:
> + * local_clock() -- is cpu_clock() on the current cpu.
Pretty sure this should read, "is cpu_clock() on *some* cpu," since
there is no guarantee in a preemptible kernel that local_clock()
returns on the same CPU that it was called from. The caller has to do
the preempt protection itself.
The function could be written as follows (thanks Salman Qazi):
u64 local_clock(unsigned int *where)
{
u64 clock;
unsigned long flags;
local_irq_save(flags);
*where = smp_processor_id();
clock = sched_clock_cpu(*where);
local_irq_restore(flags);
return clock;
}
but I don't see the utility of the resulting routine.
Chad
--
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