]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/commitdiff
Merge branch 'cpumask-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git...
authorRusty Russell <rusty@rustcorp.com.au>
Tue, 31 Mar 2009 03:03:50 +0000 (13:33 +1030)
committerRusty Russell <rusty@rustcorp.com.au>
Tue, 31 Mar 2009 03:03:50 +0000 (13:33 +1030)
Conflicts:

arch/x86/include/asm/topology.h
drivers/oprofile/buffer_sync.c
(Both cases: changed in Linus' tree, removed in Ingo's).

1  2 
arch/x86/include/asm/topology.h
arch/x86/kernel/apm_32.c
drivers/pci/pci-driver.c
kernel/sched.c
mm/page_alloc.c
mm/slab.c
mm/vmscan.c
net/sunrpc/svc.c

index 744299c0b7749829a2af79dc76eb10f0fbfa6a55,e3f4198371a9a46e4556241d2cb95d5cad78263d..892b119dba6ff8c64c99c8c3432e812de860ef98
@@@ -44,9 -44,6 +44,6 @@@
  
  #ifdef CONFIG_X86_32
  
- /* Mappings between node number and cpus on that node. */
- extern cpumask_t node_to_cpumask_map[];
  /* Mappings between logical cpu number and node number */
  extern int cpu_to_node_map[];
  
@@@ -57,30 -54,8 +54,8 @@@ static inline int cpu_to_node(int cpu
  }
  #define early_cpu_to_node(cpu)        cpu_to_node(cpu)
  
- /* Returns a bitmask of CPUs on Node 'node'.
-  *
-  * Side note: this function creates the returned cpumask on the stack
-  * so with a high NR_CPUS count, excessive stack space is used.  The
-  * cpumask_of_node function should be used whenever possible.
-  */
- static inline cpumask_t node_to_cpumask(int node)
- {
-       return node_to_cpumask_map[node];
- }
- /* Returns a bitmask of CPUs on Node 'node'. */
- static inline const struct cpumask *cpumask_of_node(int node)
- {
-       return &node_to_cpumask_map[node];
- }
- static inline void setup_node_to_cpumask_map(void) { }
  #else /* CONFIG_X86_64 */
  
- /* Mappings between node number and cpus on that node. */
- extern cpumask_t *node_to_cpumask_map;
  /* Mappings between logical cpu number and node number */
  DECLARE_EARLY_PER_CPU(int, x86_cpu_to_node_map);
  
@@@ -91,8 -66,6 +66,6 @@@ DECLARE_PER_CPU(int, node_number)
  #ifdef CONFIG_DEBUG_PER_CPU_MAPS
  extern int cpu_to_node(int cpu);
  extern int early_cpu_to_node(int cpu);
- extern const cpumask_t *cpumask_of_node(int node);
- extern cpumask_t node_to_cpumask(int node);
  
  #else /* !CONFIG_DEBUG_PER_CPU_MAPS */
  
@@@ -108,34 -81,25 +81,25 @@@ static inline int early_cpu_to_node(in
        return early_per_cpu(x86_cpu_to_node_map, cpu);
  }
  
- /* Returns a pointer to the cpumask of CPUs on Node 'node'. */
- static inline const cpumask_t *cpumask_of_node(int node)
- {
-       return &node_to_cpumask_map[node];
- }
+ #endif /* !CONFIG_DEBUG_PER_CPU_MAPS */
+ #endif /* CONFIG_X86_64 */
  
- /* Returns a bitmask of CPUs on Node 'node'. */
- static inline cpumask_t node_to_cpumask(int node)
+ /* Mappings between node number and cpus on that node. */
+ extern cpumask_var_t node_to_cpumask_map[MAX_NUMNODES];
+ #ifdef CONFIG_DEBUG_PER_CPU_MAPS
+ extern const struct cpumask *cpumask_of_node(int node);
+ #else
+ /* Returns a pointer to the cpumask of CPUs on Node 'node'. */
+ static inline const struct cpumask *cpumask_of_node(int node)
  {
        return node_to_cpumask_map[node];
  }
- #endif /* !CONFIG_DEBUG_PER_CPU_MAPS */
+ #endif
  
  extern void setup_node_to_cpumask_map(void);
  
- /*
-  * Replace default node_to_cpumask_ptr with optimized version
-  * Deprecated: use "const struct cpumask *mask = cpumask_of_node(node)"
-  */
- #define node_to_cpumask_ptr(v, node)          \
-               const cpumask_t *v = cpumask_of_node(node)
- #define node_to_cpumask_ptr_next(v, node)     \
-                          v = cpumask_of_node(node)
- #endif /* CONFIG_X86_64 */
  /*
   * Returns the number of the node containing Node 'node'. This
   * architecture is flat, so it is a pretty simple function!
  #define parent_node(node) (node)
  
  #define pcibus_to_node(bus) __pcibus_to_node(bus)
- #define pcibus_to_cpumask(bus) __pcibus_to_cpumask(bus)
  
  #ifdef CONFIG_X86_32
  extern unsigned long node_start_pfn[];
@@@ -209,40 -172,36 +172,24 @@@ static inline int early_cpu_to_node(in
        return 0;
  }
  
- static inline const cpumask_t *cpumask_of_node(int node)
- {
-       return &cpu_online_map;
- }
- static inline cpumask_t node_to_cpumask(int node)
+ static inline const struct cpumask *cpumask_of_node(int node)
  {
-       return cpu_online_map;
+       return cpu_online_mask;
  }
 -static inline int node_to_first_cpu(int node)
 -{
 -      return cpumask_first(cpu_online_mask);
 -}
  
  static inline void setup_node_to_cpumask_map(void) { }
  
- /*
-  * Replace default node_to_cpumask_ptr with optimized version
-  * Deprecated: use "const struct cpumask *mask = cpumask_of_node(node)"
-  */
- #define node_to_cpumask_ptr(v, node)          \
-               const cpumask_t *v = cpumask_of_node(node)
- #define node_to_cpumask_ptr_next(v, node)     \
-                          v = cpumask_of_node(node)
  #endif
  
  #include <asm-generic/topology.h>
  
- extern cpumask_t cpu_coregroup_map(int cpu);
 -#ifdef CONFIG_NUMA
 -/* Returns the number of the first CPU on Node 'node'. */
 -static inline int node_to_first_cpu(int node)
 -{
 -      return cpumask_first(cpumask_of_node(node));
 -}
 -#endif
 -
  extern const struct cpumask *cpu_coregroup_mask(int cpu);
  
  #ifdef ENABLE_TOPO_DEFINES
  #define topology_physical_package_id(cpu)     (cpu_data(cpu).phys_proc_id)
  #define topology_core_id(cpu)                 (cpu_data(cpu).cpu_core_id)
