1. 01 May, 2010 5 commits
    • Tejun Heo's avatar
      percpu: implement kernel memory based chunk allocation · b0c9778b
      Tejun Heo authored
      Implement an alternate percpu chunk management based on kernel memeory
      for nommu SMP architectures.  Instead of mapping into vmalloc area,
      chunks are allocated as a contiguous kernel memory using
      alloc_pages().  As such, percpu allocator on nommu will have the
      following restrictions.
      
      * It can't fill chunks on-demand page-by-page.  It has to allocate
        each chunk fully upfront.
      
      * It can't support sparse chunk for NUMA configurations.  SMP w/o mmu
        is crazy enough.  Let's hope no one does NUMA w/o mmu.  :-P
      
      * If chunk size isn't power-of-two multiple of PAGE_SIZE, the
        unaligned amount will be wasted on each chunk.  So, archs which use
        this better align chunk size.
      
      For instructions on how to use this, read the comment on top of
      mm/percpu-km.c.
      Signed-off-by: default avatarTejun Heo <tj@kernel.org>
      Reviewed-by: default avatarDavid Howells <dhowells@redhat.com>
      Cc: Graff Yang <graff.yang@gmail.com>
      Cc: Sonic Zhang <sonic.adi@gmail.com>
      b0c9778b
    • Tejun Heo's avatar
      percpu: move vmalloc based chunk management into percpu-vm.c · 9f645532
      Tejun Heo authored
      Separate out and move chunk management (creation/desctruction and
      [de]population) code into percpu-vm.c which is included by percpu.c
      and compiled together.  The interface for chunk management is defined
      as follows.
      
       * pcpu_populate_chunk		- populate the specified range of a chunk
       * pcpu_depopulate_chunk	- depopulate the specified range of a chunk
       * pcpu_create_chunk		- create a new chunk
       * pcpu_destroy_chunk		- destroy a chunk, always preceded by full depop
       * pcpu_addr_to_page		- translate address to physical address
       * pcpu_verify_alloc_info	- check alloc_info is acceptable during init
      
      Other than wrapping vmalloc_to_page() inside pcpu_addr_to_page() and
      dummy pcpu_verify_alloc_info() implementation, this patch only moves
      code around.  This separation is to allow alternate chunk management
      implementation.
      Signed-off-by: default avatarTejun Heo <tj@kernel.org>
      Reviewed-by: default avatarDavid Howells <dhowells@redhat.com>
      Cc: Graff Yang <graff.yang@gmail.com>
      Cc: Sonic Zhang <sonic.adi@gmail.com>
      9f645532
    • Tejun Heo's avatar
      percpu: misc preparations for nommu support · 88999a89
      Tejun Heo authored
      Make the following misc preparations for percpu nommu support.
      
      * Remove refernces to vmalloc in common comments as nommu percpu won't
        use it.
      
      * Rename chunk->vms to chunk->data and make it void *.  Its use is
        determined by chunk management implementation.
      
      * Relocate utility functions and add __maybe_unused to functions which
        might not be used by different chunk management implementations.
      
      This patch doesn't cause any functional change.  This is to allow
      alternate chunk management implementation for percpu nommu support.
      Signed-off-by: default avatarTejun Heo <tj@kernel.org>
      Reviewed-by: default avatarDavid Howells <dhowells@redhat.com>
      Cc: Graff Yang <graff.yang@gmail.com>
      Cc: Sonic Zhang <sonic.adi@gmail.com>
      88999a89
    • Tejun Heo's avatar
      percpu: reorganize chunk creation and destruction · 6081089f
      Tejun Heo authored
      Reorganize alloc/free_pcpu_chunk() such that chunk struct alloc/free
      live in pcpu_alloc/free_chunk() and the rest in
      pcpu_create/destroy_chunk().  While at it, add missing error handling
      for chunk->map allocation failure.
      
      This is to allow alternate chunk management implementation for percpu
      nommu support.
      Signed-off-by: default avatarTejun Heo <tj@kernel.org>
      Reviewed-by: default avatarDavid Howells <dhowells@redhat.com>
      Cc: Graff Yang <graff.yang@gmail.com>
      Cc: Sonic Zhang <sonic.adi@gmail.com>
      6081089f
    • Tejun Heo's avatar
      percpu: factor out pcpu_addr_in_first/reserved_chunk() and update per_cpu_ptr_to_phys() · 020ec653
      Tejun Heo authored
      Factor out pcpu_addr_in_first/reserved_chunk() from
      pcpu_chunk_addr_search() and use it to update per_cpu_ptr_to_phys()
      such that it handles first chunk differently from the rest.
      
      This patch doesn't cause any functional change and is to prepare for
      percpu nommu support.
      Signed-off-by: default avatarTejun Heo <tj@kernel.org>
      Reviewed-by: default avatarDavid Howells <dhowells@redhat.com>
      Cc: Graff Yang <graff.yang@gmail.com>
      Cc: Sonic Zhang <sonic.adi@gmail.com>
      020ec653
  2. 30 Apr, 2010 35 commits