path: root/mm/percpu-vm.c
AgeCommit message (Collapse)AuthorFilesLines
2014-10-05percpu: perform tlb flush after pcpu_map_pages() failureTejun Heo1-0/+1
commit 849f5169097e1ba35b90ac9df76b5bb6f9c0aabd upstream. If pcpu_map_pages() fails midway, it unmaps the already mapped pages. Currently, it doesn't flush tlb after the partial unmapping. This may be okay in most cases as the established mapping hasn't been used at that point but it can go wrong and when it goes wrong it'd be extremely difficult to track down. Flush tlb after the partial unmapping. Signed-off-by: Tejun Heo <> Signed-off-by: Greg Kroah-Hartman <>
2014-10-05percpu: fix pcpu_alloc_pages() failure pathTejun Heo1-6/+15
commit f0d279654dea22b7a6ad34b9334aee80cda62cde upstream. When pcpu_alloc_pages() fails midway, pcpu_free_pages() is invoked to free what has already been allocated. The invocation is across the whole requested range and pcpu_free_pages() will try to free all non-NULL pages; unfortunately, this is incorrect as pcpu_get_pages_and_bitmap(), unlike what its comment suggests, doesn't clear the pages array and thus the array may have entries from the previous invocations making the partial failure path free incorrect pages. Fix it by open-coding the partial freeing of the already allocated pages. Signed-off-by: Tejun Heo <> Signed-off-by: Greg Kroah-Hartman <>
2012-06-20mm: fix kernel-doc warningsWanpeng Li1-1/+0
Fix kernel-doc warnings such as Warning(../mm/page_cgroup.c:432): No description found for parameter 'id' Warning(../mm/page_cgroup.c:432): Excess function parameter 'mem' description in 'swap_cgroup_record' Signed-off-by: Wanpeng Li <> Cc: Randy Dunlap <> Signed-off-by: Andrew Morton <> Signed-off-by: Linus Torvalds <>
2012-01-20percpu: use bitmap_clearAkinobu Mita1-2/+1
Use bitmap_clear rather than clearing individual bits in a memory region. Signed-off-by: Akinobu Mita <> Acked-by: Christoph Lameter <> Signed-off-by: Tejun Heo <>
2011-11-22percpu: fix chunk range calculationTejun Heo1-6/+6
Percpu allocator recorded the cpus which map to the first and last units in pcpu_first/last_unit_cpu respectively and used them to determine the address range of a chunk - e.g. it assumed that the first unit has the lowest address in a chunk while the last unit has the highest address. This simply isn't true. Groups in a chunk can have arbitrary positive or negative offsets from the previous one and there is no guarantee that the first unit occupies the lowest offset while the last one the highest. Fix it by actually comparing unit offsets to determine cpus occupying the lowest and highest offsets. Also, rename pcu_first/last_unit_cpu to pcpu_low/high_unit_cpu to avoid confusion. The chunk address range is used to flush cache on vmalloc area map/unmap and decide whether a given address is in the first chunk by per_cpu_ptr_to_phys() and the bug was discovered by invalid per_cpu_ptr_to_phys() translation for crash_note. Kudos to Dave Young for tracking down the problem. Signed-off-by: Tejun Heo <> Reported-by: WANG Cong <> Reported-by: Dave Young <> Tested-by: Dave Young <> LKML-Reference: <> Cc: stable
2011-11-22percpu: rename pcpu_mem_alloc to pcpu_mem_zallocBob Liu1-3/+2
Currently pcpu_mem_alloc() is implemented always return zeroed memory. So rename it to make user like pcpu_get_pages_and_bitmap() know don't reinit it. Signed-off-by: Bob Liu <> Reviewed-by: Pekka Enberg <> Reviewed-by: Michal Hocko <> Signed-off-by: Tejun Heo <>
2011-01-14mm: remove gfp mask from pcpu_get_vm_areasDavid Rientjes1-1/+1
pcpu_get_vm_areas() only uses GFP_KERNEL allocations, so remove the gfp_t formal and use the mask internally. Signed-off-by: David Rientjes <> Cc: Christoph Lameter <> Cc: Tejun Heo <> Signed-off-by: Andrew Morton <> Signed-off-by: Linus Torvalds <>
2010-05-01percpu: move vmalloc based chunk management into percpu-vm.cTejun Heo1-0/+451
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: Tejun Heo <> Reviewed-by: David Howells <> Cc: Graff Yang <> Cc: Sonic Zhang <>