From mboxrd@z Thu Jan 1 00:00:00 1970 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) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux-foundation.org header.i=@linux-foundation.org header.b="nzFmDpWG" 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.