Merge branches 'timers/clockevents', 'timers/hpet', 'timers/hrtimers' and 'timers...
authorIngo Molnar <mingo@elte.hu>
Sun, 8 Feb 2009 19:14:11 +0000 (20:14 +0100)
committerIngo Molnar <mingo@elte.hu>
Sun, 8 Feb 2009 19:14:11 +0000 (20:14 +0100)
1  2  3  4  5 
kernel/fork.c
kernel/sched.c

diff --combined kernel/fork.c
@@@@@@ -817,17 -817,17 -817,17 -817,17 -817,17 +817,17 @@@@@@ static void posix_cpu_timers_init_group
     static int copy_signal(unsigned long clone_flags, struct task_struct *tsk)
     {
        struct signal_struct *sig;
 ---    int ret;
     
        if (clone_flags & CLONE_THREAD) {
 ---            ret = thread_group_cputime_clone_thread(current);
 ---            if (likely(!ret)) {
 ---                    atomic_inc(&current->signal->count);
 ---                    atomic_inc(&current->signal->live);
 ---            }
 ---            return ret;
 +++            atomic_inc(&current->signal->count);
 +++            atomic_inc(&current->signal->live);
 +++            return 0;
        }
        sig = kmem_cache_alloc(signal_cachep, GFP_KERNEL);
 +++ 
 +++    if (sig)
 +++            posix_cpu_timers_init_group(sig);
 +++ 
        tsk->signal = sig;
        if (!sig)
                return -ENOMEM;
        sig->tty_old_pgrp = NULL;
        sig->tty = NULL;
     
----    sig->cutime = sig->cstime = cputime_zero;
++++    sig->utime = sig->stime = sig->cutime = sig->cstime = cputime_zero;
        sig->gtime = cputime_zero;
        sig->cgtime = cputime_zero;
        sig->nvcsw = sig->nivcsw = sig->cnvcsw = sig->cnivcsw = 0;
        sig->min_flt = sig->maj_flt = sig->cmin_flt = sig->cmaj_flt = 0;
        sig->inblock = sig->oublock = sig->cinblock = sig->coublock = 0;
        task_io_accounting_init(&sig->ioac);
++++    sig->sum_sched_runtime = 0;
        taskstats_tgid_init(sig);
     
        task_lock(current->group_leader);
        memcpy(sig->rlim, current->signal->rlim, sizeof sig->rlim);
        task_unlock(current->group_leader);
     
 ---    posix_cpu_timers_init_group(sig);
 --- 
        acct_init_pacct(&sig->pacct);
     
        tty_audit_fork(sig);
@@@@@@ -899,7 -901,7 -901,7 -901,7 -900,7 +900,7 @@@@@@ static void copy_flags(unsigned long cl
        clear_freeze_flag(p);
     }
     
  -  asmlinkage long sys_set_tid_address(int __user *tidptr)
  +  SYSCALL_DEFINE1(set_tid_address, int __user *, tidptr)
     {
        current->clear_child_tid = tidptr;
     
@@@@@@ -1005,7 -1007,6 -1007,6 -1007,6 -1006,6 +1006,7 @@@@@@ static struct task_struct *copy_process
         * triggers too late. This doesn't hurt, the check is only there
         * to stop root fork bombs.
         */
 ++++   retval = -EAGAIN;
        if (nr_threads >= max_threads)
                goto bad_fork_cleanup_count;
     
@@@@@@ -1602,7 -1603,7 -1603,7 -1603,7 -1602,7 +1603,7 @@@@@@ static int unshare_fd(unsigned long uns
      * constructed. Here we are modifying the current, active,
      * task_struct.
      */
  -  asmlinkage long sys_unshare(unsigned long unshare_flags)
  +  SYSCALL_DEFINE1(unshare, unsigned long, unshare_flags)
     {
        int err = 0;
        struct fs_struct *fs, *new_fs = NULL;
diff --combined kernel/sched.c
@@@@@@ -125,9 -125,9 -125,6 -125,9 -125,9 +125,9 @@@@@@ DEFINE_TRACE(sched_switch)
     DEFINE_TRACE(sched_migrate_task);
     
     #ifdef CONFIG_SMP
  +  
  +  static void double_rq_lock(struct rq *rq1, struct rq *rq2);
  +  
     /*
      * Divide a load by a sched group cpu_power : (load / sg->__cpu_power)
      * Since cpu_power is a 'constant', we can use a reciprocal divide.
@@@@@@ -1323,8 -1323,8 -1320,8 -1323,8 -1323,8 +1323,8 @@@@@@ static inline void update_load_sub(stru
      * slice expiry etc.
      */
     
  -  #define WEIGHT_IDLEPRIO            2
  -  #define WMULT_IDLEPRIO             (1 << 31)
  +  #define WEIGHT_IDLEPRIO                3
  +  #define WMULT_IDLEPRIO         1431655765
     
     /*
      * Nice levels are multiplicative, with a gentle 10% change for every
@@@@@@ -2266,16 -2266,6 -2263,6 -2266,6 -2266,16 +2266,16 @@@@@@ static int try_to_wake_up(struct task_s
        if (!sched_feat(SYNC_WAKEUPS))
                sync = 0;
     
 +++    if (!sync) {
 +++            if (current->se.avg_overlap < sysctl_sched_migration_cost &&
 +++                      p->se.avg_overlap < sysctl_sched_migration_cost)
 +++                    sync = 1;
 +++    } else {
 +++            if (current->se.avg_overlap >= sysctl_sched_migration_cost ||
 +++                      p->se.avg_overlap >= sysctl_sched_migration_cost)
 +++                    sync = 0;
 +++    }
 +++ 
     #ifdef CONFIG_SMP
        if (sched_feat(LB_WAKEUP_UPDATE)) {
                struct sched_domain *sd;
@@@@@@ -3890,19 -3880,19 -3877,19 -3880,19 -3890,24 +3890,24 @@@@@@ int select_nohz_load_balancer(int stop_
        int cpu = smp_processor_id();
     
        if (stop_tick) {
----            cpumask_set_cpu(cpu, nohz.cpu_mask);
                cpu_rq(cpu)->in_nohz_recently = 1;
     
----            /*
----             * If we are going offline and still the leader, give up!
----             */
----            if (!cpu_active(cpu) &&
----                atomic_read(&nohz.load_balancer) == cpu) {
++++            if (!cpu_active(cpu)) {
++++                    if (atomic_read(&nohz.load_balancer) != cpu)
++++                            return 0;
++++ 
++++                    /*
++++                     * If we are going offline and still the leader,
++++                     * give up!
++++                     */
                        if (atomic_cmpxchg(&nohz.load_balancer, cpu, -1) != cpu)
                                BUG();
++++ 
                        return 0;
                }
     
++++            cpumask_set_cpu(cpu, nohz.cpu_mask);
++++ 
                /* time for ilb owner also to sleep */
                if (cpumask_weight(nohz.cpu_mask) == num_online_cpus()) {
                        if (atomic_read(&nohz.load_balancer) == cpu)
@@@@@@ -4450,7 -4440,7 -4437,7 -4440,7 -4455,7 +4455,7 @@@@@@ void __kprobes sub_preempt_count(int va
        /*
         * Underflow?
         */
  -         if (DEBUG_LOCKS_WARN_ON(val > preempt_count() - (!!kernel_locked())))
  +     if (DEBUG_LOCKS_WARN_ON(val > preempt_count()))
                return;
        /*
         * Is the spinlock portion underflowing?
@@@@@@ -4697,8 -4687,8 -4684,8 -4687,8 -4702,8 +4702,8 @@@@@@ EXPORT_SYMBOL(default_wake_function)
      * started to run but is not in state TASK_RUNNING. try_to_wake_up() returns
      * zero in this (rare) case, and we handle it by continuing to scan the queue.
      */
 ----static void __wake_up_common(wait_queue_head_t *q, unsigned int mode,
 ----                        int nr_exclusive, int sync, void *key)
 ++++void __wake_up_common(wait_queue_head_t *q, unsigned int mode,
 ++++                   int nr_exclusive, int sync, void *key)
     {
        wait_queue_t *curr, *next;
     
@@@@@@ -5136,7 -5126,7 -5123,7 -5126,7 -5141,7 +5141,7 @@@@@@ int can_nice(const struct task_struct *
      * sys_setpriority is a more generic, but much slower function that
      * does similar things.
      */
  -  asmlinkage long sys_nice(int increment)
  +  SYSCALL_DEFINE1(nice, int, increment)
     {
        long nice, retval;
     
@@@@@@ -5443,8 -5433,8 -5430,8 -5433,8 -5448,8 +5448,8 @@@@@@ do_sched_setscheduler(pid_t pid, int po
      * @policy: new policy.
      * @param: structure containing the new RT priority.
      */
  -  asmlinkage long
  -  sys_sched_setscheduler(pid_t pid, int policy, struct sched_param __user *param)
  +  SYSCALL_DEFINE3(sched_setscheduler, pid_t, pid, int, policy,
  +             struct sched_param __user *, param)
     {
        /* negative values for policy are not valid */
        if (policy < 0)
      * @pid: the pid in question.
      * @param: structure containing the new RT priority.
      */
  -  asmlinkage long sys_sched_setparam(pid_t pid, struct sched_param __user *param)
  +  SYSCALL_DEFINE2(sched_setparam, pid_t, pid, struct sched_param __user *, param)
     {
        return do_sched_setscheduler(pid, -1, param);
     }
      * sys_sched_getscheduler - get the policy (scheduling class) of a thread
      * @pid: the pid in question.
      */
  -  asmlinkage long sys_sched_getscheduler(pid_t pid)
  +  SYSCALL_DEFINE1(sched_getscheduler, pid_t, pid)
     {
        struct task_struct *p;
        int retval;
      * @pid: the pid in question.
      * @param: structure containing the RT priority.
      */
  -  asmlinkage long sys_sched_getparam(pid_t pid, struct sched_param __user *param)
  +  SYSCALL_DEFINE2(sched_getparam, pid_t, pid, struct sched_param __user *, param)
     {
        struct sched_param lp;
        struct task_struct *p;
@@@@@@ -5610,8 -5600,8 -5597,8 -5600,8 -5615,8 +5615,8 @@@@@@ static int get_user_cpu_mask(unsigned l
      * @len: length in bytes of the bitmask pointed to by user_mask_ptr
      * @user_mask_ptr: user-space pointer to the new cpu mask
      */
  -  asmlinkage long sys_sched_setaffinity(pid_t pid, unsigned int len,
  -                                   unsigned long __user *user_mask_ptr)
  +  SYSCALL_DEFINE3(sched_setaffinity, pid_t, pid, unsigned int, len,
  +             unsigned long __user *, user_mask_ptr)
     {
        cpumask_var_t new_mask;
        int retval;
@@@@@@ -5658,8 -5648,8 -5645,8 -5648,8 -5663,8 +5663,8 @@@@@@ out_unlock
      * @len: length in bytes of the bitmask pointed to by user_mask_ptr
      * @user_mask_ptr: user-space pointer to hold the current cpu mask
      */
  -  asmlinkage long sys_sched_getaffinity(pid_t pid, unsigned int len,
  -                                   unsigned long __user *user_mask_ptr)
  +  SYSCALL_DEFINE3(sched_getaffinity, pid_t, pid, unsigned int, len,
  +             unsigned long __user *, user_mask_ptr)
     {
        int ret;
        cpumask_var_t mask;
      * This function yields the current CPU to other tasks. If there are no
      * other threads running on this CPU then this function will return.
      */
  -  asmlinkage long sys_sched_yield(void)
  +  SYSCALL_DEFINE0(sched_yield)
     {
        struct rq *rq = this_rq_lock();
     
@@@@@@ -5829,7 -5819,7 -5816,7 -5819,7 -5834,7 +5834,7 @@@@@@ long __sched io_schedule_timeout(long t
      * this syscall returns the maximum rt_priority that can be used
      * by a given scheduling class.
      */
  -  asmlinkage long sys_sched_get_priority_max(int policy)
  +  SYSCALL_DEFINE1(sched_get_priority_max, int, policy)
     {
        int ret = -EINVAL;
     
      * this syscall returns the minimum rt_priority that can be used
      * by a given scheduling class.
      */
  -  asmlinkage long sys_sched_get_priority_min(int policy)
  +  SYSCALL_DEFINE1(sched_get_priority_min, int, policy)
     {
        int ret = -EINVAL;
     
      * this syscall writes the default timeslice value of a given process
      * into the user-space timespec buffer. A value of '0' means infinity.
      */
  -  asmlinkage
  -  long sys_sched_rr_get_interval(pid_t pid, struct timespec __user *interval)
  +  SYSCALL_DEFINE2(sched_rr_get_interval, pid_t, pid,
  +             struct timespec __user *, interval)
     {
        struct task_struct *p;
        unsigned int time_slice;
@@@@@@ -7295,10 -7285,10 -7282,10 -7285,10 -7300,10 +7300,10 @@@@@@ cpu_to_phys_group(int cpu, const struc
      * groups, so roll our own. Now each node has its own list of groups which
      * gets dynamically allocated.
      */
  -  static DEFINE_PER_CPU(struct sched_domain, node_domains);
  +  static DEFINE_PER_CPU(struct static_sched_domain, node_domains);
     static struct sched_group ***sched_group_nodes_bycpu;
     
  -  static DEFINE_PER_CPU(struct sched_domain, allnodes_domains);
  +  static DEFINE_PER_CPU(struct static_sched_domain, allnodes_domains);
     static DEFINE_PER_CPU(struct static_sched_group, sched_group_allnodes);
     
     static int cpu_to_allnodes_group(int cpu, const struct cpumask *cpu_map,
@@@@@@ -7573,7 -7563,7 -7560,7 -7563,7 -7578,7 +7578,7 @@@@@@ static int __build_sched_domains(const 
     #ifdef CONFIG_NUMA
                if (cpumask_weight(cpu_map) >
                                SD_NODES_PER_DOMAIN*cpumask_weight(nodemask)) {
  -                     sd = &per_cpu(allnodes_domains, i);
  +                     sd = &per_cpu(allnodes_domains, i).sd;
                        SD_INIT(sd, ALLNODES);
                        set_domain_attribute(sd, attr);
                        cpumask_copy(sched_domain_span(sd), cpu_map);
                } else
                        p = NULL;
     
  -             sd = &per_cpu(node_domains, i);
  +             sd = &per_cpu(node_domains, i).sd;
                SD_INIT(sd, NODE);
                set_domain_attribute(sd, attr);
                sched_domain_node_span(cpu_to_node(i), sched_domain_span(sd));
                for_each_cpu(j, nodemask) {
                        struct sched_domain *sd;
     
  -                     sd = &per_cpu(node_domains, j);
  +                     sd = &per_cpu(node_domains, j).sd;
                        sd->groups = sg;
                }
                sg->__cpu_power = 0;
@@@@@@ -9060,13 -9050,13 -9047,6 -9050,13 -9065,13 +9065,13 @@@@@@ static int tg_schedulable(struct task_g
                runtime = d->rt_runtime;
        }
     
  +  #ifdef CONFIG_USER_SCHED
  +     if (tg == &root_task_group) {
  +             period = global_rt_period();
  +             runtime = global_rt_runtime();
  +     }
  +  #endif
  +  
        /*
         * Cannot have more runtime than the period.
         */