- #define topology_core_siblings(cpu)           (per_cpu(cpu_core_map, cpu))
- #define topology_thread_siblings(cpu)         (per_cpu(cpu_sibling_map, cpu))
- #define topology_core_cpumask(cpu)            (&per_cpu(cpu_core_map, cpu))
- #define topology_thread_cpumask(cpu)          (&per_cpu(cpu_sibling_map, cpu))
+ #define topology_core_cpumask(cpu)            (per_cpu(cpu_core_map, cpu))
+ #define topology_thread_cpumask(cpu)          (per_cpu(cpu_sibling_map, cpu))
  
  /* indicates that pointers to the topology cpumask_t maps are valid */
  #define arch_provides_topology_pointers               yes
@@@ -256,7 -215,7 +203,7 @@@ struct pci_bus
  void set_pci_bus_resources_arch_default(struct pci_bus *b);
  
  #ifdef CONFIG_SMP
- #define mc_capable()  (cpus_weight(per_cpu(cpu_core_map, 0)) != nr_cpu_ids)
+ #define mc_capable()  (cpumask_weight(cpu_core_mask(0)) != nr_cpu_ids)
  #define smt_capable()                 (smp_num_siblings > 1)
  #endif
  
diff --combined arch/x86/kernel/apm_32.c
index ac7783a6743230693540178af6c13e9bfa98a383,c1941be9fb1777e57cb09190023422e8d17af2e8..49e0939bac4211ba35f32240af5e92ed905ec578
@@@ -466,7 -466,7 +466,7 @@@ static const lookup_t error_table[] = 
   *    @err: APM BIOS return code
   *
   *    Write a meaningful log entry to the kernel log in the event of
-  *    an APM error.
+  *    an APM error.  Note that this also handles (negative) kernel errors.
   */
  
  static void apm_error(char *str, int err)
                        break;
        if (i < ERROR_COUNT)
                printk(KERN_NOTICE "apm: %s: %s\n", str, error_table[i].msg);
+       else if (err < 0)
+               printk(KERN_NOTICE "apm: %s: linux error code %i\n", str, err);
        else
                printk(KERN_NOTICE "apm: %s: unknown error code %#2.2x\n",
                       str, err);
  }
  
- /*
-  * Lock APM functionality to physical CPU 0
-  */
- #ifdef CONFIG_SMP
- static cpumask_t apm_save_cpus(void)
- {
-       cpumask_t x = current->cpus_allowed;
-       /* Some bioses don't like being called from CPU != 0 */
-       set_cpus_allowed(current, cpumask_of_cpu(0));
-       BUG_ON(smp_processor_id() != 0);
-       return x;
- }
- static inline void apm_restore_cpus(cpumask_t mask)
- {
-       set_cpus_allowed(current, mask);
- }
- #else
- /*
-  *    No CPU lockdown needed on a uniprocessor
-  */
- #define apm_save_cpus()               (current->cpus_allowed)
- #define apm_restore_cpus(x)   (void)(x)
- #endif
  /*
   * These are the actual BIOS calls.  Depending on APM_ZERO_SEGS and
   * apm_info.allow_ints, we are being really paranoid here!  Not only
@@@ -568,16 -539,23 +539,23 @@@ static inline void apm_irq_restore(unsi
  #     define APM_DO_RESTORE_SEGS
  #endif
  
+ struct apm_bios_call {
+       u32 func;
+       /* In and out */
+       u32 ebx;
+       u32 ecx;
+       /* Out only */
+       u32 eax;
+       u32 edx;
+       u32 esi;
+       /* Error: -ENOMEM, or bits 8-15 of eax */
+       int err;
+ };
  /**
-  *    apm_bios_call   -       Make an APM BIOS 32bit call
-  *    @func: APM function to execute
-  *    @ebx_in: EBX register for call entry
-  *    @ecx_in: ECX register for call entry
-  *    @eax: EAX register return
-  *    @ebx: EBX register return
-  *    @ecx: ECX register return
-  *    @edx: EDX register return
-  *    @esi: ESI register return
+  *    __apm_bios_call - Make an APM BIOS 32bit call
+  *    @_call: pointer to struct apm_bios_call.
   *
   *    Make an APM call using the 32bit protected mode interface. The
   *    caller is responsible for knowing if APM BIOS is configured and
   *    flag is loaded into AL.  If there is an error, then the error
   *    code is returned in AH (bits 8-15 of eax) and this function
   *    returns non-zero.
+  *
+  *    Note: this makes the call on the current CPU.
   */
- static u8 apm_bios_call(u32 func, u32 ebx_in, u32 ecx_in,
-       u32 *eax, u32 *ebx, u32 *ecx, u32 *edx, u32 *esi)
+ static long __apm_bios_call(void *_call)
  {
        APM_DECL_SEGS
        unsigned long           flags;
-       cpumask_t               cpus;
        int                     cpu;
        struct desc_struct      save_desc_40;
        struct desc_struct      *gdt;
-       cpus = apm_save_cpus();
+       struct apm_bios_call    *call = _call;
  
        cpu = get_cpu();
+       BUG_ON(cpu != 0);
        gdt = get_cpu_gdt_table(cpu);
        save_desc_40 = gdt[0x40 / 8];
        gdt[0x40 / 8] = bad_bios_desc;
  
        apm_irq_save(flags);
        APM_DO_SAVE_SEGS;
-       apm_bios_call_asm(func, ebx_in, ecx_in, eax, ebx, ecx, edx, esi);
+       apm_bios_call_asm(call->func, call->ebx, call->ecx,
+                         &call->eax, &call->ebx, &call->ecx, &call->edx,
+                         &call->esi);
        APM_DO_RESTORE_SEGS;
        apm_irq_restore(flags);
        gdt[0x40 / 8] = save_desc_40;
        put_cpu();
-       apm_restore_cpus(cpus);
  
-       return *eax & 0xff;
+       return call->eax & 0xff;
+ }
+ /* Run __apm_bios_call or __apm_bios_call_simple on CPU 0 */
+ static int on_cpu0(long (*fn)(void *), struct apm_bios_call *call)
+ {
+       int ret;
+       /* Don't bother with work_on_cpu in the common case, so we don't
+        * have to worry about OOM or overhead. */
+       if (get_cpu() == 0) {
+               ret = fn(call);
+               put_cpu();
+       } else {
+               put_cpu();
+               ret = work_on_cpu(0, fn, call);
+       }
+       /* work_on_cpu can fail with -ENOMEM */
+       if (ret < 0)
+               call->err = ret;
+       else
+               call->err = (call->eax >> 8) & 0xff;
+       return ret;
  }
  
  /**
-  *    apm_bios_call_simple    -       make a simple APM BIOS 32bit call
-  *    @func: APM function to invoke
-  *    @ebx_in: EBX register value for BIOS call
-  *    @ecx_in: ECX register value for BIOS call
-  *    @eax: EAX register on return from the BIOS call
+  *    apm_bios_call   -       Make an APM BIOS 32bit call (on CPU 0)
+  *    @call: the apm_bios_call registers.
+  *
+  *    If there is an error, it is returned in @call.err.
+  */
+ static int apm_bios_call(struct apm_bios_call *call)
+ {
+       return on_cpu0(__apm_bios_call, call);
+ }
+ /**
+  *    __apm_bios_call_simple - Make an APM BIOS 32bit call (on CPU 0)
+  *    @_call: pointer to struct apm_bios_call.
   *
   *    Make a BIOS call that returns one value only, or just status.
   *    If there is an error, then the error code is returned in AH
-  *    (bits 8-15 of eax) and this function returns non-zero. This is
-  *    used for simpler BIOS operations. This call may hold interrupts
-  *    off for a long time on some laptops.
+  *    (bits 8-15 of eax) and this function returns non-zero (it can
+  *    also return -ENOMEM). This is used for simpler BIOS operations.
+  *    This call may hold interrupts off for a long time on some laptops.
+  *
+  *    Note: this makes the call on the current CPU.
   */
