Skip to content
  • Joonsoo Kim's avatar
    mm/slab: fix unaligned access on sparc64 · 85c9f4b0
    Joonsoo Kim authored
    Commit bf0dea23
    
     ("mm/slab: use percpu allocator for cpu cache")
    changed the allocation method for cpu cache array from slab allocator to
    percpu allocator.  Alignment should be provided for aligned memory in
    percpu allocator case, but, that commit mistakenly set this alignment to
    0.  So, percpu allocator returns unaligned memory address.  It doesn't
    cause any problem on x86 which permits unaligned access, but, it causes
    the problem on sparc64 which needs strong guarantee of alignment.
    
    Following bug report is reported from David Miller.
    
      I'm getting tons of the following on sparc64:
    
      [603965.383447] Kernel unaligned access at TPC[546b58] free_block+0x98/0x1a0
      [603965.396987] Kernel unaligned access at TPC[546b60] free_block+0xa0/0x1a0
      ...
      [603970.554394] log_unaligned: 333 callbacks suppressed
      ...
    
    This patch provides a proper alignment parameter when allocating cpu
    cache to fix this unaligned memory access problem on sparc64.
    
    Reported-by: default avatarDavid Miller <davem@davemloft.net>
    Tested-by: default avatarDavid Miller <davem@davemloft.net>
    Tested-by: default avatarMeelis Roos <mroos@linux.ee>
    Signed-off-by: default avatarJoonsoo Kim <iamjoonsoo.kim@lge.com>
    Cc: Christoph Lameter <cl@linux.com>
    Cc: Pekka Enberg <penberg@kernel.org>
    Cc: David Rientjes <rientjes@google.com>
    Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
    Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
    85c9f4b0