--- initial
+++ final
@@ -1,82 +1,82 @@
 int __init pcpu_embed_first_chunk(size_t reserved_size, size_t dyn_size, size_t atom_size, pcpu_fc_cpu_distance_fn_t cpu_distance_fn, pcpu_fc_alloc_fn_t alloc_fn, pcpu_fc_free_fn_t free_fn) {
   void *base = (void *)ULONG_MAX;
   void **areas = NULL;
   struct pcpu_alloc_info *ai;
   size_t size_sum, areas_size;
   unsigned long max_distance;
   int group, i, highest_group, rc;
   ai = pcpu_build_alloc_info(reserved_size, dyn_size, atom_size, cpu_distance_fn);
   if (IS_ERR(ai)) return PTR_ERR(ai);
   size_sum = ai->static_size + ai->reserved_size + ai->dyn_size;
   areas_size = PFN_ALIGN(ai->nr_groups * sizeof(void *));
-  areas = memblock_alloc_nopanic(areas_size, 0);
+  areas = memblock_alloc_nopanic(areas_size, SMP_CACHE_BYTES);
   if (!areas) {
     rc = -ENOMEM;
     goto out_free;
   }
   /* allocate, copy and determine base address & max_distance */
   highest_group = 0;
   for (group = 0; group < ai->nr_groups; group++) {
     struct pcpu_group_info *gi = &ai->groups[group];
     unsigned int cpu = NR_CPUS;
     void *ptr;
     for (i = 0; i < gi->nr_units && cpu == NR_CPUS; i++)
       cpu = gi->cpu_map[i];
     BUG_ON(cpu == NR_CPUS);
     /* allocate space for the whole group */
     ptr = alloc_fn(cpu, gi->nr_units * ai->unit_size, atom_size);
     if (!ptr) {
       rc = -ENOMEM;
       goto out_free_areas;
     }
     /* kmemleak tracks the percpu allocations separately */
     kmemleak_free(ptr);
     areas[group] = ptr;
     base = min(ptr, base);
     if (ptr > areas[highest_group]) highest_group = group;
   }
   max_distance = areas[highest_group] - base;
   max_distance += ai->unit_size * ai->groups[highest_group].nr_units;
   /* warn if maximum distance is further than 75% of vmalloc space */
   if (max_distance > VMALLOC_TOTAL * 3 / 4) {
     pr_warn("max_distance=0x%lx too large for vmalloc space 0x%lx\n", max_distance, VMALLOC_TOTAL);
 #ifdef CONFIG_NEED_PER_CPU_PAGE_FIRST_CHUNK
     /* and fail if we have fallback */
     rc = -EINVAL;
     goto out_free_areas;
 #endif
   }
   /*
    * Copy data and free unused parts.  This should happen after all
    * allocations are complete; otherwise, we may end up with
    * overlapping groups.
    */
   for (group = 0; group < ai->nr_groups; group++) {
     struct pcpu_group_info *gi = &ai->groups[group];
     void *ptr = areas[group];
     for (i = 0; i < gi->nr_units; i++, ptr += ai->unit_size) {
       if (gi->cpu_map[i] == NR_CPUS) {
         /* unused unit, free whole */
         free_fn(ptr, ai->unit_size);
         continue;
       }
       /* copy and return the unused part */
       memcpy(ptr, __per_cpu_load, ai->static_size);
       free_fn(ptr + size_sum, ai->unit_size - size_sum);
     }
   }
   /* base address is now known, determine group base offsets */
   for (group = 0; group < ai->nr_groups; group++) {
     ai->groups[group].base_offset = areas[group] - base;
   }
   pr_info("Embedded %zu pages/cpu @%p s%zu r%zu d%zu u%zu\n", PFN_DOWN(size_sum), base, ai->static_size, ai->reserved_size, ai->dyn_size, ai->unit_size);
   rc = pcpu_setup_first_chunk(ai, base);
   goto out_free;
 out_free_areas:
   for (group = 0; group < ai->nr_groups; group++)
     if (areas[group]) free_fn(areas[group], ai->groups[group].nr_units * ai->unit_size);
 out_free:
   pcpu_free_alloc_info(ai);
   if (areas) memblock_free_early(__pa(areas), areas_size);
   return rc;
 }<sep>@@
expression size, min_addr, max_addr, nid;
@@
(
- memblock_alloc_try_nid_raw(size, 0, min_addr, max_addr, nid)
+ memblock_alloc_try_nid_raw(size, SMP_CACHE_BYTES, min_addr, max_addr,nid)
|
- memblock_alloc_try_nid_nopanic(size, 0, min_addr, max_addr, nid)
+ memblock_alloc_try_nid_nopanic(size, SMP_CACHE_BYTES, min_addr, max_addr,nid)
|
- memblock_alloc_try_nid(size, 0, min_addr, max_addr, nid)
+ memblock_alloc_try_nid(size, SMP_CACHE_BYTES, min_addr, max_addr, nid)
|
- memblock_alloc(size, 0)
+ memblock_alloc(size, SMP_CACHE_BYTES)
|
- memblock_alloc_raw(size, 0)
+ memblock_alloc_raw(size, SMP_CACHE_BYTES)
|
- memblock_alloc_from(size, 0, min_addr)
+ memblock_alloc_from(size, SMP_CACHE_BYTES, min_addr)
|
- memblock_alloc_nopanic(size, 0)
+ memblock_alloc_nopanic(size, SMP_CACHE_BYTES)
|
- memblock_alloc_low(size, 0)
+ memblock_alloc_low(size, SMP_CACHE_BYTES)
|
- memblock_alloc_low_nopanic(size, 0)
+ memblock_alloc_low_nopanic(size, SMP_CACHE_BYTES)
|
- memblock_alloc_from_nopanic(size, 0, min_addr)
+ memblock_alloc_from_nopanic(size, SMP_CACHE_BYTES, min_addr)
|
- memblock_alloc_node(size, 0, nid)
+ memblock_alloc_node(size, SMP_CACHE_BYTES, nid)
)