From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wi0-f169.google.com (mail-wi0-f169.google.com [209.85.212.169]) by kanga.kvack.org (Postfix) with ESMTP id D27F46B0038 for ; Mon, 4 Aug 2014 04:56:07 -0400 (EDT) Received: by mail-wi0-f169.google.com with SMTP id n3so5824045wiv.4 for ; Mon, 04 Aug 2014 01:56:05 -0700 (PDT) Received: from mx2.suse.de (cantor2.suse.de. [195.135.220.15]) by mx.google.com with ESMTPS id wx3si31717842wjc.0.2014.08.04.01.56.02 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 04 Aug 2014 01:56:02 -0700 (PDT) From: Vlastimil Babka Subject: [PATCH v6 04/13] mm, compaction: do not recheck suitable_migration_target under lock Date: Mon, 4 Aug 2014 10:55:15 +0200 Message-Id: <1407142524-2025-5-git-send-email-vbabka@suse.cz> In-Reply-To: <1407142524-2025-1-git-send-email-vbabka@suse.cz> References: <1407142524-2025-1-git-send-email-vbabka@suse.cz> Sender: owner-linux-mm@kvack.org List-ID: To: Andrew Morton , David Rientjes Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, Vlastimil Babka , Joonsoo Kim , Michal Nazarewicz , Naoya Horiguchi , Christoph Lameter , Rik van Riel , Mel Gorman , Minchan Kim , Zhang Yanfei isolate_freepages_block() rechecks if the pageblock is suitable to be a target for migration after it has taken the zone->lock. However, the check has been optimized to occur only once per pageblock, and compact_checklock_irqsave() might be dropping and reacquiring lock, which means somebody else might have changed the pageblock's migratetype meanwhile. Furthermore, nothing prevents the migratetype to change right after isolate_freepages_block() has finished isolating. Given how imperfect this is, it's simpler to just rely on the check done in isolate_freepages() without lock, and not pretend that the recheck under lock guarantees anything. It is just a heuristic after all. Signed-off-by: Vlastimil Babka Reviewed-by: Zhang Yanfei Acked-by: Minchan Kim Acked-by: Mel Gorman Cc: Joonsoo Kim Cc: Michal Nazarewicz Cc: Naoya Horiguchi Cc: Christoph Lameter Cc: Rik van Riel Acked-by: David Rientjes --- mm/compaction.c | 13 ------------- 1 file changed, 13 deletions(-) diff --git a/mm/compaction.c b/mm/compaction.c index 68803c8..9484a4f 100644 --- a/mm/compaction.c +++ b/mm/compaction.c @@ -276,7 +276,6 @@ static unsigned long isolate_freepages_block(struct compact_control *cc, struct page *cursor, *valid_page = NULL; unsigned long flags; bool locked = false; - bool checked_pageblock = false; cursor = pfn_to_page(blockpfn); @@ -307,18 +306,6 @@ static unsigned long isolate_freepages_block(struct compact_control *cc, if (!locked) break; - /* Recheck this is a suitable migration target under lock */ - if (!strict && !checked_pageblock) { - /* - * We need to check suitability of pageblock only once - * and this isolate_freepages_block() is called with - * pageblock range, so just check once is sufficient. - */ - checked_pageblock = true; - if (!suitable_migration_target(page)) - break; - } - /* Recheck this is a buddy page under lock */ if (!PageBuddy(page)) goto isolate_fail; -- 1.8.4.5 -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to majordomo@kvack.org. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: email@kvack.org