Received: by 2002:a05:7412:b995:b0:f9:9502:5bb8 with SMTP id it21csp5015603rdb; Sat, 30 Dec 2023 02:16:55 -0800 (PST) X-Google-Smtp-Source: AGHT+IFh/E6HsR3AsYWABHCKme4Szot5Z9AUgh8LBhXPiX472iM1HDLJNPe26bxdZO1Tn4xCvpb0 X-Received: by 2002:ac8:580c:0:b0:427:f936:4d27 with SMTP id g12-20020ac8580c000000b00427f9364d27mr4214201qtg.100.1703931415054; Sat, 30 Dec 2023 02:16:55 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1703931415; cv=none; d=google.com; s=arc-20160816; b=fAb/IPkJumR0Q3bB7WRm4oL9tI69JHBL0ys9D6Uw3NgJ/ziyyoudy8+r0mIYS/jDWg lfKElAL3NAzQdT6z+G6I/hwHEtLCr9eDwfS8hDY8BsnecirF1m2aIwmtpmyBuQI9W4sj Gt24dzV4EC5AwJ6EMkcqMHfJn7/S0+jOa7C+xUwDpD0rCjM2EPr2wRdqnvvg28KBuUVh CABwF2/OGkFj+PnjgjuYlXJqSZ9bWSw4GAmkfClJuNpOFWp++erjfL57wViUY70n9etQ 9A96wVGhW7e71ljDgNU1SfCzwBmwDbLk3G0dyIFpimLN92Xc77cMGKppBAwWOINhI2ku XvdA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date:dkim-signature; bh=8Ah+0r8YHHWoN4cbO1+eIvu2p9Fc5rhLuP9mStoN/2M=; fh=wmOAqKphdfGBDLLJzT1EgxRmcdu53Mf2EIZXvA0562A=; b=gWOTtuc5XiWDagQtXRfByH5l6OA7prFXckBApEnf2f9U0nlr0u9rUahzQzSxoh0wjX cpuCXPgrfckeAFBOISWfx5HygJEBHyYTC1Ec7X+0Zv2MbkQcsnxTF/UEJYRngdb/TKfC tzpMf7Uqk4g0oGa6SEPom1zcq+nuFtCr4K196KTLE+1Uhj4ZJ4/hw0sm55BnyG2sDWd5 rZxF/u6B/n5mXJiHN39fc6RlOXGxUqlFEvyhwBRf0pZ7vZeD2t0X8OmIm141WKJ39Lt2 7ZEaIdnvP29IHE5rZbzRVEi1RfmcG5TAeWb0Cp81UbzkLcqpL728QX0UHIn/fr/OwwpL yo7A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=hLbnTDNc; spf=pass (google.com: domain of linux-kernel+bounces-13385-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-13385-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id a9-20020a05622a02c900b00427edcb92f4si7579689qtx.696.2023.12.30.02.16.54 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 30 Dec 2023 02:16:55 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-13385-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=hLbnTDNc; spf=pass (google.com: domain of linux-kernel+bounces-13385-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-13385-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com 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 ny.mirrors.kernel.org (Postfix) with ESMTPS id C54891C20C3E for ; Sat, 30 Dec 2023 10:16:54 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id BF82623CF; Sat, 30 Dec 2023 10:16:48 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="hLbnTDNc" X-Original-To: linux-kernel@vger.kernel.org Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (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 563D5210A for ; Sat, 30 Dec 2023 10:16:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1703931405; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=8Ah+0r8YHHWoN4cbO1+eIvu2p9Fc5rhLuP9mStoN/2M=; b=hLbnTDNcSQolOZ7Ls+ZKd5vsbZrrVUXQVElr9ke6M/4mrgLaL22adPOFLMjhhDMMFgZsar Qq48Ml061BXDGiZPdZwxTbMr35+NGrFBkYDAL0vR0W3OUvLJu4hA6/6Zxs96wS0HO/HYoh smS7q4xeLOSO+wdRyqzFWrzV/rpnqnE= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-643-pItFQRRhNh-h7l-uP85TvQ-1; Sat, 30 Dec 2023 05:16:41 -0500 X-MC-Unique: pItFQRRhNh-h7l-uP85TvQ-1 Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.rdu2.redhat.com [10.11.54.9]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id C169583F265; Sat, 30 Dec 2023 10:16:40 +0000 (UTC) Received: from localhost (unknown [10.72.112.216]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 96676492BC8; Sat, 30 Dec 2023 10:16:39 +0000 (UTC) Date: Sat, 30 Dec 2023 18:16:36 +0800 From: Baoquan He To: Andrew Morton 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: References: <20231216015410.188924-1-ytcoode@gmail.com> <20231229121052.cac37914c7a051b829fcf933@linux-foundation.org> 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-Disposition: inline In-Reply-To: <20231229121052.cac37914c7a051b829fcf933@linux-foundation.org> X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.9 On 12/29/23 at 12:10pm, Andrew Morton wrote: > 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? The patch 1 and 2 are good clean up. The patch 3 plus below one, the entire is a good code improvement patch. [PATCH] crash_core: optimize crash_exclude_mem_range() https://lore.kernel.org/all/20231219163418.108591-1-ytcoode@gmail.com/T/#u