1. 13 Jul, 2011 6 commits
    • Tejun Heo's avatar
      memblock: Use round_up/down() instead of memblock_align_up/down() · 348968eb
      Tejun Heo authored
      Signed-off-by: default avatarTejun Heo <tj@kernel.org>
      Link: http://lkml.kernel.org/r/1310457490-3356-5-git-send-email-tj@kernel.org
      Cc: Yinghai Lu <yinghai@kernel.org>
      Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
      Signed-off-by: default avatarH. Peter Anvin <hpa@linux.intel.com>
      348968eb
    • Tejun Heo's avatar
      memblock: Use MEMBLOCK_ALLOC_ACCESSIBLE instead of ANYWHERE in memblock_alloc_try_nid() · 15fb0972
      Tejun Heo authored
      After node affine allocation fails, memblock_alloc_try_nid() calls
      memblock_alloc_base() with @max_addr set to MEMBLOCK_ALLOC_ANYWHERE.
      This is inconsistent with memblock_alloc() and what the function's
      sole user - sparc/mm/init_64 - expects, although it doesn't make any
      difference as sparc64 doesn't have highmem and ACCESSIBLE equals
      ANYWHERE.
      
      This patch makes memblock_alloc_try_nid() use ACCESSIBLE instead of
      ANYWHERE.  This isn't complete as node affine allocation doesn't
      consider memblock.current_limit.  It will be handled with future
      changes.
      
      This patch doesn't introduce any behavior difference.
      Signed-off-by: default avatarTejun Heo <tj@kernel.org>
      Link: http://lkml.kernel.org/r/1310457490-3356-4-git-send-email-tj@kernel.org
      Cc: Yinghai Lu <yinghai@kernel.org>
      Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
      Signed-off-by: default avatarH. Peter Anvin <hpa@linux.intel.com>
      15fb0972
    • Tejun Heo's avatar
      bootmem: Fix __free_pages_bootmem() to use @order properly · 53348f27
      Tejun Heo authored
      a226f6c8 (FRV: Clean up bootmem allocator's page freeing algorithm)
      separated out __free_pages_bootmem() from free_all_bootmem_core().
      __free_pages_bootmem() takes @order argument but it assumes @order is
      either 0 or ilog2(BITS_PER_LONG).  Note that all the current users
      match that assumption and this doesn't cause actual problems.
      
      Fix it by using 1 << order instead of BITS_PER_LONG.
      Signed-off-by: default avatarTejun Heo <tj@kernel.org>
      Link: http://lkml.kernel.org/r/1310457490-3356-3-git-send-email-tj@kernel.org
      Cc: David Howells <dhowells@redhat.com>
      Signed-off-by: default avatarH. Peter Anvin <hpa@linux.intel.com>
      53348f27
    • Tejun Heo's avatar
      x86: Fix memblock_x86_check_reserved_size() use in efi_reserve_boot_services() · bf61549a
      Tejun Heo authored
      The return value of memblock_x86_check_reserved_size() doesn't
      indicate whether there's an overlapping reservatoin or not.  It
      indicates whether the caller needs to iterate further to discover all
      reserved portions of the specified area.
      
      efi_reserve_boot_esrvices() wants to check whether the boot services
      area overlaps with other reservations but incorrectly used
      membloc_x86_check_reserved_size().  Use memblock_is_region_reserved()
      instead.
      Signed-off-by: default avatarTejun Heo <tj@kernel.org>
      Link: http://lkml.kernel.org/r/1310457490-3356-2-git-send-email-tj@kernel.org
      Cc: Yinghai Lu <yinghai@kernel.org>
      Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: "H. Peter Anvin" <hpa@zytor.com>
      Signed-off-by: default avatarH. Peter Anvin <hpa@linux.intel.com>
      bf61549a
    • Tejun Heo's avatar
      x86, numa: Implement pfn -> nid mapping granularity check · 1e01979c
      Tejun Heo authored
      SPARSEMEM w/o VMEMMAP and DISCONTIGMEM, both used only on 32bit, use
      sections array to map pfn to nid which is limited in granularity.  If
      NUMA nodes are laid out such that the mapping cannot be accurate, boot
      will fail triggering BUG_ON() in mminit_verify_page_links().
      
      On 32bit, it's 512MiB w/ PAE and SPARSEMEM.  This seems to have been
      granular enough until commit 2706a0bf (x86, NUMA: Enable
      CONFIG_AMD_NUMA on 32bit too).  Apparently, there is a machine which
      aligns NUMA nodes to 128MiB and has only AMD NUMA but not SRAT.  This
      led to the following BUG_ON().
      
       On node 0 totalpages: 2096615
         DMA zone: 32 pages used for memmap
         DMA zone: 0 pages reserved
         DMA zone: 3927 pages, LIFO batch:0
         Normal zone: 1740 pages used for memmap
         Normal zone: 220978 pages, LIFO batch:31
         HighMem zone: 16405 pages used for memmap
         HighMem zone: 1853533 pages, LIFO batch:31
       BUG: Int 6: CR2   (null)
            EDI   (null)  ESI 00000002  EBP 00000002  ESP c1543ecc
            EBX f2400000  EDX 00000006  ECX   (null)  EAX 00000001
            err   (null)  EIP c16209aa   CS 00000060  flg 00010002
       Stack: f2400000 00220000 f7200800 c1620613 00220000 01000000 04400000 00238000
                (null) f7200000 00000002 f7200b58 f7200800 c1620929 000375fe   (null)
              f7200b80 c16395f0 00200a02 f7200a80   (null) 000375fe 00000002   (null)
       Pid: 0, comm: swapper Not tainted 2.6.39-rc5-00181-g2706a0bf #17
       Call Trace:
        [<c136b1e5>] ? early_fault+0x2e/0x2e
        [<c16209aa>] ? mminit_verify_page_links+0x12/0x42
        [<c1620613>] ? memmap_init_zone+0xaf/0x10c
        [<c1620929>] ? free_area_init_node+0x2b9/0x2e3
        [<c1607e99>] ? free_area_init_nodes+0x3f2/0x451
        [<c1601d80>] ? paging_init+0x112/0x118
        [<c15f578d>] ? setup_arch+0x791/0x82f
        [<c15f43d9>] ? start_kernel+0x6a/0x257
      
      This patch implements node_map_pfn_alignment() which determines
      maximum internode alignment and update numa_register_memblks() to
      reject NUMA configuration if alignment exceeds the pfn -> nid mapping
      granularity of the memory model as determined by PAGES_PER_SECTION.
      
      This makes the problematic machine boot w/ flatmem by rejecting the
      NUMA config and provides protection against crazy NUMA configurations.
      Signed-off-by: default avatarTejun Heo <tj@kernel.org>
      Link: http://lkml.kernel.org/r/20110712074534.GB2872@htj.dyndns.org
      LKML-Reference: <20110628174613.GP478@escobedo.osrc.amd.com>
      Reported-and-Tested-by: default avatarHans Rosenfeld <hans.rosenfeld@amd.com>
      Cc: Conny Seidel <conny.seidel@amd.com>
      Signed-off-by: default avatarH. Peter Anvin <hpa@linux.intel.com>
      1e01979c
    • Tejun Heo's avatar
      x86, mm: s/PAGES_PER_ELEMENT/PAGES_PER_SECTION/ · d0ead157
      Tejun Heo authored
      DISCONTIGMEM on x86-32 implements pfn -> nid mapping similarly to
      SPARSEMEM; however, it calls each mapping unit ELEMENT instead of
      SECTION.  This patch renames it to SECTION so that PAGES_PER_SECTION
      is valid for both DISCONTIGMEM and SPARSEMEM.  This will be used by
      the next patch to implement mapping granularity check.
      
      This patch is trivial constant rename.
      Signed-off-by: default avatarTejun Heo <tj@kernel.org>
      Link: http://lkml.kernel.org/r/20110712074422.GA2872@htj.dyndns.org
      Cc: Hans Rosenfeld <hans.rosenfeld@amd.com>
      Signed-off-by: default avatarH. Peter Anvin <hpa@linux.intel.com>
      d0ead157
  2. 11 Jul, 2011 15 commits
  3. 10 Jul, 2011 9 commits
  4. 09 Jul, 2011 10 commits