From patchwork Fri Oct 30 18:38:09 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Zi Yan X-Patchwork-Id: 317439 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.6 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id C8514C4741F for ; Fri, 30 Oct 2020 18:38:29 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 65CF820731 for ; Fri, 30 Oct 2020 18:38:29 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=sent.com header.i=@sent.com header.b="LZ8Y0MDC"; dkim=temperror (0-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="pYIwQCSk" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727239AbgJ3SiS (ORCPT ); Fri, 30 Oct 2020 14:38:18 -0400 Received: from out2-smtp.messagingengine.com ([66.111.4.26]:51587 "EHLO out2-smtp.messagingengine.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726095AbgJ3SiR (ORCPT ); Fri, 30 Oct 2020 14:38:17 -0400 Received: from compute6.internal (compute6.nyi.internal [10.202.2.46]) by mailout.nyi.internal (Postfix) with ESMTP id B31405C00E1; Fri, 30 Oct 2020 14:38:16 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute6.internal (MEProxy); Fri, 30 Oct 2020 14:38:16 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sent.com; h=from :to:cc:subject:date:message-id:in-reply-to:references:reply-to :mime-version:content-type:content-transfer-encoding; s=fm1; bh= a+yV5AyyQgbkAmuRGp5Grqx+CnaA6i6TKDg6E8EnuoM=; b=LZ8Y0MDCS5wAAvDj W/mWis1W9G0odlltD0S7OECXly0rCRiPR2ZI+MD6MeOesOj6WMVirhEtxtLoKG7B 35sg9HQqvuMx5q2p4I9xPJ6+RWvjFH2jKh6lRiahr4y95PomUVM+UCzYg3Ny2X4c CAiqo50PgA3qcilBOhAoUENaF5gsGKS75BorMXKIvhWSyBskX5dTXVvTGduN4zLC rNl1Oaen6GF+krJP2i1QgxbaKfSvN6REn+JQGaEzWaOSuVCKcf9fCSyzLpJdrRT7 ZANs6TEt7AQJkAAtJG0y5YJJ7Myu3+cLnkmKubRqC0PFyaS1i/NaVlZjdj/RVggm G36XXw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :reply-to:subject:to:x-me-proxy:x-me-proxy:x-me-sender :x-me-sender:x-sasl-enc; s=fm1; bh=a+yV5AyyQgbkAmuRGp5Grqx+CnaA6 i6TKDg6E8EnuoM=; b=pYIwQCSkN57JUFmVQ6O4s2dY2Sbxx4fBl/G65OYCu4zcO AOxDrwgu93EurxOU0Y0/FJ89QrPOjz9W8Qdommd6a6HVgdNIefIRhVCW701PEhA7 g0EMCbjRMV3i3NbjN732xkb3m0kxIx3vsvo0JVwMQEmvovlvAlh9+GOemaEnBxeu fLl9pgm94LnBG4/gHWYJyUuI7oQPjo0j4wrzvzvNOSF856ZWjAWMcQtxKAbeDIUC pxMZhZ/Kh/rKSAnOqvYUSTXaEDKh71gA2q1j4C8sr8XLdSu9hY7JcBlEj578oT4W y6zzpcY5B3ZUNcX/IoUlmh5SKN0r0jDVedSBUow+Q== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedujedrleehgdduuddtucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhephffvufffkffojghfrhggtgfgsehtqhertdertdejnecuhfhrohhmpegkihcu jggrnhcuoeiiihdrhigrnhesshgvnhhtrdgtohhmqeenucggtffrrghtthgvrhhnpeekgf fgleejfeegjedttefhhedvgfffvdeffeekjeetgffhtedvudffkeegleettdenucfkphep uddvrdegiedruddtiedrudeigeenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmh epmhgrihhlfhhrohhmpeiiihdrhigrnhesshgvnhhtrdgtohhm X-ME-Proxy: Received: from nvrsysarch6.NVidia.COM (unknown [12.46.106.164]) by mail.messagingengine.com (Postfix) with ESMTPA id 3443E3280064; Fri, 30 Oct 2020 14:38:13 -0400 (EDT) From: Zi Yan To: Andrew Morton , linux-mm@kvack.org Cc: Yang Shi , Michal Hocko , Vlastimil Babka , Rik van Riel , linux-kernel@vger.kernel.org, stable@vger.kernel.org, Zi Yan Subject: [PATCH v3 2/2] mm/compaction: stop isolation if too many pages are isolated and we have pages to migrate. Date: Fri, 30 Oct 2020 14:38:09 -0400 Message-Id: <20201030183809.3616803-2-zi.yan@sent.com> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20201030183809.3616803-1-zi.yan@sent.com> References: <20201030183809.3616803-1-zi.yan@sent.com> Reply-To: Zi Yan MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Zi Yan In isolate_migratepages_block, if we have too many isolated pages and nr_migratepages is not zero, we should try to migrate what we have without wasting time on isolating. Fixes: 1da2f328fa64 (“mm,thp,compaction,cma: allow THP migration for CMA allocations”) Suggested-by: Vlastimil Babka Signed-off-by: Zi Yan Cc: Acked-by: Vlastimil Babka --- mm/compaction.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/mm/compaction.c b/mm/compaction.c index 3e834ac402f1..4d237a7c3830 100644 --- a/mm/compaction.c +++ b/mm/compaction.c @@ -817,6 +817,10 @@ isolate_migratepages_block(struct compact_control *cc, unsigned long low_pfn, * delay for some time until fewer pages are isolated */ while (unlikely(too_many_isolated(pgdat))) { + /* stop isolation if there are still pages not migrated */ + if (cc->nr_migratepages) + return 0; + /* async migration should just abort */ if (cc->mode == MIGRATE_ASYNC) return 0;