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: 11870541 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id BB16A6A2 for ; Fri, 30 Oct 2020 18:38:19 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 4210C20731 for ; Fri, 30 Oct 2020 18:38:19 +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" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 4210C20731 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=sent.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 4CEC26B005C; Fri, 30 Oct 2020 14:38:18 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 47E366B0062; Fri, 30 Oct 2020 14:38:18 -0400 (EDT) X-Original-To: int-list-linux-mm@kvack.org X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 36C9B6B006C; Fri, 30 Oct 2020 14:38:18 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0049.hostedemail.com [216.40.44.49]) by kanga.kvack.org (Postfix) with ESMTP id 075C66B005C for ; Fri, 30 Oct 2020 14:38:17 -0400 (EDT) Received: from smtpin19.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id 9C1B18249980 for ; Fri, 30 Oct 2020 18:38:17 +0000 (UTC) X-FDA: 77429451834.19.books97_0e15ef627298 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin19.hostedemail.com (Postfix) with ESMTP id 76CB61AD1B2 for ; Fri, 30 Oct 2020 18:38:17 +0000 (UTC) X-Spam-Summary: 1,0,0,9202762cfc0c3400,d41d8cd98f00b204,zi.yan@sent.com,,RULES_HIT:41:152:355:379:541:800:960:973:988:989:1260:1261:1277:1311:1313:1314:1345:1359:1437:1513:1515:1516:1518:1521:1534:1541:1593:1594:1711:1730:1747:1777:1792:2198:2199:2393:2559:2562:3138:3139:3140:3141:3142:3352:3867:3868:3870:3871:4250:4321:5007:6119:6261:6653:7576:7903:10004:10400:10471:11026:11658:11914:12043:12294:12296:12438:12555:12679:12895:12986:13069:13255:13311:13357:14096:14097:14181:14394:14659:14721:21080:21451:21627:21990:30054:30064,0,RBL:66.111.4.26:@sent.com:.lbl8.mailshell.net-62.18.0.100 66.100.201.100;04yg34notpkmwjca9y9p971jdzbqcyp3xt7xissh76f68mbru11t6giou15e1ke.8e6ni3z5iikgfn57rrjfo6ehdmcwehr46bo7myhjssgkffcwxm48c5rn4ucqwc9.h-lbl8.mailshell.net-223.238.255.100,CacheIP:none,Bayesian:0.5,0.5,0.5,Netcheck:none,DomainCache:0,MSF:not bulk,SPF:fp,MSBL:0,DNSBL:neutral,Custom_rules:0:0:0,LFtime:69,LUA_SUMMARY:none X-HE-Tag: books97_0e15ef627298 X-Filterd-Recvd-Size: 4931 Received: from out2-smtp.messagingengine.com (out2-smtp.messagingengine.com [66.111.4.26]) by imf44.hostedemail.com (Postfix) with ESMTP for ; Fri, 30 Oct 2020 18:38:16 +0000 (UTC) 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 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: 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;