kernel_optimize_test/mm
Tim Chen 7e496299d4 tmpfs: make tmpfs scalable with percpu_counter for used blocks
The current implementation of tmpfs is not scalable.  We found that
stat_lock is contended by multiple threads when we need to get a new page,
leading to useless spinning inside this spin lock.

This patch makes use of the percpu_counter library to maintain local count
of used blocks to speed up getting and returning of pages.  So the
acquisition of stat_lock is unnecessary for getting and returning blocks,
improving the performance of tmpfs on system with large number of cpus.
On a 4 socket 32 core NHM-EX system, we saw improvement of 270%.

The implementation below has a slight chance of race between threads
causing a slight overshoot of the maximum configured blocks.  However, any
overshoot is small, and is bounded by the number of cpus.  This happens
when the number of used blocks is slightly below the maximum configured
blocks when a thread checks the used block count, and another thread
allocates the last block before the current thread does.  This should not
be a problem for tmpfs, as the overshoot is most likely to be a few blocks
and bounded.  If a strict limit is really desired, then configured the max
blocks to be the limit less the number of cpus in system.

Signed-off-by: Tim Chen <tim.c.chen@linux.intel.com>
Cc: Hugh Dickins <hughd@google.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2010-08-09 20:44:58 -07:00
..
backing-dev.c
bootmem.c
bounce.c
compaction.c
debug-pagealloc.c
dmapool.c
fadvise.c
failslab.c
filemap_xip.c
filemap.c gcc-4.6: mm: fix unused but set warnings 2010-08-09 20:44:58 -07:00
fremap.c
highmem.c
hugetlb.c hugetlb: call mmu notifiers on hugepage cow 2010-08-09 20:44:54 -07:00
hwpoison-inject.c
init-mm.c mm: provide init_mm mm_context initializer 2010-08-09 20:44:54 -07:00
internal.h
Kconfig
Kconfig.debug
kmemcheck.c
kmemleak-test.c
kmemleak.c
ksm.c mm: extend KSM refcounts to the anon_vma root 2010-08-09 20:44:55 -07:00
maccess.c
madvise.c
Makefile
memblock.c
memcontrol.c
memory_hotplug.c
memory-failure.c
memory.c gcc-4.6: mm: fix unused but set warnings 2010-08-09 20:44:58 -07:00
mempolicy.c mempolicy: reduce stack size of migrate_pages() 2010-08-09 20:44:58 -07:00
mempool.c
migrate.c mm: extend KSM refcounts to the anon_vma root 2010-08-09 20:44:55 -07:00
mincore.c
mlock.c
mm_init.c
mmap.c mm: always lock the root (oldest) anon_vma 2010-08-09 20:44:55 -07:00
mmu_context.c
mmu_notifier.c
mmzone.c
mprotect.c
mremap.c
msync.c
nommu.c
oom_kill.c oom: fold __out_of_memory into out_of_memory 2010-08-09 20:44:57 -07:00
page_alloc.c mm: rename try_set_zone_oom() to try_set_zonelist_oom() 2010-08-09 20:44:57 -07:00
page_cgroup.c
page_io.c
page_isolation.c
page-writeback.c
pagewalk.c
percpu_up.c
percpu-km.c
percpu-vm.c
percpu.c
prio_tree.c
quicklist.c
readahead.c
rmap.c mm: extend KSM refcounts to the anon_vma root 2010-08-09 20:44:55 -07:00
shmem.c tmpfs: make tmpfs scalable with percpu_counter for used blocks 2010-08-09 20:44:58 -07:00
slab.c gcc-4.6: mm: fix unused but set warnings 2010-08-09 20:44:58 -07:00
slob.c
slub.c
sparse-vmemmap.c
sparse.c
swap_state.c
swap.c
swapfile.c
thrash.c
truncate.c
util.c
vmalloc.c mm: use ERR_CAST 2010-08-09 20:44:54 -07:00
vmscan.c
vmstat.c mm: use for_each_online_cpu() in vmstat 2010-08-09 20:44:57 -07:00