Received: by 2002:a05:6602:18e:0:0:0:0 with SMTP id m14csp1680156ioo; Mon, 23 May 2022 00:04:41 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxLhX/J7cppGt/yc31PqHJQilE4gk5jZuoki62fI7f3X7XLgQF4eVPYVDYg4PLWp2pJj9qy X-Received: by 2002:a17:902:f084:b0:161:dc38:4577 with SMTP id p4-20020a170902f08400b00161dc384577mr19784005pla.31.1653289480869; Mon, 23 May 2022 00:04:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1653289480; cv=none; d=google.com; s=arc-20160816; b=AvaQo/Z8tixCn4Dm63VO9bN/AZtSy4qa2yhqN2lVTeK9zCQ0DRE8iydME6NhYF3mtk 7+jLnZw/ryei8S8VbkTjVKAZFdkYyygu6lcqOe8HOuWuWveq0o5I4gGEibelUzo22bm1 F+rTG26HdLn4O5ilutJqw5gyxItfccGDAszb4Ys0enkJsIGZBQDM/CwjBvcmmRnr2CAg 11MZeBer/oTXdU9xTGDjLh/xmauqzV8d+rUpSOzj6s8yz+lqrt1tCknB8hBCa7QgBHnc QQTuiiKIcvj8tuUHoRtrS6sDo5897u4nUEPt3K9GvatCF25G5hovfzl8X1k2h929Y5mh a0Ww== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=ek3Un87zV6kEiotbIl4DIu9SOlYA+IdCTrS8AmQff18=; b=o0TJudZtgRYoriU5qNMtQoauYwn70CTkMK+NhBCNgQLpfp+rV8Aiyd+o7b92wcso8X p+hrmtfioEHBjtQhuRX1gJtjEzJvlN+QhiU0NLBg6IcQp8+DloafcCTMS+JL9oG5MnAx +rF1dl9M6EhX3koQVK7EcETgfMd17VYjBwl4TwkIX1z1psRv4hn/ReadQZgXQuRSo4O3 kiLFWaN5yoluDe6VzSwfaYYV/bzI5wrKxDub/Sz0AmYYvOCZhawvh6hcGdytV6S3i1jg BuyKbk8Ti6DyrdQxnF4q6svUGBs40jBwvk8qWkqheYQi6HOuibw0k/Q6YT/vi88wRx04 jTwg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcdkim header.b=sR8ge11d; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id 128-20020a621686000000b005182fda1b23si12831122pfw.236.2022.05.23.00.04.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 23 May 2022 00:04:40 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcdkim header.b=sR8ge11d; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 2B1A5F4B; Sun, 22 May 2022 23:26:15 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1348532AbiETLbO (ORCPT + 99 others); Fri, 20 May 2022 07:31:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43760 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348556AbiETLbF (ORCPT ); Fri, 20 May 2022 07:31:05 -0400 Received: from alexa-out-sd-01.qualcomm.com (alexa-out-sd-01.qualcomm.com [199.106.114.38]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2A81815AB0B for ; Fri, 20 May 2022 04:30:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; i=@quicinc.com; q=dns/txt; s=qcdkim; t=1653046233; x=1684582233; h=date:from:to:cc:subject:message-id:references: mime-version:in-reply-to; bh=ek3Un87zV6kEiotbIl4DIu9SOlYA+IdCTrS8AmQff18=; b=sR8ge11dDrrWfpJm+AM2uGpLePaBD879mq8mtGNJHYNgNFO37uO93nsh Jk3Jxl/3+/jaDNwjdIIJNEzOdVLqvIAAj5SdxU+WlfjZNdExtxZJUN+gk HiZ2XBvALjsUYwPJPUE9u+W4VrDHyDEbVPpMfg0xGA0mJ/T4XqGehWXh4 M=; Received: from unknown (HELO ironmsg04-sd.qualcomm.com) ([10.53.140.144]) by alexa-out-sd-01.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) X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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.