]> git.karo-electronics.de Git - karo-tx-linux.git/commit
mm: compaction: check lock contention first before taking lock
authorShaohua Li <shli@kernel.org>
Fri, 21 Sep 2012 01:00:25 +0000 (11:00 +1000)
committerStephen Rothwell <sfr@canb.auug.org.au>
Fri, 21 Sep 2012 05:58:56 +0000 (15:58 +1000)
commit46983902958d1c2a748652fbbac7d265d7ff1bbb
tree63a8009fcac5f9e1045bc66d41edf7193e345253
parent93c6dd7c58f0db3058e435da287b8bf90c5f8e2e
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