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 968F0C433FE for ; Wed, 23 Nov 2022 10:25:56 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 280DE6B0071; Wed, 23 Nov 2022 05:25:56 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 231CF6B0073; Wed, 23 Nov 2022 05:25:56 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 120C06B0074; Wed, 23 Nov 2022 05:25:56 -0500 (EST) 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 024506B0071 for ; Wed, 23 Nov 2022 05:25:56 -0500 (EST) Received: from smtpin22.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id C1ADAC092D for ; Wed, 23 Nov 2022 10:25:55 +0000 (UTC) X-FDA: 80164326270.22.5AA2B44 Received: from outbound-smtp51.blacknight.com (outbound-smtp51.blacknight.com [46.22.136.235]) by imf11.hostedemail.com (Postfix) with ESMTP id 040FB4000E for ; Wed, 23 Nov 2022 10:25:54 +0000 (UTC) Received: from mail.blacknight.com (pemlinmail06.blacknight.ie [81.17.255.152]) by outbound-smtp51.blacknight.com (Postfix) with ESMTPS id 53B5EFA7CD for ; Wed, 23 Nov 2022 10:25:53 +0000 (GMT) Received: (qmail 2725 invoked from network); 23 Nov 2022 10:25:53 -0000 Received: from unknown (HELO techsingularity.net) (mgorman@techsingularity.net@[84.203.198.246]) by 81.17.254.9 with ESMTPSA (AES256-SHA encrypted, authenticated); 23 Nov 2022 10:25:52 -0000 Date: Wed, 23 Nov 2022 10:25:50 +0000 From: Mel Gorman To: "Akira Naribayashi (Fujitsu)" Cc: "akpm@linux-foundation.org" , "vbabka@suse.cz" , "rientjes@google.com" , "linux-mm@kvack.org" , "linux-kernel@vger.kernel.org" , "stable@vger.kernel.org" Subject: Re: [PATCH] mm, compaction: fix fast_isolate_around() to stay within boundaries Message-ID: <20221123102550.kbsd3xclsr6o27up@techsingularity.net> References: <20221027132557.5f724149bd5753036f41512a@linux-foundation.org> <20221031073559.36021-1-a.naribayashi@fujitsu.com> <20221107154350.34brdl3ms2ve5wud@techsingularity.net> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-15 Content-Disposition: inline In-Reply-To: ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1669199155; a=rsa-sha256; cv=none; b=Wge0nci86l3ivWXL1ZAuNCd+KcxumgFrzk8Nrq2kJsFRpfwB48fkYVBawN9wvWe+VifN8N d+xZnmporB4BsRFLzjIPKXSJBDoMyggInIZQKdQfSJoVxyX3MhihF8syDE4MB9pm6FsjBS qL/uo4ZVUr8AqZ9riLu/7dtMOXkzjkY= ARC-Authentication-Results: i=1; imf11.hostedemail.com; dkim=none; dmarc=none; spf=pass (imf11.hostedemail.com: domain of mgorman@techsingularity.net designates 46.22.136.235 as permitted sender) smtp.mailfrom=mgorman@techsingularity.net ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1669199155; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=5QV88JVNnH3ao3Go2tSe0rMm2eGX3/ZDdCF+hcd4mjY=; b=ASNSIxP+0pdedUszB/vVSo60cSsILyLSb3tNMjxWF0oyMtfGrXDMJKV3z5k8nLaQeZYzeB ecV8dgjVMIJSX8nwKSyh2ktk5SSwK1NxX81zinzTz5XD3ZkQyXemwvF7tFZ549V+7LJPgQ GX35HVqsERTCBtp8VuA57j/dAVI7VII= X-Rspamd-Server: rspam12 X-Rspamd-Queue-Id: 040FB4000E X-Rspam-User: Authentication-Results: imf11.hostedemail.com; dkim=none; dmarc=none; spf=pass (imf11.hostedemail.com: domain of mgorman@techsingularity.net designates 46.22.136.235 as permitted sender) smtp.mailfrom=mgorman@techsingularity.net X-Stat-Signature: 6w8e1a7u1iberyt4z4t1qyr6iswjf6qx X-HE-Tag: 1669199154-280185 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 Wed, Nov 09, 2022 at 05:41:12AM +0000, Akira Naribayashi (Fujitsu) wrote: > On Mon, 7 Nov 2022 15:43:56 +0000, Mei Gorman wrote: > > On Mon, Nov 07, 2022 at 12:32:34PM +0000, Akira Naribayashi (Fujitsu) wrote: > > > > Under what circumstances will this panic occur? I assume those > > > > circumstnces are pretty rare, give that 6e2b7044c1992 was nearly two > > > > years ago. > > > > > > > > Did you consider the desirability of backporting this fix into earlier > > > > kernels? > > > > > > > > > Panic can occur on systems with multiple zones in a single pageblock. > > > > > > > Please provide an example of the panic and the zoneinfo. > > This issue is occurring in our customer's environment and cannot > be shared publicly as it contains customer information. > Also, the panic is occurring with the kernel in RHEL and may not > panic with Upstream's community kernel. > In other words, it is possible to panic on older kernels. > I think this fix should be backported to stable kernel series. > > > > The reason it is rare is that it only happens in special configurations. > > > > How is this special configuration created? > > This is the case when the node boundary is not aligned to pageblock boundary. In that case, does this work to avoid rescanning an area that was already isolated? diff --git a/mm/compaction.c b/mm/compaction.c index c51f7f545afe..58cf73ff20ff 100644 --- a/mm/compaction.c +++ b/mm/compaction.c @@ -1346,7 +1346,7 @@ move_freelist_tail(struct list_head *freelist, struct page *freepage) static void fast_isolate_around(struct compact_control *cc, unsigned long pfn, unsigned long nr_isolated) { - unsigned long start_pfn, end_pfn; + unsigned long start_pfn, end_pfn, isolated_end; struct page *page; /* Do not search around if there are enough pages already */ @@ -1361,6 +1361,10 @@ fast_isolate_around(struct compact_control *cc, unsigned long pfn, unsigned long start_pfn = max(pageblock_start_pfn(pfn), cc->zone->zone_start_pfn); end_pfn = min(pageblock_end_pfn(pfn), zone_end_pfn(cc->zone)); + /* Pageblock may straddle zone/node boundaries */ + isolated_end = pfn + nr_isolated; + pfn = clamp(pfn, start_pfn, end_pfn); + page = pageblock_pfn_to_page(start_pfn, end_pfn, cc->zone); if (!page) return; @@ -1373,7 +1377,7 @@ fast_isolate_around(struct compact_control *cc, unsigned long pfn, unsigned long } /* Scan after */ - start_pfn = pfn + nr_isolated; + start_pfn = isolated_end; if (start_pfn < end_pfn) isolate_freepages_block(cc, &start_pfn, end_pfn, &cc->freepages, 1, false);