summaryrefslogtreecommitdiff
path: root/kernel
diff options
context:
space:
mode:
authorAndy Grover <agrover@groveronline.com>2003-03-20 18:45:08 -0800
committerAndy Grover <agrover@groveronline.com>2003-03-20 18:45:08 -0800
commitff6e14381a7c1597c4ffbeb760e9802f3ebaebb2 (patch)
treef5463b22c7b9b67342cde9e46f1d3a3068019ec8 /kernel
parentecabd7d2dd8117b1ec4cc4b7303a7e8198843684 (diff)
parentaa43a933c82fe96479cd5e260a221b69409a553b (diff)
Merge groveronline.com:/root/bk/linux-2.5
into groveronline.com:/root/bk/linux-acpi
Diffstat (limited to 'kernel')
-rw-r--r--kernel/cpufreq.c2
-rw-r--r--kernel/posix-timers.c44
-rw-r--r--kernel/sys.c17
-rw-r--r--kernel/timer.c22
4 files changed, 55 insertions, 30 deletions
diff --git a/kernel/cpufreq.c b/kernel/cpufreq.c
index 4ee64d756835..7631cff9f8bd 100644
--- a/kernel/cpufreq.c
+++ b/kernel/cpufreq.c
@@ -46,7 +46,7 @@ static struct notifier_block *cpufreq_transition_notifier_list;
static DECLARE_RWSEM (cpufreq_notifier_rwsem);
-LIST_HEAD(cpufreq_governor_list);
+static LIST_HEAD(cpufreq_governor_list);
static DECLARE_MUTEX (cpufreq_governor_sem);
static struct device_interface cpufreq_interface;
diff --git a/kernel/posix-timers.c b/kernel/posix-timers.c
index 3780d17e49b0..b9acdb403672 100644
--- a/kernel/posix-timers.c
+++ b/kernel/posix-timers.c
@@ -182,8 +182,7 @@ init_posix_timers(void)
__initcall(init_posix_timers);
-static inline int
-tstojiffie(struct timespec *tp, int res, u64 *jiff)
+static void tstojiffie(struct timespec *tp, int res, u64 *jiff)
{
unsigned long sec = tp->tv_sec;
long nsec = tp->tv_nsec + res - 1;
@@ -212,17 +211,14 @@ tstojiffie(struct timespec *tp, int res, u64 *jiff)
* Split to jiffie and sub jiffie
*/
*jiff += nsec / (NSEC_PER_SEC / HZ);
- /*
- * We trust that the optimizer will use the remainder from the
- * above div in the following operation as long as they are close.
- */
- return 0;
}
+
static void
tstotimer(struct itimerspec *time, struct k_itimer *timer)
{
u64 result;
int res = posix_clocks[timer->it_clock].res;
+
tstojiffie(&time->it_value, res, &result);
timer->it_timer.expires = (unsigned long)result;
tstojiffie(&time->it_interval, res, &result);
@@ -1195,6 +1191,7 @@ sys_clock_nanosleep(clockid_t which_clock, int flags,
return ret;
}
+
long
do_clock_nanosleep(clockid_t which_clock, int flags, struct timespec *tsave)
{
@@ -1225,41 +1222,40 @@ do_clock_nanosleep(clockid_t which_clock, int flags, struct timespec *tsave)
rq_time = (rq_time << 32) + restart_block->arg2;
if (!rq_time)
return -EINTR;
- if (rq_time <= get_jiffies_64())
- return 0;
+ left = rq_time - get_jiffies_64();
+ if (left <= 0LL)
+ return 0; /* Already passed */
}
if (abs && (posix_clocks[which_clock].clock_get !=
posix_clocks[CLOCK_MONOTONIC].clock_get)) {
add_wait_queue(&nanosleep_abs_wqueue, &abs_wqueue);
}
+
do {
t = *tsave;
- if (abs || !rq_time){
+ if (abs || !rq_time) {
adjust_abs_time(&posix_clocks[which_clock], &t, abs);
-
tstojiffie(&t, posix_clocks[which_clock].res, &rq_time);
}
-#if (BITS_PER_LONG < 64)
- if ((rq_time - get_jiffies_64()) > MAX_JIFFY_OFFSET){
- new_timer.expires = MAX_JIFFY_OFFSET;
- }else
-#endif
- {
- new_timer.expires = (long)rq_time;
- }
- current->state = TASK_INTERRUPTIBLE;
+
+ left = rq_time - get_jiffies_64();
+ if (left >= MAX_JIFFY_OFFSET)
+ left = MAX_JIFFY_OFFSET;
+ if (left < 0)
+ break;
+
+ new_timer.expires = jiffies + left;
+ __set_current_state(TASK_INTERRUPTIBLE);
add_timer(&new_timer);
schedule();
del_timer_sync(&new_timer);
left = rq_time - get_jiffies_64();
- }
- while ( (left > 0) &&
- !test_thread_flag(TIF_SIGPENDING));
+ } while (left > 0 && !test_thread_flag(TIF_SIGPENDING));
- if( abs_wqueue.task_list.next)
+ if (abs_wqueue.task_list.next)
finish_wait(&nanosleep_abs_wqueue, &abs_wqueue);
if (left > 0) {
diff --git a/kernel/sys.c b/kernel/sys.c
index 21c75eaf033e..9bc9d36cee53 100644
--- a/kernel/sys.c
+++ b/kernel/sys.c
@@ -209,6 +209,23 @@ cond_syscall(sys_swapon)
cond_syscall(sys_swapoff)
cond_syscall(sys_init_module)
cond_syscall(sys_delete_module)
+cond_syscall(sys_socketpair)
+cond_syscall(sys_bind)
+cond_syscall(sys_listen)
+cond_syscall(sys_accept)
+cond_syscall(sys_connect)
+cond_syscall(sys_getsockname)
+cond_syscall(sys_getpeername)
+cond_syscall(sys_sendto)
+cond_syscall(sys_send)
+cond_syscall(sys_recvfrom)
+cond_syscall(sys_recv)
+cond_syscall(sys_setsockopt)
+cond_syscall(sys_getsockopt)
+cond_syscall(sys_shutdown)
+cond_syscall(sys_sendmsg)
+cond_syscall(sys_recvmsg)
+cond_syscall(sys_socketcall)
static int set_one_prio(struct task_struct *p, int niceval, int error)
{
diff --git a/kernel/timer.c b/kernel/timer.c
index d3983cbfa8d7..eeb07f6cfec2 100644
--- a/kernel/timer.c
+++ b/kernel/timer.c
@@ -1199,11 +1199,23 @@ static void __devinit init_timers_cpu(int cpu)
INIT_LIST_HEAD(base->tv1.vec + j);
base->timer_jiffies = INITIAL_JIFFIES;
- base->tv1.index = INITIAL_JIFFIES & TVR_MASK;
- base->tv2.index = (INITIAL_JIFFIES >> TVR_BITS) & TVN_MASK;
- base->tv3.index = (INITIAL_JIFFIES >> (TVR_BITS+TVN_BITS)) & TVN_MASK;
- base->tv4.index = (INITIAL_JIFFIES >> (TVR_BITS+2*TVN_BITS)) & TVN_MASK;
- base->tv5.index = (INITIAL_JIFFIES >> (TVR_BITS+3*TVN_BITS)) & TVN_MASK;
+ /*
+ * The tv indices are always larger by one compared to the
+ * respective parts of timer_jiffies. If all lower indices are
+ * zero at initialisation, this is achieved by an (otherwise
+ * unneccessary) invocation of the timer cascade on the first
+ * timer interrupt. If not, we need to take it into account
+ * here:
+ */
+ j = (base->tv1.index = INITIAL_JIFFIES & TVR_MASK) !=0;
+ j |= (base->tv2.index = ((INITIAL_JIFFIES >> TVR_BITS) + j)
+ & TVN_MASK) !=0;
+ j |= (base->tv3.index = ((INITIAL_JIFFIES >> (TVR_BITS+TVN_BITS)) + j)
+ & TVN_MASK) !=0;
+ j |= (base->tv4.index = ((INITIAL_JIFFIES >> (TVR_BITS+2*TVN_BITS)) + j)
+ & TVN_MASK) !=0;
+ base->tv5.index = ((INITIAL_JIFFIES >> (TVR_BITS+3*TVN_BITS)) + j)
+ & TVN_MASK;
}
static int __devinit timer_cpu_notify(struct notifier_block *self,