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 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 62007C433F5 for ; Fri, 20 May 2022 11:30:37 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 72C416B0071; Fri, 20 May 2022 07:30:36 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 6B56D6B0072; Fri, 20 May 2022 07:30:36 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 554F46B0073; Fri, 20 May 2022 07:30:36 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id 3AC126B0071 for ; Fri, 20 May 2022 07:30:36 -0400 (EDT) Received: from smtpin04.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id 0F563618D9 for ; Fri, 20 May 2022 11:30:36 +0000 (UTC) X-FDA: 79485903672.04.7C6AF0C Received: from alexa-out-sd-02.qualcomm.com (alexa-out-sd-02.qualcomm.com [199.106.114.39]) by imf25.hostedemail.com (Postfix) with ESMTP id 8E55EA00C4 for ; Fri, 20 May 2022 11:30:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; i=@quicinc.com; q=dns/txt; s=qcdkim; t=1653046234; x=1684582234; h=date:from:to:cc:subject:message-id:references: mime-version:in-reply-to; bh=ek3Un87zV6kEiotbIl4DIu9SOlYA+IdCTrS8AmQff18=; b=P37A7vz/hEYS5nkUT0kvDQJj7H8EofEhbXpPTPzoGyHdLFkcw38CD7RU mN84gCasQ3YeD2E7rUbVn7rSZuu0X2PrM5vxKPhmEDOuvIhHeFXOL8wWr MvqoQJVkaFCdZzY6Xy+z7ZRvSL+WurO+BJ8hNVGft6JUv6YbJANMAr2sv A=; Received: from unknown (HELO ironmsg04-sd.qualcomm.com) ([10.53.140.144]) by alexa-out-sd-02.qualcomm.com with ESMTP; 20 May 2022 04:30:32 -0700 X-QCInternal: smtphost Received: from nasanex01c.na.qualcomm.com ([10.47.97.222]) by ironmsg04-sd.qualcomm.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 20 May 2022 04:30:32 -0700 Received: from nalasex01a.na.qualcomm.com (10.47.209.196) by nasanex01c.na.qualcomm.com (10.47.97.222) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.22; Fri, 20 May 2022 04:30:32 -0700 Received: from qian (10.80.80.8) by nalasex01a.na.qualcomm.com (10.47.209.196) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.22; Fri, 20 May 2022 04:30:30 -0700 Date: Fri, 20 May 2022 07:30:28 -0400 From: Qian Cai To: Zi Yan CC: David Hildenbrand , , , , Vlastimil Babka , Mel Gorman , Eric Ren , Mike Rapoport , "Oscar Salvador" , Christophe Leroy , Andrew Morton Subject: Re: [PATCH v11 0/6] Use pageblock_order for cma and alloc_contig_range alignment. Message-ID: References: <20220426210801.GA1038@qian> <2B9844C8-6D35-41E2-ACB2-9854E7A9C29F@nvidia.com> <20220427132720.GC71@qian> <1D88AE1B-4DFC-400F-A054-662E3824C9AF@nvidia.com> <20220428123308.GA71@qian> <0E75B247-8150-48A3-83AE-56C586030006@nvidia.com> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Disposition: inline In-Reply-To: X-Originating-IP: [10.80.80.8] X-ClientProxiedBy: nasanex01b.na.qualcomm.com (10.46.141.250) To nalasex01a.na.qualcomm.com (10.47.209.196) Authentication-Results: imf25.hostedemail.com; dkim=pass header.d=quicinc.com header.s=qcdkim header.b="P37A7vz/"; spf=pass (imf25.hostedemail.com: domain of quic_qiancai@quicinc.com designates 199.106.114.39 as permitted sender) smtp.mailfrom=quic_qiancai@quicinc.com; dmarc=pass (policy=none) header.from=quicinc.com X-Rspam-User: X-Rspamd-Server: rspam05 X-Rspamd-Queue-Id: 8E55EA00C4 X-Stat-Signature: 8t9pbej9ryfseo6k6jxjoz178w75rpco X-HE-Tag: 1653046209-232839 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 Thu, May 19, 2022 at 05:35:15PM -0400, Zi Yan wrote: > Do you have a complete reproducer? From your printout, it is clear that a 512-page compound > page caused the infinite loop, because the page was not migrated and the code kept > retrying. But __alloc_contig_migrate_range() is supposed to return non-zero to tell the > code the page cannot be migrated and the code will goto failed without retrying. It will be > great you can share what exactly has run after boot, so that I can reproduce locally to > identify what makes __alloc_contig_migrate_range() return 0 without migrating the page. The reproducer is just to run the same script I shared with you previously multiple times instead. It is still quite reproducible here as it usually happens within a hour. $ for i in `seq 1 100`; do ./flip_mem.py; done > Can you also try the patch below to see if it fixes the infinite loop? > > diff --git a/mm/page_isolation.c b/mm/page_isolation.c > index b3f074d1682e..abde1877bbcb 100644 > --- a/mm/page_isolation.c > +++ b/mm/page_isolation.c > @@ -417,10 +417,9 @@ static int isolate_single_pageblock(unsigned long boundary_pfn, gfp_t gfp_flags, > order = 0; > outer_pfn = pfn; > while (!PageBuddy(pfn_to_page(outer_pfn))) { > - if (++order >= MAX_ORDER) { > - outer_pfn = pfn; > - break; > - } > + /* abort if the free page cannot be found */ > + if (++order >= MAX_ORDER) > + goto failed; > outer_pfn &= ~0UL << order; > } > pfn = outer_pfn; > Can you explain a bit how this patch is the right thing to do here? I am a little bit worry about shooting into the dark. Otherwise, I'll be running the off-by-one part over the weekend to see if that helps.