From patchwork Mon May 30 11:50:27 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anshuman Khandual X-Patchwork-Id: 12864565 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 E7E63C433EF for ; Mon, 30 May 2022 11:50:34 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 857706B0074; Mon, 30 May 2022 07:50:34 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 807636B0075; Mon, 30 May 2022 07:50:34 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 6F82A6B0078; Mon, 30 May 2022 07:50:34 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id 615026B0074 for ; Mon, 30 May 2022 07:50:34 -0400 (EDT) Received: from smtpin18.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay11.hostedemail.com (Postfix) with ESMTP id 2E6808105B for ; Mon, 30 May 2022 11:50:34 +0000 (UTC) X-FDA: 79522241988.18.D0CD258 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by imf06.hostedemail.com (Postfix) with ESMTP id 000F118003F for ; Mon, 30 May 2022 11:50:29 +0000 (UTC) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id D72CC113E; Mon, 30 May 2022 04:50:32 -0700 (PDT) Received: from a077893.arm.com (unknown [10.163.36.153]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id B0F893F766; Mon, 30 May 2022 04:50:30 -0700 (PDT) From: Anshuman Khandual To: linux-mm@kvack.org Cc: Anshuman Khandual , Andrew Morton , Zi Yan , linux-kernel@vger.kernel.org Subject: [RFC] mm/page_isolation: Fix an infinite loop in isolate_single_pageblock() Date: Mon, 30 May 2022 17:20:27 +0530 Message-Id: <20220530115027.123341-1-anshuman.khandual@arm.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 X-Stat-Signature: b39e8zq97sef3emsyobp6jjgnpwqacx5 Authentication-Results: imf06.hostedemail.com; dkim=none; dmarc=pass (policy=none) header.from=arm.com; spf=pass (imf06.hostedemail.com: domain of anshuman.khandual@arm.com designates 217.140.110.172 as permitted sender) smtp.mailfrom=anshuman.khandual@arm.com X-Rspam-User: X-Rspamd-Server: rspam07 X-Rspamd-Queue-Id: 000F118003F X-HE-Tag: 1653911429-68118 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: HugeTLB allocation (32MB pages on 4K base page) via sysfs on arm64 platform is getting stuck in isolate_single_pageblock(), because of an infinite loop Because head_pfn always evaluate the same, so does pfn, and the outer loop never exits. Dropping the relevant code block, which seems redundant, makes the problem go away. Cc: Andrew Morton Cc: Zi Yan Cc: linux-mm@kvack.org Cc: linux-kernel@vger.kernel.org Fixes: b2c9e2fbba32 ("mm: make alloc_contig_range work at pageblock granularity") Signed-off-by: Anshuman Khandual --- I am not sure about this fix, and also did not find much time today to debug any further. There are much code changes around this function in recent days. This problem is present on latest mainline kernel. - Anshuman mm/page_isolation.c | 4 ---- 1 file changed, 4 deletions(-) diff --git a/mm/page_isolation.c b/mm/page_isolation.c index 6021f8444b5a..b0922fee75c1 100644 --- a/mm/page_isolation.c +++ b/mm/page_isolation.c @@ -389,10 +389,6 @@ static int isolate_single_pageblock(unsigned long boundary_pfn, int flags, struct page *head = compound_head(page); unsigned long head_pfn = page_to_pfn(head); - if (head_pfn + nr_pages <= boundary_pfn) { - pfn = head_pfn + nr_pages; - continue; - } #if defined CONFIG_COMPACTION || defined CONFIG_CMA /* * hugetlb, lru compound (THP), and movable compound pages