]> git.karo-electronics.de Git - karo-tx-linux.git/commit
mm: compaction: check lock contention first before taking lock
authorShaohua Li <shli@kernel.org>
Thu, 13 Sep 2012 01:01:00 +0000 (11:01 +1000)
committerStephen Rothwell <sfr@canb.auug.org.au>
Thu, 20 Sep 2012 07:05:10 +0000 (17:05 +1000)
commit776a791a8cc21140778bdfceac9db7546ca30bf3
tree4cb95c8979eec28eeffa3860281cf340168e46f9
parent6d5673c395d85fce56b9cc43f0dfb07ebce42f64
mm: compaction: check lock contention first before taking lock

isolate_migratepages_range will take zone->lru_lock first and check if the
lock is contented, if yes, it will release the lock.  This isn't
efficient.  If the lock is truly contented, a lock/unlock pair will
increase the lock contention.  We'd better check if the lock is contended
first.  compact_trylock_irqsave perfectly meets the requirement.

Signed-off-by: Shaohua Li <shli@fusionio.com>
Acked-by: Mel Gorman <mgorman@suse.de>
Acked-by: Minchan Kim <minchan@kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
mm/compaction.c