28 Apr, 2008

1 commit

  • Having separate page flags for the head and the tail of a compound page allows
    the compiler to use bitops instead of operations on a word to check for a tail
    page. That is f.e. important for virt_to_head_page() which is used in
    various critical code paths (kfree for example):

    Code for PageTail(page)

    Before:

    mov (%rdi),%rdx page->flags
    mov %rdx,%rax 3 bytes
    and $0x12000,%eax 5 bytes
    cmp $0x12000,%rax 6 bytes
    je 897

    After:

    mov (%rdi),%rax
    test $0x40,%ah (3 bytes)
    jne 887

    So we go from 14 bytes to 3 bytes and from 3 instructions to one. From the
    use of 2 registers we go to none.

    We can only use page flags for this if we have page flags available. This
    patch introduces CONFIG_PAGEFLAGS_EXTENDED that is set if pageflags are not
    scarce due to SPARSEMEM using page flags for its sectionid on 32 bit NUMA
    platforms.

    Additional page flag definitions can be added to the CONFIG_PAGEFLAGS_EXTENDED
    section in page-flags.h if the functionality depends on PAGEFLAGS_EXTENDED or
    if more page flag overlapping tricks are used for the !PAGEFLAGS_EXTENDED
    fallback (the upcoming virtual compound patch may hook in here and Rik's/Lee's
    additional page flags to solve the reclaim issues could also be added there
    [hint... hint... where are these patchsets?]).

    Avoiding the overlaying of Pg_reclaim also clears the way for possible use of
    compound pages for the pagecache or on the LRU.

    Signed-off-by: Christoph Lameter
    Cc: Nick Piggin
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Christoph Lameter
     

28 Jan, 2008

1 commit


18 Dec, 2007

1 commit

  • SPARSEMEM_VMEMMAP needs to be a selectable config option to support
    building the kernel both with and without sparsemem vmemmap support. This
    selection is desirable for platforms which could be configured one way for
    platform specific builds and the other for multi-platform builds.

    Signed-off-by: Miguel Botón
    Signed-off-by: Geoff Levand
    Acked-by: Yasunori Goto
    Cc: Christoph Lameter
    Cc: Andy Whitcroft
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Geoff Levand
     

20 Oct, 2007

1 commit


18 Oct, 2007

1 commit

  • * 'xen-upstream' of git://git.kernel.org/pub/scm/linux/kernel/git/jeremy/xen:
    xfs: eagerly remove vmap mappings to avoid upsetting Xen
    xen: add some debug output for failed multicalls
    xen: fix incorrect vcpu_register_vcpu_info hypercall argument
    xen: ask the hypervisor how much space it needs reserved
    xen: lock pte pages while pinning/unpinning
    xen: deal with stale cr3 values when unpinning pagetables
    xen: add batch completion callbacks
    xen: yield to IPI target if necessary
    Clean up duplicate includes in arch/i386/xen/
    remove dead code in pgtable_cache_init
    paravirt: clean up lazy mode handling
    paravirt: refactor struct paravirt_ops into smaller pv_*_ops

    Linus Torvalds
     

17 Oct, 2007

