Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp7151240rwb; Wed, 23 Nov 2022 02:58:15 -0800 (PST) X-Google-Smtp-Source: AA0mqf7hhxYoDo0T8X/NKEknLLipuBZ/BJkwQ8v8GjI48dMJSTApn0ZOlQ73ZYfBNzrFueBJHvYE X-Received: by 2002:a17:906:3fce:b0:7ad:bb54:75d3 with SMTP id k14-20020a1709063fce00b007adbb5475d3mr22993144ejj.484.1669201095070; Wed, 23 Nov 2022 02:58:15 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669201095; cv=none; d=google.com; s=arc-20160816; b=LCq+PZhJT8JxImJYWW4xQLS8i1dtfCYgsrF0sj9Mx88+iDvKw8uszFjdJ8Tb/oOAv7 v6ipInQfgovx24ntwpsxeOKovwwuUr88hpimwSWNW9C2bxLX6LMZ66VJfLu+L9d4I3To VMfvAF6KPN+K3oL/2eH0ttF7HZiCXwvLR8UFY4khXTHbS9NqwG7l3ZhAAT+JsNpcrCnx A9igjB8qQyL7o5IBEq8u527mMZ6026TD6bO7DbHAdTQC8y+NHGk2wG9eB7jWFFjUmm01 ebaxqfz3Uckyy8VkVlBmYkzjltStkBFdOqdxY4JYnR9UqFQh6lz3/hoiLlQDHGhFf//Y uC4A== 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; bh=5QV88JVNnH3ao3Go2tSe0rMm2eGX3/ZDdCF+hcd4mjY=; b=zvXZ8KPdL6coU6Iow7hS9AmSI+uae+9S1Im4o++0RNdrIHaETmCJDlbQWdvP/TBfsR ftfcdtHxBkRiTYgaLIOgEWlE+GZ0yOR3jR3o9OoyTiblm9CMEXV4UCQJRG4at4oBmTYC vviN/UCZkpcislW52AJn1WKwnHooVcSN0bRIa+Ya0UD4rnNUgWDliswQFgFX7WJY+8VB Ki0WGI98jAvP3iQX3XbPNjt+9gJcu5fgWQVRIQFrY/PRzlgZerT95rz4ItHjHVNs2udN +VKQieFXZnt1tzlc+mDVA+kqmwW8fKGPV8+QV8hoV0zFzH3x33Ye2qltF6QPw4xj4WPA hPDQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id u1-20020a1709064ac100b0078d62ae01c1si11673649ejt.536.2022.11.23.02.57.49; Wed, 23 Nov 2022 02:58:15 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237056AbiKWKn0 (ORCPT + 88 others); Wed, 23 Nov 2022 05:43:26 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45958 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235616AbiKWKls (ORCPT ); Wed, 23 Nov 2022 05:41:48 -0500 Received: from outbound-smtp36.blacknight.com (outbound-smtp36.blacknight.com [46.22.139.219]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B716D151666 for ; Wed, 23 Nov 2022 02:25:54 -0800 (PST) Received: from mail.blacknight.com (pemlinmail06.blacknight.ie [81.17.255.152]) by outbound-smtp36.blacknight.com (Postfix) with ESMTPS id 52B141C8B 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: X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_LOW, SPF_HELO_NONE,SPF_PASS autolearn=ham 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 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);