• Taku Izumi's avatar
    mm/page_alloc.c: calculate zone_start_pfn at zone_spanned_pages_in_node() · d91749c1
    Taku Izumi authored
    Xeon E7 v3 based systems supports Address Range Mirroring and UEFI BIOS
    complied with UEFI spec 2.5 can notify which ranges are mirrored
    (reliable) via EFI memory map.  Now Linux kernel utilize its information
    and allocates boot time memory from reliable region.
    
    My requirement is:
      - allocate kernel memory from mirrored region
      - allocate user memory from non-mirrored region
    
    In order to meet my requirement, ZONE_MOVABLE is useful.  By arranging
    non-mirrored range into ZONE_MOVABLE, mirrored memory is used for kernel
    allocations.
    
    My idea is to extend existing "kernelcore" option and introduces
    kernelcore=mirror option.  By specifying "mirror" instead of specifying
    the amount of memory, non-mirrored region will be arranged into
    ZONE_MOVABLE.
    
    Earlier discussions are at:
     https://lkml.org/lkml/2015/10/9/24
     https://lkml.org/lkml/2015/10/15/9
     https://lkml.org/lkml/2015/11/27/18
     https://lkml.org/lkml/2015/12/8/836
    
    For example, suppose 2-nodes system with the following memory range:
    
      node 0 [mem 0x0000000000001000-0x000000109fffffff]
      node 1 [mem 0x00000010a0000000-0x000000209fffffff]
    and the following ranges are marked as reliable (mirrored):
      [0x0000000000000000-0x0000000100000000]
      [0x0000000100000000-0x0000000180000000]
      [0x0000000800000000-0x0000000880000000]
      [0x00000010a0000000-0x0000001120000000]
      [0x00000017a0000000-0x0000001820000000]
    
    If you specify kernelcore=mirror, ZONE_NORMAL and ZONE_MOVABLE are
    arranged like bellow:
    
     - node 0:
      ZONE_NORMAL : [0x0000000100000000-0x00000010a0000000]
      ZONE_MOVABLE: [0x0000000180000000-0x00000010a0000000]
     - node 1:
      ZONE_NORMAL : [0x00000010a0000000-0x00000020a0000000]
      ZONE_MOVABLE: [0x0000001120000000-0x00000020a0000000]
    
    In overlapped range, pages to be ZONE_MOVABLE in ZONE_NORMAL are treated
    as absent pages, and vice versa.
    
    This patch (of 2):
    
    Currently each zone's zone_start_pfn is calculated at
    free_area_init_core().  However zone's range is fixed at the time when
    invoking zone_spanned_pages_in_node().
    
    This patch changes how each zone->zone_start_pfn is calculated in
    zone_spanned_pages_in_node().
    Signed-off-by: default avatarTaku Izumi <izumi.taku@jp.fujitsu.com>
    Cc: Tony Luck <tony.luck@intel.com>
    Cc: Xishi Qiu <qiuxishi@huawei.com>
    Cc: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
    Cc: Mel Gorman <mel@csn.ul.ie>
    Cc: Dave Hansen <dave.hansen@intel.com>
    Cc: Matt Fleming <matt@codeblueprint.co.uk>
    Cc: Arnd Bergmann <arnd@arndb.de>
    Cc: Steve Capper <steve.capper@linaro.org>
    Cc: Sudeep Holla <sudeep.holla@arm.com>
    Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
    Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
    d91749c1
page_alloc.c 190 KB