]> git.kernelconcepts.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, 13 Sep 2012 07:28:03 +0000 (17:28 +1000)
commit6246ed0af2d17991d25713a7e3ade1d33dd9ca46
tree50cb7c07938b00b7480ec18701b6ac3a6023e2af
parent1a4b5742e34930504d1333780c0be715ac941fbd
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