3 commits

  • When a pagetable is created, it is made globally visible in the rmap
    prio tree before it is pinned via arch_dup_mmap(), and remains in the
    rmap tree while it is unpinned with arch_exit_mmap().

    This means that other CPUs may race with the pinning/unpinning
    process, and see a pte between when it gets marked RO and actually
    pinned, causing any pte updates to fail with write-protect faults.

    As a result, all pte pages must be properly locked, and only unlocked
    once the pinning/unpinning process has finished.

    In order to avoid taking spinlocks for the whole pagetable - which may
    overflow the PREEMPT_BITS portion of preempt counter - it locks and pins
    each pte page individually, and then finally pins the whole pagetable.

    Signed-off-by: Jeremy Fitzhardinge
    Cc: Rik van Riel
    Cc: Hugh Dickens
    Cc: David Rientjes
    Cc: Andrew Morton
    Cc: Andi Kleen
    Cc: Keir Fraser
    Cc: Jan Beulich

    Jeremy Fitzhardinge
     
  • Logic.
    - set all pages in [start,end) as isolated migration-type.
    by this, all free pages in the range will be not-for-use.
    - Migrate all LRU pages in the range.
    - Test all pages in the range's refcnt is zero or not.

    Todo:
    - allocate migration destination page from better area.
    - confirm page_count(page)== 0 && PageReserved(page) page is safe to be freed..
    (I don't like this kind of page but..
    - Find out pages which cannot be migrated.
    - more running tests.
    - Use reclaim for unplugging other memory type area.

    Signed-off-by: KAMEZAWA Hiroyuki
    Signed-off-by: Yasunori Goto
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    KAMEZAWA Hiroyuki
     
  • Convert the common vmemmap population into initialisation helpers for use by
    architecture vmemmap populators. All architecture implementing the
    SPARSEMEM_VMEMMAP variant supply an architecture specific vmemmap_populate()
    initialiser, which may make use of the helpers.

    This allows us to clean up and remove the initialisation Kconfig entries.
    With this patch there is a single SPARSEMEM_VMEMMAP_ENABLE Kconfig option to
    indicate use of that variant.

    Signed-off-by: Andy Whitcroft
    Acked-by: Christoph Lameter
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Andy Whitcroft
     

07 Oct, 2007

1 commit

  • When pinning and unpinning pagetables, we must protect them against
    being used by other CPUs, lest they see the pagetable in an
    intermediate read-only-but-not-pinned state.

    When using split pte locks, doing this properly would require taking
    all the pte locks for the pagetable while pinning, but this may overflow
    the PREEMPT_BITS part of the preempt counter if the process has mapped
    more than about 512M of memory.

    However, failing to take the pte locks causes write-protect faults when
    the pageout code is trying to clear the Access bit on a pte which is part
    of a freshy created and still being pinned process after fork.

    This is a short-term fix until the problem is solved properly.

    Signed-off-by: Jeremy Fitzhardinge
    Acked-by: Rik van Riel
    Acked-by: Hugh Dickins
    Cc: David Rientjes
    Cc: Andrew Morton
    Cc: Andi Kleen
    Cc: Keir Fraser
    Cc: Jan Beulich
    Signed-off-by: Linus Torvalds

    Jeremy Fitzhardinge
     

30 Jul, 2007

1 commit


18 Jul, 2007

1 commit

  • The bounce buffer logic is included on systems that do not need it. If a
    system does not have zones like ZONE_DMA and ZONE_HIGHMEM that can lead to
    the use of bounce buffers then there is no need to reserve memory pools etc
    etc. This is true f.e. for SGI Altix.

    Also nicifies the Makefile and gets rid of the tricky "and" there.

    Signed-off-by: Christoph Lameter
    Acked-by: Jens Axboe
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Christoph Lameter
     

17 Jul, 2007

2 commits

  • * master.kernel.org:/pub/scm/linux/kernel/git/lethal/sh-2.6: (68 commits)
    sh: sh-rtc support for SH7709.
    sh: Revert __xdiv64_32 size change.
    sh: Update r7785rp defconfig.
    sh: Export div symbols for GCC 4.2 and ST GCC.
    sh: fix race in parallel out-of-tree build
    sh: Kill off dead mach.c for hp6xx.
    sh: hd64461.h cleanup and added comments.
    sh: Update the alignment when 4K stacks are used.
    sh: Add a .bss.page_aligned section for 4K stacks.
    sh: Don't let SH-4A clobber SH-4 CFLAGS.
    sh: Add parport stub for SuperIO ports.
    sh: Drop -Wa,-dsp for DSP tuning.
    sh: Update dreamcast defconfig.
    fb: pvr2fb: A few more __devinit annotations for PCI.
    fb: pvr2fb: Fix up section mismatch warnings.
    sh: Select IPR-IRQ for SH7091.
    sh: Correct __xdiv64_32/div64_32 return value size.
    sh: Fix timer-tmu build for SH-3.
    sh: Add cpu and mach links to CLEAN_FILES.
    sh: Preliminary support for the SH-X3 CPU.
    ...

    Linus Torvalds
     
  • Make some offending drivers depend on it and set CONFIG_ARCH_NO_VIRT_TO_BUS
    for ppc64 so that we don't build those drivers.

    This gets PowerPC allmodconfig and allyesconfig much closer to building.

    Signed-off-by: Stephen Rothwell
    Cc: Al Viro
    Acked-by: David Miller
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Stephen Rothwell
     

08 Jun, 2007

1 commit


14 May, 2007

1 commit


09 May, 2007

1 commit


08 May, 2007

1 commit

  • On x86_64 this cuts allocation overhead for page table pages down to a
    fraction (kernel compile / editing load. TSC based measurement of times spend
    in each function):

    no quicklist

    pte_alloc 1569048 4.3s(401ns/2.7us/179.7us)
    pmd_alloc 780988 2.1s(337ns/2.7us/86.1us)
    pud_alloc 780072 2.2s(424ns/2.8us/300.6us)
    pgd_alloc 260022 1s(920ns/4us/263.1us)

    quicklist:

    pte_alloc 452436 573.4ms(8ns/1.3us/121.1us)
    pmd_alloc 196204 174.5ms(7ns/889ns/46.1us)
    pud_alloc 195688 172.4ms(7ns/881ns/151.3us)
    pgd_alloc 65228 9.8ms(8ns/150ns/6.1us)

    pgd allocations are the most complex and there we see the most dramatic
    improvement (may be we can cut down the amount of pgds cached somewhat?). But
    even the pte allocations still see a doubling of performance.

    1. Proven code from the IA64 arch.

    The method used here has been fine tuned for years and
    is NUMA aware. It is based on the knowledge that accesses
    to page table pages are sparse in nature. Taking a page
    off the freelists instead of allocating a zeroed pages
    allows a reduction of number of cachelines touched
    in addition to getting rid of the slab overhead. So
    performance improves. This is particularly useful if pgds
    contain standard mappings. We can save on the teardown
    and setup of such a page if we have some on the quicklists.
    This includes avoiding lists operations that are otherwise
    necessary on alloc and free to track pgds.

    2. Light weight alternative to use slab to manage page size pages

    Slab overhead is significant and even page allocator use
    is pretty heavy weight. The use of a per cpu quicklist
    means that we touch only two cachelines for an allocation.
    There is no need to access the page_struct (unless arch code
    needs to fiddle around with it). So the fast past just
    means bringing in one cacheline at the beginning of the
    page. That same cacheline may then be used to store the
    page table entry. Or a second cacheline may be used
    if the page table entry is not in the first cacheline of
    the page. The current code will zero the page which means
    touching 32 cachelines (assuming 128 byte). We get down
    from 32 to 2 cachelines in the fast path.

    3. x86_64 gets lightweight page table page management.

    This will allow x86_64 arch code to faster repopulate pgds
    and other page table entries. The list operations for pgds
    are reduced in the same way as for i386 to the point where
    a pgd is allocated from the page allocator and when it is
    freed back to the page allocator. A pgd can pass through
    the quicklists without having to be reinitialized.

    64 Consolidation of code from multiple arches

    So far arches have their own implementation of quicklist
    management. This patch moves that feature into the core allowing
    an easier maintenance and consistent management of quicklists.

    Page table pages have the characteristics that they are typically zero or in a
    known state when they are freed. This is usually the exactly same state as
    needed after allocation. So it makes sense to build a list of freed page
    table pages and then consume the pages already in use first. Those pages have
    already been initialized correctly (thus no need to zero them) and are likely
    already cached in such a way that the MMU can use them most effectively. Page
    table pages are used in a sparse way so zeroing them on allocation is not too
    useful.

    Such an implementation already exits for ia64. Howver, that implementation
    did not support constructors and destructors as needed by i386 / x86_64. It
    also only supported a single quicklist. The implementation here has
    constructor and destructor support as well as the ability for an arch to
    specify how many quicklists are needed.

    Quicklists are defined by an arch defining CONFIG_QUICKLIST. If more than one
    quicklist is necessary then we can define NR_QUICK for additional lists. F.e.
    i386 needs two and thus has

    config NR_QUICK
    int
    default 2

    If an arch has requested quicklist support then pages can be allocated
    from the quicklist (or from the page allocator if the quicklist is
    empty) via:

    quicklist_alloc(, , )

    Page table pages can be freed using:

    quicklist_free(, , )

    Pages must have a definite state after allocation and before
    they are freed. If no constructor is specified then pages
    will be zeroed on allocation and must be zeroed before they are
    freed.

    If a constructor is used then the constructor will establish
    a definite page state. F.e. the i386 and x86_64 pgd constructors
    establish certain mappings.

    Constructors and destructors can also be used to track the pages.
    i386 and x86_64 use a list of pgds in order to be able to dynamically
    update standard mappings.

    Signed-off-by: Christoph Lameter
    Cc: "David S. Miller"
    Cc: Andi Kleen
    Cc: "Luck, Tony"
    Cc: William Lee Irwin III
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Christoph Lameter
     

12 Feb, 2007

3 commits

  • As Andi pointed out: CONFIG_GENERIC_ISA_DMA only disables the ISA DMA
    channel management. Other functionality may still expect GFP_DMA to
    provide memory below 16M. So we need to make sure that CONFIG_ZONE_DMA is
    set independent of CONFIG_GENERIC_ISA_DMA. Undo the modifications to
    mm/Kconfig where we made ZONE_DMA dependent on GENERIC_ISA_DMA and set
    theses explicitly in each arches Kconfig.

    Reviews must occur for each arch in order to determine if ZONE_DMA can be
    switched off. It can only be switched off if we know that all devices
    supported by a platform are capable of performing DMA transfers to all of
    memory (Some arches already support this: uml, avr32, sh sh64, parisc and
    IA64/Altix).

    In order to switch ZONE_DMA off conditionally, one would have to establish
    a scheme by which one can assure that no drivers are enabled that are only
    capable of doing I/O to a part of memory, or one needs to provide an
    alternate means of performing an allocation from a specific range of memory
    (like provided by alloc_pages_range()) and insure that all drivers use that
    call. In that case the arches alloc_dma_coherent() may need to be modified
    to call alloc_pages_range() instead of relying on GFP_DMA.

    Signed-off-by: Christoph Lameter
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Christoph Lameter
     
  • Make ZONE_DMA optional in core code.

    - ifdef all code for ZONE_DMA and related definitions following the example
    for ZONE_DMA32 and ZONE_HIGHMEM.

    - Without ZONE_DMA, ZONE_HIGHMEM and ZONE_DMA32 we get to a ZONES_SHIFT of
    0.

    - Modify the VM statistics to work correctly without a DMA zone.

    - Modify slab to not create DMA slabs if there is no ZONE_DMA.

    [akpm@osdl.org: cleanup]
    [jdike@addtoit.com: build fix]
    [apw@shadowen.org: Simplify calculation of the number of bits we need for ZONES_SHIFT]
    Signed-off-by: Christoph Lameter
    Cc: Andi Kleen
    Cc: "Luck, Tony"
    Cc: Kyle McMartin
    Cc: Matthew Wilcox
    Cc: James Bottomley
    Cc: Paul Mundt
    Signed-off-by: Andy Whitcroft
    Signed-off-by: Jeff Dike
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Christoph Lameter
     
  • This patch simply defines CONFIG_ZONE_DMA for all arches. We later do special
    things with CONFIG_ZONE_DMA after the VM and an arch are prepared to work
    without ZONE_DMA.

    CONFIG_ZONE_DMA can be defined in two ways depending on how an architecture
    handles ISA DMA.

    First if CONFIG_GENERIC_ISA_DMA is set by the arch then we know that the arch
    needs ZONE_DMA because ISA DMA devices are supported. We can catch this in
    mm/Kconfig and do not need to modify arch code.

    Second, arches may use ZONE_DMA in an unknown way. We set CONFIG_ZONE_DMA for
    all arches that do not set CONFIG_GENERIC_ISA_DMA in order to insure backwards
    compatibility. The arches may later undefine ZONE_DMA if their arch code has
    been verified to not depend on ZONE_DMA.

    Signed-off-by: Christoph Lameter
    Cc: Andi Kleen
    Cc: "Luck, Tony"
    Cc: Kyle McMartin
    Cc: Matthew Wilcox
    Cc: James Bottomley
    Cc: Paul Mundt
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Christoph Lameter
     

04 Oct, 2006

2 commits


01 Oct, 2006

1 commit

  • Create Kconfig namespace for MEMORY_HOTPLUG_RESERVE and MEMORY_HOTPLUG_SPARSE.
    This is needed to create a disticiton between the 2 paths. Selecting the
    high level opiton of MEMORY_HOTPLUG will get you MEMORY_HOTPLUG_SPARSE if you
    have sparsemem enabled or MEMORY_HOTPLUG_RESERVE if you are x86_64 with
    discontig and ACPI numa support.

    Signed-off-by: Keith Mannthey
    Cc: KAMEZAWA Hiroyuki
    Cc: Andi Kleen
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Keith Mannthey
     

30 Jun, 2006

2 commits

  • * master.kernel.org:/pub/scm/linux/kernel/git/gregkh/pci-2.6:
    [PATCH] i386: export memory more than 4G through /proc/iomem
    [PATCH] 64bit Resource: finally enable 64bit resource sizes
    [PATCH] 64bit Resource: convert a few remaining drivers to use resource_size_t where needed
    [PATCH] 64bit resource: change pnp core to use resource_size_t
    [PATCH] 64bit resource: change pci core and arch code to use resource_size_t
    [PATCH] 64bit resource: change resource core to use resource_size_t
    [PATCH] 64bit resource: introduce resource_size_t for the start and end of struct resource
    [PATCH] 64bit resource: fix up printks for resources in misc drivers
    [PATCH] 64bit resource: fix up printks for resources in arch and core code
    [PATCH] 64bit resource: fix up printks for resources in pcmcia drivers
    [PATCH] 64bit resource: fix up printks for resources in video drivers
    [PATCH] 64bit resource: fix up printks for resources in ide drivers
    [PATCH] 64bit resource: fix up printks for resources in mtd drivers
    [PATCH] 64bit resource: fix up printks for resources in pci core and hotplug drivers
    [PATCH] 64bit resource: fix up printks for resources in networks drivers
    [PATCH] 64bit resource: fix up printks for resources in sound drivers
    [PATCH] 64bit resource: C99 changes for struct resource declarations

    Fixed up trivial conflict in drivers/ide/pci/cmd64x.c (the printk that
    was changed by the 64-bit resources had been deleted in the meantime ;)

    Linus Torvalds
     
  • Memory hotplug code of i386 adds memory to only highmem. So, if
    CONFIG_HIGHMEM is not set, CONFIG_MEMORY_HOTPLUG shouldn't be set.
    Otherwise, it causes compile error.

    In addition, many architecture can't use memory hotplug feature yet. So, I
    introduce CONFIG_ARCH_ENABLE_MEMORY_HOTPLUG.

    Signed-off-by: Yasunori Goto
    Cc:
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Yasunori Goto
     

28 Jun, 2006

2 commits


23 Jun, 2006

1 commit

  • Use the migration entries for page migration

    This modifies the migration code to use the new migration entries. It now
    becomes possible to migrate anonymous pages without having to add a swap
    entry.

    We add a couple of new functions to replace migration entries with the proper
    ptes.

    We cannot take the tree_lock for migrating anonymous pages anymore. However,
    we know that we hold the only remaining reference to the page when the page
    count reaches 1.

    Signed-off-by: Christoph Lameter
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Christoph Lameter
     

26 Mar, 2006

1 commit


22 Mar, 2006

1 commit

  • Centralize the page migration functions in anticipation of additional
    tinkering. Creates a new file mm/migrate.c

    1. Extract buffer_migrate_page() from fs/buffer.c

    2. Extract central migration code from vmscan.c

    3. Extract some components from mempolicy.c

    4. Export pageout() and remove_from_swap() from vmscan.c

    5. Make it possible to configure NUMA systems without page migration
    and non-NUMA systems with page migration.

    I had to so some #ifdeffing in mempolicy.c that may need a cleanup.

    Signed-off-by: Christoph Lameter
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Christoph Lameter
     

09 Jan, 2006

1 commit


07 Jan, 2006

1 commit


24 Nov, 2005

1 commit

  • Closer attention to the arithmetic shows that neither ppc64 nor sparc really
    uses one page for multiple page tables: how on earth could they, while
    pte_alloc_one returns just a struct page pointer, with no offset?

    Well, arm26 manages it by returning a pte_t pointer cast to a struct page
    pointer, harumph, then compensating in its pmd_populate. But arm26 is never
    SMP, so it's not a problem for split ptlock either.

    And the PA-RISC situation has been recently improved: CONFIG_PA20 works
    without the 16-byte alignment which inflated its spinlock_t. But the current
    union of spinlock_t with private does make the 7xxx struct page significantly
    larger, even without debug, so disable its split ptlock.

    Signed-off-by: Hugh Dickins
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Hugh Dickins
     

07 Nov, 2005

1 commit


30 Oct, 2005

2 commits

  • This adds generic memory add/remove and supporting functions for memory
    hotplug into a new file as well as a memory hotplug kernel config option.

    Individual architecture patches will follow.

    For now, disable memory hotplug when swsusp is enabled. There's a lot of
    churn there right now. We'll fix it up properly once it calms down.

    Signed-off-by: Matt Tolentino
    Signed-off-by: Dave Hansen
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Dave Hansen
     
  • Christoph Lameter demonstrated very poor scalability on the SGI 512-way, with
    a many-threaded application which concurrently initializes different parts of
    a large anonymous area.

    This patch corrects that, by using a separate spinlock per page table page, to
    guard the page table entries in that page, instead of using the mm's single
    page_table_lock. (But even then, page_table_lock is still used to guard page
    table allocation, and anon_vma allocation.)

    In this implementation, the spinlock is tucked inside the struct page of the
    page table page: with a BUILD_BUG_ON in case it overflows - which it would in
    the case of 32-bit PA-RISC with spinlock debugging enabled.

    Splitting the lock is not quite for free: another cacheline access. Ideally,
    I suppose we would use split ptlock only for multi-threaded processes on
    multi-cpu machines; but deciding that dynamically would have its own costs.
    So for now enable it by config, at some number of cpus - since the Kconfig
    language doesn't support inequalities, let preprocessor compare that with
    NR_CPUS. But I don't think it's worth being user-configurable: for good
    testing of both split and unsplit configs, split now at 4 cpus, and perhaps
    change that to 8 later.

    There is a benefit even for singly threaded processes: kswapd can be attacking
    one part of the mm while another part is busy faulting.

    Signed-off-by: Hugh Dickins
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Hugh Dickins
     

18 Sep, 2005

1 commit


05 Sep, 2005

2 commits

  • With cleanups from Dave Hansen

    SPARSEMEM_EXTREME makes mem_section a one dimensional array of pointers to
    mem_sections. This two level layout scheme is able to achieve smaller
    memory requirements for SPARSEMEM with the tradeoff of an additional shift
    and load when fetching the memory section. The current SPARSEMEM
    implementation is a one dimensional array of mem_sections which is the
    default SPARSEMEM configuration. The patch attempts isolates the
    implementation details of the physical layout of the sparsemem section
    array.

    SPARSEMEM_EXTREME requires bootmem to be functioning at the time of
    memory_present() calls. This is not always feasible, so architectures
    which do not need it may allocate everything statically by using
    SPARSEMEM_STATIC.

    Signed-off-by: Andy Whitcroft
    Signed-off-by: Bob Picco
    Signed-off-by: Dave Hansen
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Bob Picco
     
  • A new option for SPARSEMEM is ARCH_SPARSEMEM_EXTREME. Architecture
    platforms with a very sparse physical address space would likely want to
    select this option. For those architecture platforms that don't select the
    option, the code generated is equivalent to SPARSEMEM currently in -mm.
    I'll be posting a patch on ia64 ml which uses this new SPARSEMEM feature.

    ARCH_SPARSEMEM_EXTREME makes mem_section a one dimensional array of
    pointers to mem_sections. This two level layout scheme is able to achieve
    smaller memory requirements for SPARSEMEM with the tradeoff of an
    additional shift and load when fetching the memory section. The current
    SPARSEMEM -mm implementation is a one dimensional array of mem_sections
    which is the default SPARSEMEM configuration. The patch attempts isolates
    the implementation details of the physical layout of the sparsemem section
    array.

    ARCH_SPARSEMEM_EXTREME depends on 64BIT and is by default boolean false.

    I've boot tested under aim load ia64 configured for ARCH_SPARSEMEM_EXTREME.
    I've also boot tested a 4 way Opteron machine with !ARCH_SPARSEMEM_EXTREME
    and tested with aim.

    Signed-off-by: Andy Whitcroft
    Signed-off-by: Bob Picco
    Signed-off-by: Dave Hansen
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Bob Picco
     

24 Jun, 2005

1 commit

  • Sparsemem abstracts the use of discontiguous mem_maps[]. This kind of
    mem_map[] is needed by discontiguous memory machines (like in the old
    CONFIG_DISCONTIGMEM case) as well as memory hotplug systems. Sparsemem
    replaces DISCONTIGMEM when enabled, and it is hoped that it can eventually
    become a complete replacement.

    A significant advantage over DISCONTIGMEM is that it's completely separated
    from CONFIG_NUMA. When producing this patch, it became apparent in that NUMA
    and DISCONTIG are often confused.

    Another advantage is that sparse doesn't require each NUMA node's ranges to be
    contiguous. It can handle overlapping ranges between nodes with no problems,
    where DISCONTIGMEM currently throws away that memory.

    Sparsemem uses an array to provide different pfn_to_page() translations for
    each SECTION_SIZE area of physical memory. This is what allows the mem_map[]
    to be chopped up.

    In order to do quick pfn_to_page() operations, the section number of the page
    is encoded in page->flags. Part of the sparsemem infrastructure enables
    sharing of these bits more dynamically (at compile-time) between the
    page_zone() and sparsemem operations. However, on 32-bit architectures, the
    number of bits is quite limited, and may require growing the size of the
    page->flags type in certain conditions. Several things might force this to
    occur: a decrease in the SECTION_SIZE (if you want to hotplug smaller areas of
    memory), an increase in the physical address space, or an increase in the
    number of used page->flags.

    One thing to note is that, once sparsemem is present, the NUMA node
    information no longer needs to be stored in the page->flags. It might provide
    speed increases on certain platforms and will be stored there if there is
    room. But, if out of room, an alternate (theoretically slower) mechanism is
    used.

    This patch introduces CONFIG_FLATMEM. It is used in almost all cases where
    there used to be an #ifndef DISCONTIG, because SPARSEMEM and DISCONTIGMEM
    often have to compile out the same areas of code.

    Signed-off-by: Andy Whitcroft
    Signed-off-by: Dave Hansen
    Signed-off-by: Martin Bligh
    Signed-off-by: Adrian Bunk
    Signed-off-by: Yasunori Goto
    Signed-off-by: Bob Picco
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Andy Whitcroft