--- initial
+++ final
@@ -1,74 +1,74 @@
 int __init pcpu_page_first_chunk(size_t reserved_size, pcpu_fc_alloc_fn_t alloc_fn, pcpu_fc_free_fn_t free_fn, pcpu_fc_populate_pte_fn_t populate_pte_fn) {
   static struct vm_struct vm;
   struct pcpu_alloc_info *ai;
   char psize_str[16];
   int unit_pages;
   size_t pages_size;
   struct page **pages;
   int unit, i, j, rc;
   int upa;
   int nr_g0_units;
   snprintf(psize_str, sizeof(psize_str), "%luK", PAGE_SIZE >> 10);
   ai = pcpu_build_alloc_info(reserved_size, 0, PAGE_SIZE, NULL);
   if (IS_ERR(ai)) return PTR_ERR(ai);
   BUG_ON(ai->nr_groups != 1);
   upa = ai->alloc_size / ai->unit_size;
   nr_g0_units = roundup(num_possible_cpus(), upa);
   if (unlikely(WARN_ON(ai->groups[0].nr_units != nr_g0_units))) {
     pcpu_free_alloc_info(ai);
     return -EINVAL;
   }
   unit_pages = ai->unit_size >> PAGE_SHIFT;
   /* unaligned allocations can't be freed, round up to page size */
   pages_size = PFN_ALIGN(unit_pages * num_possible_cpus() * sizeof(pages[0]));
-  pages = memblock_alloc(pages_size, 0);
+  pages = memblock_alloc(pages_size, SMP_CACHE_BYTES);
   /* allocate pages */
   j = 0;
   for (unit = 0; unit < num_possible_cpus(); unit++) {
     unsigned int cpu = ai->groups[0].cpu_map[unit];
     for (i = 0; i < unit_pages; i++) {
       void *ptr;
       ptr = alloc_fn(cpu, PAGE_SIZE, PAGE_SIZE);
       if (!ptr) {
         pr_warn("failed to allocate %s page for cpu%u\n", psize_str, cpu);
         goto enomem;
       }
       /* kmemleak tracks the percpu allocations separately */
       kmemleak_free(ptr);
       pages[j++] = virt_to_page(ptr);
     }
   }
   /* allocate vm area, map the pages and copy static data */
   vm.flags = VM_ALLOC;
   vm.size = num_possible_cpus() * ai->unit_size;
   vm_area_register_early(&vm, PAGE_SIZE);
   for (unit = 0; unit < num_possible_cpus(); unit++) {
     unsigned long unit_addr = (unsigned long)vm.addr + unit * ai->unit_size;
     for (i = 0; i < unit_pages; i++)
       populate_pte_fn(unit_addr + (i << PAGE_SHIFT));
     /* pte already populated, the following shouldn't fail */
     rc = __pcpu_map_pages(unit_addr, &pages[unit * unit_pages], unit_pages);
     if (rc < 0) panic("failed to map percpu area, err=%d\n", rc);
     /*
      * FIXME: Archs with virtual cache should flush local
      * cache for the linear mapping here - something
      * equivalent to flush_cache_vmap() on the local cpu.
      * flush_cache_vmap() can't be used as most supporting
      * data structures are not set up yet.
      */
     /* copy static data */
     memcpy((void *)unit_addr, __per_cpu_load, ai->static_size);
   }
   /* we're ready, commit */
   pr_info("%d %s pages/cpu @%p s%zu r%zu d%zu\n", unit_pages, psize_str, vm.addr, ai->static_size, ai->reserved_size, ai->dyn_size);
   rc = pcpu_setup_first_chunk(ai, vm.addr);
   goto out_free_ar;
 enomem:
   while (--j >= 0)
     free_fn(page_address(pages[j]), PAGE_SIZE);
   rc = -ENOMEM;
 out_free_ar:
   memblock_free_early(__pa(pages), pages_size);
   pcpu_free_alloc_info(ai);
   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)
)