From mboxrd@z Thu Jan 1 00:00:00 1970 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=-11.2 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,NICE_REPLY_A, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=ham 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 1149CC388F2 for ; Mon, 2 Nov 2020 13:07:18 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 64BD92227F for ; Mon, 2 Nov 2020 13:07:17 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 64BD92227F Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=suse.cz Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id C45376B0070; Mon, 2 Nov 2020 08:07:16 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id BCE3E6B0072; Mon, 2 Nov 2020 08:07:16 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id A95626B0073; Mon, 2 Nov 2020 08:07:16 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0168.hostedemail.com [216.40.44.168]) by kanga.kvack.org (Postfix) with ESMTP id 731166B0070 for ; Mon, 2 Nov 2020 08:07:16 -0500 (EST) Received: from smtpin21.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id 152E21EE6 for ; Mon, 2 Nov 2020 13:07:16 +0000 (UTC) X-FDA: 77439504072.21.thing28_1b1228d272b0 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin21.hostedemail.com (Postfix) with ESMTP id D6D24180442C7 for ; Mon, 2 Nov 2020 13:07:15 +0000 (UTC) X-HE-Tag: thing28_1b1228d272b0 X-Filterd-Recvd-Size: 2939 Received: from mx2.suse.de (mx2.suse.de [195.135.220.15]) by imf07.hostedemail.com (Postfix) with ESMTP for ; Mon, 2 Nov 2020 13:07:15 +0000 (UTC) X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id 4E233B810; Mon, 2 Nov 2020 13:07:14 +0000 (UTC) Subject: Re: [PATCH v3 2/2] mm/compaction: stop isolation if too many pages are isolated and we have pages to migrate. To: Zi Yan , Andrew Morton , linux-mm@kvack.org Cc: Yang Shi , Michal Hocko , Rik van Riel , linux-kernel@vger.kernel.org, stable@vger.kernel.org References: <20201030183809.3616803-1-zi.yan@sent.com> <20201030183809.3616803-2-zi.yan@sent.com> From: Vlastimil Babka Message-ID: Date: Mon, 2 Nov 2020 14:07:13 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.4.0 MIME-Version: 1.0 In-Reply-To: <20201030183809.3616803-2-zi.yan@sent.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: quoted-printable 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: On 10/30/20 7:38 PM, Zi Yan wrote: > From: Zi Yan >=20 > 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. As you CC stable, there should be a stronger reason (strictly speaking th= e=20 problem should have been observed in practice, but this is a simple patch= , so=20 they could accept it), so I suggest Andrew adds the following paragraph: In theory it's possible that multiple parallel compactions will cause=20 too_many_isolated() to become true even if each has isolated less than=20 COMPACT_CLUSTER_MAX, and loop forever in the while loop. Bailing immediat= ely=20 prevents that. > Fixes: 1da2f328fa64 (=E2=80=9Cmm,thp,compaction,cma: allow THP migratio= n for CMA allocations=E2=80=9D) > Suggested-by: Vlastimil Babka > Signed-off-by: Zi Yan > Cc: Acked-by: Vlastimil Babka > --- > mm/compaction.c | 4 ++++ > 1 file changed, 4 insertions(+) >=20 > 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 =3D=3D MIGRATE_ASYNC) > return 0; >=20