- static u8 apm_bios_call_simple(u32 func, u32 ebx_in, u32 ecx_in, u32 *eax)
+ static long __apm_bios_call_simple(void *_call)
  {
        u8                      error;
        APM_DECL_SEGS
        unsigned long           flags;
-       cpumask_t               cpus;
        int                     cpu;
        struct desc_struct      save_desc_40;
        struct desc_struct      *gdt;
-       cpus = apm_save_cpus();
+       struct apm_bios_call    *call = _call;
  
        cpu = get_cpu();
+       BUG_ON(cpu != 0);
        gdt = get_cpu_gdt_table(cpu);
        save_desc_40 = gdt[0x40 / 8];
        gdt[0x40 / 8] = bad_bios_desc;
  
        apm_irq_save(flags);
        APM_DO_SAVE_SEGS;
-       error = apm_bios_call_simple_asm(func, ebx_in, ecx_in, eax);
+       error = apm_bios_call_simple_asm(call->func, call->ebx, call->ecx,
+                                        &call->eax);
        APM_DO_RESTORE_SEGS;
        apm_irq_restore(flags);
        gdt[0x40 / 8] = save_desc_40;
        put_cpu();
-       apm_restore_cpus(cpus);
        return error;
  }
  
+ /**
+  *    apm_bios_call_simple    -       make a simple APM BIOS 32bit call
+  *    @func: APM function to invoke
+  *    @ebx_in: EBX register value for BIOS call
+  *    @ecx_in: ECX register value for BIOS call
+  *    @eax: EAX register on return from the BIOS call
+  *    @err: bits
+  *
+  *    Make a BIOS call that returns one value only, or just status.
+  *    If there is an error, then the error code is returned in @err
+  *    and this function returns non-zero. This is used for simpler
+  *    BIOS operations.  This call may hold interrupts off for a long
+  *    time on some laptops.
+  */
+ static int apm_bios_call_simple(u32 func, u32 ebx_in, u32 ecx_in, u32 *eax,
+                               int *err)
+ {
+       struct apm_bios_call call;
+       int ret;
+       call.func = func;
+       call.ebx = ebx_in;
+       call.ecx = ecx_in;
+       ret = on_cpu0(__apm_bios_call_simple, &call);
+       *eax = call.eax;
+       *err = call.err;
+       return ret;
+ }
  /**
   *    apm_driver_version      -       APM driver version
   *    @val:   loaded with the APM version on return
  static int apm_driver_version(u_short *val)
  {
        u32 eax;
+       int err;
  
-       if (apm_bios_call_simple(APM_FUNC_VERSION, 0, *val, &eax))
-               return (eax >> 8) & 0xff;
+       if (apm_bios_call_simple(APM_FUNC_VERSION, 0, *val, &eax, &err))
+               return err;
        *val = eax;
        return APM_SUCCESS;
  }
   *    that APM 1.2 is in use. If no messges are pending the value 0x80
   *    is returned (No power management events pending).
   */
  static int apm_get_event(apm_event_t *event, apm_eventinfo_t *info)
  {
-       u32 eax;
-       u32 ebx;
-       u32 ecx;
-       u32 dummy;
+       struct apm_bios_call call;
  
-       if (apm_bios_call(APM_FUNC_GET_EVENT, 0, 0, &eax, &ebx, &ecx,
-                         &dummy, &dummy))
-               return (eax >> 8) & 0xff;
-       *event = ebx;
+       call.func = APM_FUNC_GET_EVENT;
+       call.ebx = call.ecx = 0;
+       if (apm_bios_call(&call))
+               return call.err;
+       *event = call.ebx;
        if (apm_info.connection_version < 0x0102)
                *info = ~0; /* indicate info not valid */
        else
-               *info = ecx;
+               *info = call.ecx;
        return APM_SUCCESS;
  }
  
  static int set_power_state(u_short what, u_short state)
  {
        u32 eax;
+       int err;
  
-       if (apm_bios_call_simple(APM_FUNC_SET_STATE, what, state, &eax))
-               return (eax >> 8) & 0xff;
+       if (apm_bios_call_simple(APM_FUNC_SET_STATE, what, state, &eax, &err))
+               return err;
        return APM_SUCCESS;
  }
  
