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 F4119ECAAA1 for ; Thu, 27 Oct 2022 20:26:02 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 394976B0071; Thu, 27 Oct 2022 16:26:02 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 3445A6B0073; Thu, 27 Oct 2022 16:26:02 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 20C216B0074; Thu, 27 Oct 2022 16:26:02 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0010.hostedemail.com [216.40.44.10]) by kanga.kvack.org (Postfix) with ESMTP id 11AF46B0071 for ; Thu, 27 Oct 2022 16:26:02 -0400 (EDT) Received: from smtpin02.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id B89BCABAA6 for ; Thu, 27 Oct 2022 20:26:01 +0000 (UTC) X-FDA: 80067860922.02.62BAA77 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by imf23.hostedemail.com (Postfix) with ESMTP id 3E2DD14001E for ; Thu, 27 Oct 2022 20:26:00 +0000 (UTC) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id E96D6B82705; Thu, 27 Oct 2022 20:25:59 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 18137C433C1; Thu, 27 Oct 2022 20:25:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linux-foundation.org; s=korg; t=1666902358; bh=URPpMsa+EIMCx1JWWkXOR1/blBrJYJpsa2cKAC8XdO8=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=osGFa6VEgACvzcZvzx9pqaJAIaExsqGHzFjsFS2DpwddXssJa+2Ogd/6yCCTxPNen ILXp45Ptp6mZo9xiR0fBqh5wk+5S+VeOmhHbC0gQLFHDObATd2FlvSZN0vwb9uwJr3 1FCwRNzAluaWmStka2bWwQWzuNw3SrCYmPk4Xxg4= Date: Thu, 27 Oct 2022 13:25:57 -0700 From: Andrew Morton To: NARIBAYASHI Akira Cc: vbabka@suse.cz, mgorman@techsingularity.net, 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: <20221027132557.5f724149bd5753036f41512a@linux-foundation.org> In-Reply-To: <20221026112438.236336-1-a.naribayashi@fujitsu.com> References: <20221026112438.236336-1-a.naribayashi@fujitsu.com> X-Mailer: Sylpheed 3.7.0 (GTK+ 2.24.33; x86_64-redhat-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit ARC-Authentication-Results: i=1; imf23.hostedemail.com; dkim=pass header.d=linux-foundation.org header.s=korg header.b=osGFa6VE; spf=pass (imf23.hostedemail.com: domain of akpm@linux-foundation.org designates 145.40.68.75 as permitted sender) smtp.mailfrom=akpm@linux-foundation.org; dmarc=none ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1666902361; a=rsa-sha256; cv=none; b=CvLoI7DYpLT+kayyZF2ZZLBTqWuw2S3dLAgJq+j1RVL+h7yb932BNkw32xcfpeh1TTJTHo d1kJog9wqk9ErMd+KJ6taV8prhnH1Vvtqet/Pd4BiUFqrzvvZxCJ+waLrBOPuScHZ/0BXE 2MHuLAbPdaUKFgTr3OMDOiSzYua/kPU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1666902361; 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:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=DTgk6lTN93be4auIV1O0brkbGyPxG9NLj2ZuARZ2/9o=; b=4o3/HExP2Frp13pVzCs+OVc5Nxf6p12H7YFc2JMXIkrisaZPruZ7H1IWvyMj3Wg5HVAdgI cFFlpiAMDDEHJ6bn6XCH4414jC63L4QofLYSpF1NVaeY3V19SL7s+yfZB31gxAs2HR5JbJ pf7MLLbXA64UJ9WXlzFQ715nVz80gcA= X-Rspam-User: X-Rspamd-Queue-Id: 3E2DD14001E Authentication-Results: imf23.hostedemail.com; dkim=pass header.d=linux-foundation.org header.s=korg header.b=osGFa6VE; spf=pass (imf23.hostedemail.com: domain of akpm@linux-foundation.org designates 145.40.68.75 as permitted sender) smtp.mailfrom=akpm@linux-foundation.org; dmarc=none X-Stat-Signature: he77kyuba5eswygnichsuuz5qxmym8jt X-Rspamd-Server: rspam10 X-HE-Tag: 1666902360-848726 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, 26 Oct 2022 20:24:38 +0900 NARIBAYASHI Akira wrote: > Depending on the memory configuration, isolate_freepages_block() may > scan pages out of the target range and causes panic. > > The problem is that pfn as argument of fast_isolate_around() could > be out of the target range. Therefore we should consider the case > where pfn < start_pfn, and also the case where end_pfn < pfn. > > This problem should have been addressd by the commit 6e2b7044c199 > ("mm, compaction: make fast_isolate_freepages() stay within zone") > but there was an oversight. > > Case1: pfn < start_pfn > > > | node X's zone | node Y's zone > +-----------------+------------------------------... > pageblock ^ ^ ^ > +-----------+-----------+-----------+-----------+... > ^ ^ ^ > ^ ^ end_pfn > ^ start_pfn = cc->zone->zone_start_pfn > pfn > <---------> scanned range by "Scan After" > > Case2: end_pfn < pfn > > > | node X's zone | node Y's zone > +-----------------+------------------------------... > pageblock ^ ^ ^ > +-----------+-----------+-----------+-----------+... > ^ ^ ^ > ^ ^ pfn > ^ end_pfn > start_pfn > <---------> scanned range by "Scan Before" > > It seems that there is no good reason to skip nr_isolated pages > just after given pfn. So let perform simple scan from start to end > instead of dividing the scan into "Before" and "After". 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?