]> git.baikalelectronics.ru Git - kernel.git/commit
posix clocks: Replace mutex with reader/writer semaphore
authorRichard Cochran <richardcochran@gmail.com>
Wed, 30 Mar 2011 13:24:21 +0000 (15:24 +0200)
committerThomas Gleixner <tglx@linutronix.de>
Mon, 18 Apr 2011 08:39:38 +0000 (10:39 +0200)
commitca3f4cf524b58e2fd7680e42144fd6ae4460b471
tree53739cfe3847e425b9bb64f22bc7526da26a9a0c
parent1615ef344076fe894d3518544a96d36a609ddb4e
posix clocks: Replace mutex with reader/writer semaphore

A dynamic posix clock is protected from asynchronous removal by a mutex.
However, using a mutex has the unwanted effect that a long running clock
operation in one process will unnecessarily block other processes.

For example, one process might call read() to get an external time stamp
coming in at one pulse per second. A second process calling clock_gettime
would have to wait for almost a whole second.

This patch fixes the issue by using a reader/writer semaphore instead of
a mutex.

Signed-off-by: Richard Cochran <richard.cochran@omicron.at>
Cc: John Stultz <john.stultz@linaro.org>
Link: http://lkml.kernel.org/r/%3C20110330132421.GA31771%40riccoc20.at.omicron.at%3E
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
include/linux/posix-clock.h
kernel/time/posix-clock.c