@@@ -770,6 -811,7 +811,7 @@@ static int apm_do_idle(void
        u8 ret = 0;
        int idled = 0;
        int polling;
+       int err;
  
        polling = !!(current_thread_info()->status & TS_POLLING);
        if (polling) {
        }
        if (!need_resched()) {
                idled = 1;
-               ret = apm_bios_call_simple(APM_FUNC_IDLE, 0, 0, &eax);
+               ret = apm_bios_call_simple(APM_FUNC_IDLE, 0, 0, &eax, &err);
        }
        if (polling)
                current_thread_info()->status |= TS_POLLING;
                 * Only report the failure the first 5 times.
                 */
                if (++t < 5) {
-                       printk(KERN_DEBUG "apm_do_idle failed (%d)\n",
-                              (eax >> 8) & 0xff);
+                       printk(KERN_DEBUG "apm_do_idle failed (%d)\n", err);
                        t = jiffies;
                }
                return -1;
  static void apm_do_busy(void)
  {
        u32 dummy;
+       int err;
  
        if (clock_slowed || ALWAYS_CALL_BUSY) {
-               (void)apm_bios_call_simple(APM_FUNC_BUSY, 0, 0, &dummy);
+               (void)apm_bios_call_simple(APM_FUNC_BUSY, 0, 0, &dummy, &err);
                clock_slowed = 0;
        }
  }
@@@ -937,7 -979,7 +979,7 @@@ static void apm_power_off(void
  
        /* Some bioses don't like being called from CPU != 0 */
        if (apm_info.realmode_power_off) {
-               (void)apm_save_cpus();
+               set_cpus_allowed_ptr(current, cpumask_of(0));
                machine_real_restart(po_bios_call, sizeof(po_bios_call));
        } else {
                (void)set_system_power_state(APM_STATE_OFF);
  static int apm_enable_power_management(int enable)
  {
        u32 eax;
+       int err;
  
        if ((enable == 0) && (apm_info.bios.flags & APM_BIOS_DISENGAGED))
                return APM_NOT_ENGAGED;
        if (apm_bios_call_simple(APM_FUNC_ENABLE_PM, APM_DEVICE_BALL,
-                                enable, &eax))
-               return (eax >> 8) & 0xff;
+                                enable, &eax, &err))
+               return err;
        if (enable)
                apm_info.bios.flags &= ~APM_BIOS_DISABLED;
        else
  
  static int apm_get_power_status(u_short *status, u_short *bat, u_short *life)
  {
-       u32 eax;
-       u32 ebx;
-       u32 ecx;
-       u32 edx;
-       u32 dummy;
+       struct apm_bios_call call;
+       call.func = APM_FUNC_GET_STATUS;
+       call.ebx = APM_DEVICE_ALL;
+       call.ecx = 0;
  
        if (apm_info.get_power_status_broken)
                return APM_32_UNSUPPORTED;
-       if (apm_bios_call(APM_FUNC_GET_STATUS, APM_DEVICE_ALL, 0,
-                         &eax, &ebx, &ecx, &edx, &dummy))
-               return (eax >> 8) & 0xff;
-       *status = ebx;
-       *bat = ecx;
+       if (apm_bios_call(&call))
+               return call.err;
+       *status = call.ebx;
+       *bat = call.ecx;
        if (apm_info.get_power_status_swabinminutes) {
-               *life = swab16((u16)edx);
+               *life = swab16((u16)call.edx);
                *life |= 0x8000;
        } else
-               *life = edx;
+               *life = call.edx;
        return APM_SUCCESS;
  }
  
@@@ -1048,12 -1090,14 +1090,14 @@@ static int apm_get_battery_status(u_sho
  static int apm_engage_power_management(u_short device, int enable)
  {
        u32 eax;
+       int err;
  
        if ((enable == 0) && (device == APM_DEVICE_ALL)
            && (apm_info.bios.flags & APM_BIOS_DISABLED))
                return APM_DISABLED;
-       if (apm_bios_call_simple(APM_FUNC_ENGAGE_PM, device, enable, &eax))
-               return (eax >> 8) & 0xff;
+       if (apm_bios_call_simple(APM_FUNC_ENGAGE_PM, device, enable,
+                                &eax, &err))
+               return err;
        if (device == APM_DEVICE_ALL) {
                if (enable)
                        apm_info.bios.flags &= ~APM_BIOS_DISENGAGED;
@@@ -1190,10 -1234,8 +1234,10 @@@ static int suspend(int vetoable
        struct apm_user *as;
  
        device_suspend(PMSG_SUSPEND);
 -      local_irq_disable();
 +
        device_power_down(PMSG_SUSPEND);
 +
 +      local_irq_disable();
        sysdev_suspend(PMSG_SUSPEND);
  
        local_irq_enable();
        if (err != APM_SUCCESS)
                apm_error("suspend", err);
        err = (err == APM_SUCCESS) ? 0 : -EIO;
 +
        sysdev_resume();
 -      device_power_up(PMSG_RESUME);
        local_irq_enable();
 +
 +      device_power_up(PMSG_RESUME);
 +
        device_resume(PMSG_RESUME);
        queue_event(APM_NORMAL_RESUME, NULL);
        spin_lock(&user_list_lock);
@@@ -1233,9 -1272,8 +1277,9 @@@ static void standby(void
  {
        int err;
  
 -      local_irq_disable();
        device_power_down(PMSG_SUSPEND);
 +
 +      local_irq_disable();
        sysdev_suspend(PMSG_SUSPEND);
        local_irq_enable();
  
  
        local_irq_disable();
        sysdev_resume();
 -      device_power_up(PMSG_RESUME);
        local_irq_enable();
 +
 +      device_power_up(PMSG_RESUME);
  }
  
  static apm_event_t get_event(void)
@@@ -1689,16 -1726,14 +1733,14 @@@ static int apm(void *unused
        char            *power_stat;
        char            *bat_stat;
  
- #ifdef CONFIG_SMP
        /* 2002/08/01 - WT
         * This is to avoid random crashes at boot time during initialization
         * on SMP systems in case of "apm=power-off" mode. Seen on ASUS A7M266D.
         * Some bioses don't like being called from CPU != 0.
         * Method suggested by Ingo Molnar.
         */
-       set_cpus_allowed(current, cpumask_of_cpu(0));
+       set_cpus_allowed_ptr(current, cpumask_of(0));
        BUG_ON(smp_processor_id() != 0);
- #endif
  
        if (apm_info.connection_version == 0) {
                apm_info.connection_version = apm_info.bios.version;
diff --combined drivers/pci/pci-driver.c
index 267de88551c96df9ba272ba8203552f176af542a,b522f883d67432b5969b011634df7e369da881a5..16240390bcde2070de75c8162c4bd52666d07686
@@@ -212,10 -212,9 +212,9 @@@ static int pci_call_probe(struct pci_dr
        node = dev_to_node(&dev->dev);
        if (node >= 0) {
                int cpu;
-               node_to_cpumask_ptr(nodecpumask, node);
  
                get_online_cpus();
-               cpu = cpumask_any_and(nodecpumask, cpu_online_mask);
+               cpu = cpumask_any_and(cpumask_of_node(node), cpu_online_mask);
                if (cpu < nr_cpu_ids)
                        error = work_on_cpu(cpu, local_pci_probe, &ddi);
                else
@@@ -352,60 -351,53 +351,60 @@@ static int pci_legacy_suspend(struct de
  {
        struct pci_dev * pci_dev = to_pci_dev(dev);
        struct pci_driver * drv = pci_dev->driver;
 -      int i = 0;
 +
 +      pci_dev->state_saved = false;
  
        if (drv && drv->suspend) {
                pci_power_t prev = pci_dev->current_state;
 +              int error;
  
 -              pci_dev->state_saved = false;
 -
 -              i = drv->suspend(pci_dev, state);
 -              suspend_report_result(drv->suspend, i);
 -              if (i)
 -                      return i;
 -
 -              if (pci_dev->state_saved)
 -                      goto Fixup;
 +              error = drv->suspend(pci_dev, state);
 +              suspend_report_result(drv->suspend, error);
 +              if (error)
 +                      return error;
  
 -              if (pci_dev->current_state != PCI_D0
 +              if (!pci_dev->state_saved && pci_dev->current_state != PCI_D0
                    && pci_dev->current_state != PCI_UNKNOWN) {
                        WARN_ONCE(pci_dev->current_state != prev,
                                "PCI PM: Device state not saved by %pF\n",
                                drv->suspend);
 -                      goto Fixup;
                }
        }
  
 -      pci_save_state(pci_dev);
 -      /*
 -       * This is for compatibility with existing code with legacy PM support.
 -       */
 -      pci_pm_set_unknown_state(pci_dev);
 -
 - Fixup:
        pci_fixup_device(pci_fixup_suspend, pci_dev);
  
 -      return i;
 +      return 0;
  }
  
  static int pci_legacy_suspend_late(struct device *dev, pm_message_t state)
  {
        struct pci_dev * pci_dev = to_pci_dev(dev);
        struct pci_driver * drv = pci_dev->driver;
 -      int i = 0;
  
        if (drv && drv->suspend_late) {
 -              i = drv->suspend_late(pci_dev, state);
 -              suspend_report_result(drv->suspend_late, i);
 +              pci_power_t prev = pci_dev->current_state;
 +              int error;
 +
 +              error = drv->suspend_late(pci_dev, state);
 +              suspend_report_result(drv->suspend_late, error);
 +              if (error)
 +                      return error;
 +
 +              if (!pci_dev->state_saved && pci_dev->current_state != PCI_D0
 +                  && pci_dev->current_state != PCI_UNKNOWN) {
 +                      WARN_ONCE(pci_dev->current_state != prev,
 +                              "PCI PM: Device state not saved by %pF\n",
 +                              drv->suspend_late);
 +                      return 0;
 +              }
        }
 -      return i;
 +
 +      if (!pci_dev->state_saved)
 +              pci_save_state(pci_dev);
 +
 +      pci_pm_set_unknown_state(pci_dev);
 +
 +      return 0;
  }
  
  static int pci_legacy_resume_early(struct device *dev)
@@@ -430,23 -422,6 +429,23 @@@ static int pci_legacy_resume(struct dev
  
  /* Auxiliary functions used by the new power management framework */
  
 +/**
 + * pci_restore_standard_config - restore standard config registers of PCI device
 + * @pci_dev: PCI device to handle
 + */
 +static int pci_restore_standard_config(struct pci_dev *pci_dev)
 +{
 +      pci_update_current_state(pci_dev, PCI_UNKNOWN);
 +
 +      if (pci_dev->current_state != PCI_D0) {
 +              int error = pci_set_power_state(pci_dev, PCI_D0);
 +              if (error)
 +                      return error;
 +      }
 +
 +      return pci_dev->state_saved ? pci_restore_state(pci_dev) : 0;
 +}
 +
  static void pci_pm_default_resume_noirq(struct pci_dev *pci_dev)
  {
        pci_restore_standard_config(pci_dev);
@@@ -467,6 -442,7 +466,6 @@@ static void pci_pm_default_suspend(stru
        /* Disable non-bridge devices without PM support */
        if (!pci_is_bridge(pci_dev))
                pci_disable_enabled_device(pci_dev);
 -      pci_save_state(pci_dev);
  }
  
  static bool pci_has_legacy_pm_support(struct pci_dev *pci_dev)
@@@ -516,13 -492,13 +515,13 @@@ static int pci_pm_suspend(struct devic
        if (pci_has_legacy_pm_support(pci_dev))
                return pci_legacy_suspend(dev, PMSG_SUSPEND);
  
 +      pci_dev->state_saved = false;
 +
        if (!pm) {
                pci_pm_default_suspend(pci_dev);
                goto Fixup;
        }
  
 -      pci_dev->state_saved = false;
 -
        if (pm->suspend) {
                pci_power_t prev = pci_dev->current_state;
                int error;
                if (error)
                        return error;
  
 -              if (pci_dev->state_saved)
 -                      goto Fixup;
 -
 -              if (pci_dev->current_state != PCI_D0
 +              if (!pci_dev->state_saved && pci_dev->current_state != PCI_D0
                    && pci_dev->current_state != PCI_UNKNOWN) {
                        WARN_ONCE(pci_dev->current_state != prev,
                                "PCI PM: State of device not saved by %pF\n",
                                pm->suspend);
 -                      goto Fixup;
                }
        }
  
 -      if (!pci_dev->state_saved) {
 -              pci_save_state(pci_dev);
 -              if (!pci_is_bridge(pci_dev))
 -                      pci_prepare_to_sleep(pci_dev);
 -      }
 -
   Fixup:
        pci_fixup_device(pci_fixup_suspend, pci_dev);
  
  static int pci_pm_suspend_noirq(struct device *dev)
  {
        struct pci_dev *pci_dev = to_pci_dev(dev);
 -      struct device_driver *drv = dev->driver;
 -      int error = 0;
 +      struct dev_pm_ops *pm = dev->driver ? dev->driver->pm : NULL;
  
        if (pci_has_legacy_pm_support(pci_dev))
                return pci_legacy_suspend_late(dev, PMSG_SUSPEND);
  
 -      if (drv && drv->pm && drv->pm->suspend_noirq) {
 -              error = drv->pm->suspend_noirq(dev);
 -              suspend_report_result(drv->pm->suspend_noirq, error);
 +      if (!pm) {
 +              pci_save_state(pci_dev);
 +              return 0;
        }
  
 -      if (!error)
 -              pci_pm_set_unknown_state(pci_dev);
 +      if (pm->suspend_noirq) {
 +              pci_power_t prev = pci_dev->current_state;
 +              int error;
  
 -      return error;
 +              error = pm->suspend_noirq(dev);
 +              suspend_report_result(pm->suspend_noirq, error);
 +              if (error)
 +                      return error;
 +
 +              if (!pci_dev->state_saved && pci_dev->current_state != PCI_D0
 +                  && pci_dev->current_state != PCI_UNKNOWN) {
 +                      WARN_ONCE(pci_dev->current_state != prev,
 +                              "PCI PM: State of device not saved by %pF\n",
 +                              pm->suspend_noirq);
 +                      return 0;
 +              }
 +      }
 +
 +      if (!pci_dev->state_saved) {
 +              pci_save_state(pci_dev);
 +              if (!pci_is_bridge(pci_dev))
 +                      pci_prepare_to_sleep(pci_dev);
 +      }
 +
 +      pci_pm_set_unknown_state(pci_dev);
 +
 +      return 0;
  }
  
  static int pci_pm_resume_noirq(struct device *dev)
@@@ -652,13 -616,13 +651,13 @@@ static int pci_pm_freeze(struct device 
        if (pci_has_legacy_pm_support(pci_dev))
                return pci_legacy_suspend(dev, PMSG_FREEZE);
  
 +      pci_dev->state_saved = false;
 +
        if (!pm) {
                pci_pm_default_suspend(pci_dev);
                return 0;
        }
  
 -      pci_dev->state_saved = false;
 -
        if (pm->freeze) {
                int error;
  
                        return error;
        }
  
 -      if (!pci_dev->state_saved)
 -              pci_save_state(pci_dev);
 -
        return 0;
  }
  
@@@ -675,25 -642,20 +674,25 @@@ static int pci_pm_freeze_noirq(struct d
  {
        struct pci_dev *pci_dev = to_pci_dev(dev);
        struct device_driver *drv = dev->driver;
 -      int error = 0;
  
        if (pci_has_legacy_pm_support(pci_dev))
                return pci_legacy_suspend_late(dev, PMSG_FREEZE);
  
        if (drv && drv->pm && drv->pm->freeze_noirq) {
 +              int error;
 +
                error = drv->pm->freeze_noirq(dev);
                suspend_report_result(drv->pm->freeze_noirq, error);
 +              if (error)
 +                      return error;
        }
  
 -      if (!error)
 -              pci_pm_set_unknown_state(pci_dev);
 +      if (!pci_dev->state_saved)
 +              pci_save_state(pci_dev);
  
 -      return error;
 +      pci_pm_set_unknown_state(pci_dev);
 +
 +      return 0;
  }
  
  static int pci_pm_thaw_noirq(struct device *dev)
@@@ -736,56 -698,46 +735,56 @@@ static int pci_pm_poweroff(struct devic
  {
        struct pci_dev *pci_dev = to_pci_dev(dev);
        struct dev_pm_ops *pm = dev->driver ? dev->driver->pm : NULL;
 -      int error = 0;
  
        if (pci_has_legacy_pm_support(pci_dev))
                return pci_legacy_suspend(dev, PMSG_HIBERNATE);
  
 +      pci_dev->state_saved = false;
 +
        if (!pm) {
                pci_pm_default_suspend(pci_dev);
                goto Fixup;
        }
  
 -      pci_dev->state_saved = false;
 -
        if (pm->poweroff) {
 +              int error;
 +
                error = pm->poweroff(dev);
                suspend_report_result(pm->poweroff, error);
 +              if (error)
 +                      return error;
        }
  
 -      if (!pci_dev->state_saved && !pci_is_bridge(pci_dev))
 -              pci_prepare_to_sleep(pci_dev);
 -
   Fixup:
        pci_fixup_device(pci_fixup_suspend, pci_dev);
  
 -      return error;
 +      return 0;
  }
  
  static int pci_pm_poweroff_noirq(struct device *dev)
  {
 +      struct pci_dev *pci_dev = to_pci_dev(dev);
        struct device_driver *drv = dev->driver;
 -      int error = 0;
  
        if (pci_has_legacy_pm_support(to_pci_dev(dev)))
                return pci_legacy_suspend_late(dev, PMSG_HIBERNATE);
  
 -      if (drv && drv->pm && drv->pm->poweroff_noirq) {
 +      if (!drv || !drv->pm)
 +              return 0;
 +
 +      if (drv->pm->poweroff_noirq) {
 +              int error;
 +
                error = drv->pm->poweroff_noirq(dev);
                suspend_report_result(drv->pm->poweroff_noirq, error);
 +              if (error)
 +                      return error;
        }
  
 -      return error;
 +      if (!pci_dev->state_saved && !pci_is_bridge(pci_dev))
 +              pci_prepare_to_sleep(pci_dev);
 +
 +      return 0;
  }
  
  static int pci_pm_restore_noirq(struct device *dev)
diff --combined kernel/sched.c
index 196d48babbef87c088214e4f252b4397d2bf25be,0ad7c28b7236e1f9e9ea4226849fb9a94863bf76..eb91695976e7b2a10102e2b8a7da6d3c3014d1cc
@@@ -3818,19 -3818,23 +3818,23 @@@ find_busiest_queue(struct sched_group *
   */
  #define MAX_PINNED_INTERVAL   512
  
+ /* Working cpumask for load_balance and load_balance_newidle. */
+ static DEFINE_PER_CPU(cpumask_var_t, load_balance_tmpmask);
  /*
   * Check this_cpu to ensure it is balanced within domain. Attempt to move
   * tasks if there is an imbalance.
   */
  static int load_balance(int this_cpu, struct rq *this_rq,
                        struct sched_domain *sd, enum cpu_idle_type idle,
-                       int *balance, struct cpumask *cpus)
+                       int *balance)
  {
        int ld_moved, all_pinned = 0, active_balance = 0, sd_idle = 0;
        struct sched_group *group;
        unsigned long imbalance;
        struct rq *busiest;
        unsigned long flags;
+       struct cpumask *cpus = __get_cpu_var(load_balance_tmpmask);
  
        cpumask_setall(cpus);
  
@@@ -3985,8 -3989,7 +3989,7 @@@ out
   * this_rq is locked.
   */
  static int
- load_balance_newidle(int this_cpu, struct rq *this_rq, struct sched_domain *sd,
-                       struct cpumask *cpus)
+ load_balance_newidle(int this_cpu, struct rq *this_rq, struct sched_domain *sd)
  {
        struct sched_group *group;
        struct rq *busiest = NULL;
        int ld_moved = 0;
        int sd_idle = 0;
        int all_pinned = 0;
+       struct cpumask *cpus = __get_cpu_var(load_balance_tmpmask);
  
        cpumask_setall(cpus);
  
@@@ -4134,10 -4138,6 +4138,6 @@@ static void idle_balance(int this_cpu, 
        struct sched_domain *sd;
        int pulled_task = 0;
        unsigned long next_balance = jiffies + HZ;
-       cpumask_var_t tmpmask;
-       if (!alloc_cpumask_var(&tmpmask, GFP_ATOMIC))
-               return;
  
        for_each_domain(this_cpu, sd) {
                unsigned long interval;
                if (sd->flags & SD_BALANCE_NEWIDLE)
                        /* If we've pulled tasks over stop searching: */
                        pulled_task = load_balance_newidle(this_cpu, this_rq,
-                                                          sd, tmpmask);
+                                                          sd);
  
                interval = msecs_to_jiffies(sd->balance_interval);
                if (time_after(next_balance, sd->last_balance + interval))
                 */
                this_rq->next_balance = next_balance;
        }
-       free_cpumask_var(tmpmask);
  }
  
  /*
@@@ -4313,11 -4312,6 +4312,6 @@@ static void rebalance_domains(int cpu, 
        unsigned long next_balance = jiffies + 60*HZ;
        int update_next_balance = 0;
        int need_serialize;
-       cpumask_var_t tmp;
-       /* Fails alloc?  Rebalancing probably not a priority right now. */
-       if (!alloc_cpumask_var(&tmp, GFP_ATOMIC))
-               return;
  
        for_each_domain(cpu, sd) {
                if (!(sd->flags & SD_LOAD_BALANCE))
                }
  
                if (time_after_eq(jiffies, sd->last_balance + interval)) {
-                       if (load_balance(cpu, rq, sd, idle, &balance, tmp)) {
+                       if (load_balance(cpu, rq, sd, idle, &balance)) {
                                /*
                                 * We've pulled tasks over so either we're no
                                 * longer idle, or one of our SMT siblings is
@@@ -4376,8 -4370,6 +4370,6 @@@ out
         */
        if (likely(update_next_balance))
                rq->next_balance = next_balance;
-       free_cpumask_var(tmp);
  }
  
  /*
@@@ -4942,13 -4934,15 +4934,13 @@@ pick_next_task(struct rq *rq
  /*
   * schedule() is the main scheduler function.
   */
 -asmlinkage void __sched schedule(void)
 +asmlinkage void __sched __schedule(void)
  {
        struct task_struct *prev, *next;
        unsigned long *switch_count;
        struct rq *rq;
        int cpu;
  
 -need_resched:
 -      preempt_disable();
        cpu = smp_processor_id();
        rq = cpu_rq(cpu);
        rcu_qsctr_inc(cpu);
@@@ -5005,80 -4999,13 +4997,80 @@@ need_resched_nonpreemptible
  
        if (unlikely(reacquire_kernel_lock(current) < 0))
                goto need_resched_nonpreemptible;
 +}
  
 +asmlinkage void __sched schedule(void)
 +{
 +need_resched:
 +      preempt_disable();
 +      __schedule();
        preempt_enable_no_resched();
        if (unlikely(test_thread_flag(TIF_NEED_RESCHED)))
                goto need_resched;
  }
  EXPORT_SYMBOL(schedule);
  
 +#ifdef CONFIG_SMP
 +/*
 + * Look out! "owner" is an entirely speculative pointer
 + * access and not reliable.
 + */
 +int mutex_spin_on_owner(struct mutex *lock, struct thread_info *owner)
 +{
 +      unsigned int cpu;
 +      struct rq *rq;
 +
 +      if (!sched_feat(OWNER_SPIN))
 +              return 0;
 +
 +#ifdef CONFIG_DEBUG_PAGEALLOC
 +      /*
 +       * Need to access the cpu field knowing that
 +       * DEBUG_PAGEALLOC could have unmapped it if
 +       * the mutex owner just released it and exited.
 +       */
 +      if (probe_kernel_address(&owner->cpu, cpu))
 +              goto out;
 +#else
 +      cpu = owner->cpu;
 +#endif
 +
 +      /*
 +       * Even if the access succeeded (likely case),
 +       * the cpu field may no longer be valid.
 +       */
 +      if (cpu >= nr_cpumask_bits)
 +              goto out;
 +
 +      /*
 +       * We need to validate that we can do a
 +       * get_cpu() and that we have the percpu area.
 +       */
 +      if (!cpu_online(cpu))
 +              goto out;
 +
 +      rq = cpu_rq(cpu);
 +
 +      for (;;) {
 +              /*
 +               * Owner changed, break to re-assess state.
 +               */
 +              if (lock->owner != owner)
 +                      break;
 +
 +              /*
 +               * Is that owner really running on that cpu?
 +               */
 +              if (task_thread_info(rq->curr) != owner || need_resched())
 +                      return 0;
 +
 +              cpu_relax();
 +      }
 +out:
 +      return 1;
 +}
 +#endif
 +
  #ifdef CONFIG_PREEMPT
  /*
   * this is the entry point to schedule() from in-kernel preemption
@@@ -7713,7 -7640,7 +7705,7 @@@ cpu_to_core_group(int cpu, const struc
  {
        int group;
  
-       cpumask_and(mask, &per_cpu(cpu_sibling_map, cpu), cpu_map);
+       cpumask_and(mask, topology_thread_cpumask(cpu), cpu_map);
        group = cpumask_first(mask);
        if (sg)
                *sg = &per_cpu(sched_group_core, group).sg;
@@@ -7742,7 -7669,7 +7734,7 @@@ cpu_to_phys_group(int cpu, const struc
        cpumask_and(mask, cpu_coregroup_mask(cpu), cpu_map);
        group = cpumask_first(mask);
  #elif defined(CONFIG_SCHED_SMT)
-       cpumask_and(mask, &per_cpu(cpu_sibling_map, cpu), cpu_map);
+       cpumask_and(mask, topology_thread_cpumask(cpu), cpu_map);
        group = cpumask_first(mask);
  #else
        group = cpu;
@@@ -8085,7 -8012,7 +8077,7 @@@ static int __build_sched_domains(const 
                SD_INIT(sd, SIBLING);
                set_domain_attribute(sd, attr);
                cpumask_and(sched_domain_span(sd),
-                           &per_cpu(cpu_sibling_map, i), cpu_map);
+                           topology_thread_cpumask(i), cpu_map);
                sd->parent = p;
                p->child = sd;
                cpu_to_cpu_group(i, cpu_map, &sd->groups, tmpmask);
        /* Set up CPU (sibling) groups */
        for_each_cpu(i, cpu_map) {
                cpumask_and(this_sibling_map,
-                           &per_cpu(cpu_sibling_map, i), cpu_map);
+                           topology_thread_cpumask(i), cpu_map);
                if (i != cpumask_first(this_sibling_map))
                        continue;
  
@@@ -8771,6 -8698,9 +8763,9 @@@ void __init sched_init(void
  #endif
  #ifdef CONFIG_USER_SCHED
        alloc_size *= 2;
+ #endif
+ #ifdef CONFIG_CPUMASK_OFFSTACK
+       alloc_size += num_possible_cpus() * cpumask_size();
  #endif
        /*
         * As sched_init() is called before page_alloc is setup,
                ptr += nr_cpu_ids * sizeof(void **);
  #endif /* CONFIG_USER_SCHED */
  #endif /* CONFIG_RT_GROUP_SCHED */
+ #ifdef CONFIG_CPUMASK_OFFSTACK
+               for_each_possible_cpu(i) {
+                       per_cpu(load_balance_tmpmask, i) = (void *)ptr;
+                       ptr += cpumask_size();
+               }
+ #endif /* CONFIG_CPUMASK_OFFSTACK */
        }
  
  #ifdef CONFIG_SMP
diff --combined mm/page_alloc.c
index a3803ea8c27d5aaaccb5bd2d1f8141786dc9cc27,a92b0975b9a5f49c7f1c235f0064921f18c43913..f87e0d8df5a7f517a06fff972674bd1039da61d5
@@@ -1479,8 -1479,6 +1479,8 @@@ __alloc_pages_internal(gfp_t gfp_mask, 
        unsigned long did_some_progress;
        unsigned long pages_reclaimed = 0;
  
 +      lockdep_trace_alloc(gfp_mask);
 +
        might_sleep_if(wait);
  
        if (should_fail_alloc_page(gfp_mask, order))
@@@ -1580,15 -1578,12 +1580,15 @@@ nofail_alloc
         */
        cpuset_update_task_memory_state();
        p->flags |= PF_MEMALLOC;
 +
 +      lockdep_set_current_reclaim_state(gfp_mask);
        reclaim_state.reclaimed_slab = 0;
        p->reclaim_state = &reclaim_state;
  
        did_some_progress = try_to_free_pages(zonelist, order, gfp_mask);
  
        p->reclaim_state = NULL;
 +      lockdep_clear_current_reclaim_state();
        p->flags &= ~PF_MEMALLOC;
  
        cond_resched();
@@@ -2139,7 -2134,7 +2139,7 @@@ static int find_next_best_node(int node
        int n, val;
        int min_val = INT_MAX;
        int best_node = -1;
-       node_to_cpumask_ptr(tmp, 0);
+       const struct cpumask *tmp = cpumask_of_node(0);
  
        /* Use the local node if we haven't already */
        if (!node_isset(node, *used_node_mask)) {
                val += (n < node);
  
                /* Give preference to headless and unused nodes */
-               node_to_cpumask_ptr_next(tmp, n);
-               if (!cpus_empty(*tmp))
+               tmp = cpumask_of_node(n);
+               if (!cpumask_empty(tmp))
                        val += PENALTY_FOR_NODE_WITH_CPUS;
  
                /* Slight preference for less loaded node */
diff --combined mm/slab.c
index 825c606f691d11bfb3372627aff50f115358aff3,2daaca0b4541e5dfc214f36f647686657e021ed7..59839d7ee5b3cd2e98122bc4203623fd55c1158f
+++ b/mm/slab.c
@@@ -1160,7 -1160,7 +1160,7 @@@ static void __cpuinit cpuup_canceled(lo
        struct kmem_cache *cachep;
        struct kmem_list3 *l3 = NULL;
        int node = cpu_to_node(cpu);
-       node_to_cpumask_ptr(mask, node);
+       const struct cpumask *mask = cpumask_of_node(node);
  
        list_for_each_entry(cachep, &cache_chain, next) {
                struct array_cache *nc;
@@@ -3318,8 -3318,6 +3318,8 @@@ __cache_alloc_node(struct kmem_cache *c
        unsigned long save_flags;
        void *ptr;
  
 +      lockdep_trace_alloc(flags);
 +
        if (slab_should_failslab(cachep, flags))
                return NULL;
  
@@@ -3396,8 -3394,6 +3396,8 @@@ __cache_alloc(struct kmem_cache *cachep
        unsigned long save_flags;
        void *objp;
  
 +      lockdep_trace_alloc(flags);
 +
        if (slab_should_failslab(cachep, flags))
                return NULL;
  
diff --combined mm/vmscan.c
index 479e46719394cceccad44d55c28db3e2942616e7,1cdbf0b057278e8f157da93bb6eda0dc80644387..f74a61e522f43657bfa17aaf3219ca2dcb0c18a7
@@@ -1963,10 -1963,8 +1963,10 @@@ static int kswapd(void *p
        struct reclaim_state reclaim_state = {
                .reclaimed_slab = 0,
        };
-       node_to_cpumask_ptr(cpumask, pgdat->node_id);
+       const struct cpumask *cpumask = cpumask_of_node(pgdat->node_id);
  
 +      lockdep_set_current_reclaim_state(GFP_KERNEL);
 +
        if (!cpumask_empty(cpumask))
                set_cpus_allowed_ptr(tsk, cpumask);
        current->reclaim_state = &reclaim_state;
@@@ -2200,7 -2198,9 +2200,9 @@@ static int __devinit cpu_callback(struc
        if (action == CPU_ONLINE || action == CPU_ONLINE_FROZEN) {
                for_each_node_state(nid, N_HIGH_MEMORY) {
                        pg_data_t *pgdat = NODE_DATA(nid);
-                       node_to_cpumask_ptr(mask, pgdat->node_id);
+                       const struct cpumask *mask;
+                       mask = cpumask_of_node(pgdat->node_id);
  
                        if (cpumask_any_and(cpu_online_mask, mask) < nr_cpu_ids)
                                /* One of our CPUs online: restore mask */
diff --combined net/sunrpc/svc.c
index bb507e2bb94d6fa4657508f29df558a54208928b,3bdd5bffaca89138ada174e521bac2facbb47da1..7dc0524bb727f3d1b6076ef03f273a79d52e4554
@@@ -312,13 -312,12 +312,12 @@@ svc_pool_map_set_cpumask(struct task_st
        switch (m->mode) {
        case SVC_POOL_PERCPU:
        {
 -              set_cpus_allowed_ptr(task, &cpumask_of_cpu(node));
 +              set_cpus_allowed_ptr(task, cpumask_of(node));
                break;
        }
        case SVC_POOL_PERNODE:
        {
-               node_to_cpumask_ptr(nodecpumask, node);
-               set_cpus_allowed_ptr(task, nodecpumask);
+               set_cpus_allowed_ptr(task, cpumask_of_node(node));
                break;
        }
        }