• Jianguo Wu's avatar
    mm/ia64: fix a memory block size bug · 05cf9639
    Jianguo Wu authored
    I found following definition in include/linux/memory.h, in my IA64
    platform, SECTION_SIZE_BITS is equal to 32, and MIN_MEMORY_BLOCK_SIZE
    will be 0.
    
      #define MIN_MEMORY_BLOCK_SIZE     (1 << SECTION_SIZE_BITS)
    
    Because MIN_MEMORY_BLOCK_SIZE is int type and length of 32bits,
    so MIN_MEMORY_BLOCK_SIZE(1 << 32) will will equal to 0.
    Actually when SECTION_SIZE_BITS >= 31, MIN_MEMORY_BLOCK_SIZE will be wrong.
    This will cause wrong system memory infomation in sysfs.
    I think it should be:
    
      #define MIN_MEMORY_BLOCK_SIZE     (1UL << SECTION_SIZE_BITS)
    
    And "echo offline > memory0/state" will cause following call trace:
    
      kernel BUG at mm/memory_hotplug.c:885!
      sh[6455]: bugcheck! 0 [1]
      Pid: 6455, CPU 0, comm:                   sh
      psr : 0000101008526030 ifs : 8000000000000fa4 ip  : [<a0000001008c40f0>]    Not tainted (3.6.0-rc1)
      ip is at offline_pages+0x210/0xee0
      Call Trace:
        show_stack+0x80/0xa0
        show_regs+0x640/0x920
        die+0x190/0x2c0
        die_if_kernel+0x50/0x80
        ia64_bad_break+0x3d0/0x6e0
        ia64_native_leave_kernel+0x0/0x270
        offline_pages+0x210/0xee0
        alloc_pages_current+0x180/0x2a0
    Signed-off-by: default avatarJianguo Wu <wujianguo@huawei.com>
    Signed-off-by: default avatarJiang Liu <jiang.liu@huawei.com>
    Cc: "Luck, Tony" <tony.luck@intel.com>
    Reviewed-by: default avatarMichal Hocko <mhocko@suse.cz>
    Cc: <stable@vger.kernel.org>
    Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
    Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
    05cf9639
memory.h 4.54 KB