Received: by 2002:a05:7412:b995:b0:f9:9502:5bb8 with SMTP id it21csp4754948rdb; Fri, 29 Dec 2023 12:11:01 -0800 (PST) X-Google-Smtp-Source: AGHT+IG99sIVDLk55oAhnxoZvzhCpx+dl3lmSXihURLpw+fqqabb80nJmmLeA6ky2+cvrjXH6Hp/ X-Received: by 2002:a17:907:26c7:b0:a27:8833:2411 with SMTP id bp7-20020a17090726c700b00a2788332411mr575884ejc.60.1703880661047; Fri, 29 Dec 2023 12:11:01 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1703880661; cv=none; d=google.com; s=arc-20160816; b=UU9IF/ESvO8BmnxxcwiZvKxUboszb758/AY78HMe6/z3uPxWcQW8sxMGMrXzn9aGBh GjhR5mczuUPplBFDAIG3zna8/eZ9XP97ZY7c22A4bqTO4nxrDorCanRGkhdfr8qjbdY/ ahlK0z4JdRp1Aa28TcCvL/VzNzQntiZp7aNQuOgvNq3zpKJ6sHZSeqS4RW6hsz3ONAY8 zLHp/8cUxoYsJQM8n1/WDrl5ZucRD7S34pEuS+Ve9QAqtD0qrM0wYXqf84d+WdoeNVIj KGTsta2du1eSkMwejxbJTKUk6Q9ziO1skHN4waEO56oZxmwTFwn92EaiRRsbvcEFORfW lx7w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :subject:cc:to:from:date:dkim-signature; bh=3BCr3H871vORq2u62T885ZFJXbsILazony2v4qAeWfI=; fh=1CTZxEmZvBZYXz4R7mK1812KNh54tugT2YhEd9tu668=; b=FymraBjXBXYv3lcgNDbQ9Gqf06/m5l+7SXKblzK05XMpspgW1hSrpCGEmA0b9h6Pil aDVrPA5ZaN4ib3RzZmzqeqPcyiGpu0q6535oyeMCVuMfsCkf5aMdW6k7MN1n48bwdJAa rPRApjR5dcu5z4HSk0xntq6PE0BRI74DuQSbZBwx/XtQoh2CZOfrQFLzjV2Q60e9i7jS tVWyGr1hBbqePsGGSJcg2N5eWA8xl/xRlpi+Upc8iAvbhiK/2SgZGsbrvS40yPbM9eaT xCYLUTUbJvNWlIPlBojbAqm5hPt953PX49u1/RSqOoIgAze1Fyebyr1Wu9MfOuNE0DvW 9agA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=korg header.b=nzFmDpWG; spf=pass (google.com: domain of linux-kernel+bounces-13222-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-13222-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id h1-20020a17090619c100b00a2768b29357si773419ejd.948.2023.12.29.12.11.00 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 29 Dec 2023 12:11:01 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-13222-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=korg header.b=nzFmDpWG; spf=pass (google.com: domain of linux-kernel+bounces-13222-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-13222-linux.lists.archive=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id B0F731F22E51 for ; Fri, 29 Dec 2023 20:11:00 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 484771400A; Fri, 29 Dec 2023 20:10:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux-foundation.org header.i=@linux-foundation.org header.b="nzFmDpWG" X-Original-To: linux-kernel@vger.kernel.org Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8256C13FEB for ; Fri, 29 Dec 2023 20:10:53 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C4392C433C7; Fri, 29 Dec 2023 20:10:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linux-foundation.org; s=korg; t=1703880653; bh=ksTPppqdxWZLxFaIlmOFBvh791nfVHs/hnZ5LHsvKgk=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=nzFmDpWGBy32NNB5e6/szEtdk8t6tD67Aywe9CKdPd/I0aZcic+y0wv4CshY+sCth NnR3VXemkhBFYeoMM9SurCyiA/RpP8WzE2GVWfZDnNqIi3DIltKX60wWEfJ26UdCXk 9S+vKwaTFvNjiw9ZUU7MAkXTtVoQDWGW11yJ4siw= Date: Fri, 29 Dec 2023 12:10:52 -0800 From: Andrew Morton To: Baoquan He Cc: Yuntao Wang , bp@alien8.de, dave.hansen@linux.intel.com, dyoung@redhat.com, eric.devolder@oracle.com, hbathini@linux.ibm.com, hpa@zytor.com, kexec@lists.infradead.org, lijiang@redhat.com, linux-kernel@vger.kernel.org, mingo@redhat.com, seanjc@google.com, sourabhjain@linux.ibm.com, tglx@linutronix.de, tiwai@suse.de, vgoyal@redhat.com, x86@kernel.org Subject: Re: [PATCH 3/3] crash_core: fix and simplify the logic of crash_exclude_mem_range() Message-Id: <20231229121052.cac37914c7a051b829fcf933@linux-foundation.org> In-Reply-To: References: <20231216015410.188924-1-ytcoode@gmail.com> X-Mailer: Sylpheed 3.8.0beta1 (GTK+ 2.24.33; x86_64-pc-linux-gnu) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit On Sat, 16 Dec 2023 11:31:04 +0800 Baoquan He wrote: > > > Imagine we have a crashkernel region 256M reserved under 4G, say [2G, 2G+256M]. > > > Then after excluding the 256M from a region, it should stop. But now, this patch > > > will make it continue scanning. Not sure if it's all in my mind. > > > > Hi Baoquan, > > > > Thank you for such a detailed reply. Now I finally understand why the code is > > written this way. > > > > However, if we can guarantee its correctness, wouldn't it be better to use the > > generic region removing logic? At least it is more concise and clear, and other > > people reading this code for the first time wouldn't get confused like me. > > > > As for your concern about the while loop, I think it wouldn't affect performance > > much because the total number of loops is small. > > Well, see below kexec-tools commit, you wouldn't say that. And when you > understand the code, you will feel a little uncomfortable about the > sustaining useless scanning. At least, we should stop scanning after > needed exluding is done. > > Or, we may need add a generic region removing function so that it > can be shared, e.g e820 memory region removing, memblock region removing. > Otherwise, I can't see why a specific region excluding need a generic > region removing function. So where do we now stand on this patchset? Thanks.