node_to_cpumask(pcibus_to_node(bus)) \
                                )
  
+ #define cpumask_of_pcibus(bus)        (pcibus_to_node(bus) == -1 ?            \
+                                cpu_all_mask :                         \
+                                cpumask_of_node(pcibus_to_node(bus)))
+ 
  /* sched_domains SD_NODE_INIT for PPC64 machines */
  #define SD_NODE_INIT (struct sched_domain) {          \
 -      .span                   = CPU_MASK_NONE,        \
        .parent                 = NULL,                 \
        .child                  = NULL,                 \
        .groups                 = NULL,                 \
 
  # endif
  #endif
  
- #ifdef CONFIG_IRQBALANCE
- extern int irqbalance_disable(char *str);
- #endif
- 
  #ifdef CONFIG_HOTPLUG_CPU
  #include <linux/cpumask.h>
 -extern void fixup_irqs(cpumask_t map);
 +extern void fixup_irqs(void);
  #endif
  
  extern unsigned int do_IRQ(struct pt_regs *regs);
 
        get_task_struct(p);
        read_unlock(&tasklist_lock);
  
 +      if (!alloc_cpumask_var(&cpus_allowed, GFP_KERNEL)) {
 +              retval = -ENOMEM;
 +              goto out_put_task;
 +      }
 +      if (!alloc_cpumask_var(&new_mask, GFP_KERNEL)) {
 +              retval = -ENOMEM;
 +              goto out_free_cpus_allowed;
 +      }
        retval = -EPERM;
-       if ((current->euid != p->euid) && (current->euid != p->uid) &&
-                       !capable(CAP_SYS_NICE))
+       if (!check_same_owner(p) && !capable(CAP_SYS_NICE))
                goto out_unlock;
  
        retval = security_task_setscheduler(p, 0, NULL);
 
        /* Schedule the tick, if we are at least one jiffie off */
        if ((long)delta_jiffies >= 1) {
  
+               /*
+               * calculate the expiry time for the next timer wheel
+               * timer
+               */
+               expires = ktime_add_ns(last_update, tick_period.tv64 *
+                                  delta_jiffies);
+ 
+               /*
+                * If this cpu is the one which updates jiffies, then
+                * give up the assignment and let it be taken by the
+                * cpu which runs the tick timer next, which might be
+                * this cpu as well. If we don't drop this here the
+                * jiffies might be stale and do_timer() never
+                * invoked.
+                */
+               if (cpu == tick_do_timer_cpu)
+                       tick_do_timer_cpu = TICK_DO_TIMER_NONE;
+ 
                if (delta_jiffies > 1)
 -                      cpu_set(cpu, nohz_cpu_mask);
 +                      cpumask_set_cpu(cpu, nohz_cpu_mask);
+ 
+               /* Skip reprogram of event if its not changed */
+               if (ts->tick_stopped && ktime_equal(expires, dev->next_event))
+                       goto out;
+ 
                /*
                 * nohz_stop_sched_tick can be called several times before
                 * the nohz_restart_sched_tick is called. This happens when