]> 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>
Mon, 17 Sep 2012 10:46:03 +0000 (20:46 +1000)
commit604458f1ce6e26c9a03f86e5bc58ab00b674dee4
tree963d9d3b9a18235478cb6697da50e172f4673039
parentb49967b57fbaa67b1fe64ae0ee227069b642f880
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