Received: by 2002:a05:7412:b995:b0:f9:9502:5bb8 with SMTP id it21csp6419256rdb; Tue, 2 Jan 2024 00:41:35 -0800 (PST) X-Google-Smtp-Source: AGHT+IHagrczDrI5tXSOTVXx1LfTYzN+zIbipBh6A09OnT/t27qHTImrPBHd2dbBsoHYgLprsWU6 X-Received: by 2002:a17:903:40c7:b0:1d4:1d61:a64c with SMTP id t7-20020a17090340c700b001d41d61a64cmr24413917pld.2.1704184895407; Tue, 02 Jan 2024 00:41:35 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1704184895; cv=none; d=google.com; s=arc-20160816; b=ROJDCDAmVGD2zb7J/bxnbHMwUrJ6+EQ04s5jsxuRkckwScfjfQYoacPgcHbIzv2upX vS/mTDwG5cI1i0pnRj287KT68mqmvEX0iAbLQqSLUnUzvBKvqBdGQ9X914I0qSM0UuTT U60vEeM37L/A1wEQ8ifMwfoLLm++4uUH9GaXTlMC4Z9h5umx1ieicNNnqqwP4FL1Ihno qaCtLQfDT2fAG0k/0nRYc+QA/7mjFHyOo0yIEx6J85lYIyKti0OZFuyfcLazfHSMG0xN 4vcpDU+YrgNeRuTQY0wYQTTNFZlZr+b+GICJOTjKA7NQC5iZxfx7wn7Y2HOANB0M27s3 lqJw== 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=9deNeZJNUQtUZJSaXTSS5TWxhTaiDOSx9nA+IbokTkw=; fh=lLsDotnAojzH/uEroBlinNqKY9yo5SLSj574nJGkrfM=; b=TjNyoyVOJk6g8b/n8O1vOL9JSp3hhetpcttf0wxdj2h4oSE9ANbHYXjBZDrfHcutn/ VV5W1dBpzJ/QvjPtEu1h3zHmfcYIm+vmJ06dFb4ux0aaIK7+cimhVYz7isGgr0imkluX et87iUrFT4VKAq89IUxy8tmWLB1kmH5URID24PjdLnzpuqmC81h/7E/VOkUKHt5XHSnu TtZo1Ctc04G6RvoZ6feOrBX1vYKWy6/EEFjaDJZbRDvYj0w2/LEefBi6jFkqh5ncvoVX c1M+m5NoN229GdzJsBdEB1lGPZeqNOhykU9M8AevS2NT0EkEFvZAlYmsNPokoFmAo8d7 W7xg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=JSz+CKa1; spf=pass (google.com: domain of linux-kernel+bounces-14152-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-14152-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id s19-20020a170902989300b001d4666effc8si12233038plp.188.2024.01.02.00.41.35 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 02 Jan 2024 00:41:35 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-14152-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=JSz+CKa1; spf=pass (google.com: domain of linux-kernel+bounces-14152-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-14152-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 sv.mirrors.kernel.org (Postfix) with ESMTPS id 14A97281F6A for ; Tue, 2 Jan 2024 08:41:35 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id D2EB4611E; Tue, 2 Jan 2024 08:41:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="JSz+CKa1" 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 545DC566B for ; Tue, 2 Jan 2024 08:41:27 +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=1704184886; 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=9deNeZJNUQtUZJSaXTSS5TWxhTaiDOSx9nA+IbokTkw=; b=JSz+CKa1SMpYiK2DT1syCeZwpHGJiGYt/5r9WN9HVTPWAGgpyUC26vaU51SIuAijIDN39F hhRLmTy0q2AFstmJUAX4GneZGtkIFBVlQo69lE12OiK+aEBgeeuK8wd5my7XyjDx3YUoFw /EDOSLMWWw7SEgSEGFZWyXddpdY4tXU= 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-633-v1563Ci_PTOWBkrNbLVl9Q-1; Tue, 02 Jan 2024 03:41:23 -0500 X-MC-Unique: v1563Ci_PTOWBkrNbLVl9Q-1 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (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 42B8A80BEC1; Tue, 2 Jan 2024 08:41:22 +0000 (UTC) Received: from localhost (unknown [10.72.116.129]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 796031121306; Tue, 2 Jan 2024 08:41:20 +0000 (UTC) Date: Tue, 2 Jan 2024 16:41:17 +0800 From: Baoquan He To: Yuntao Wang Cc: Andrew Morton , 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: X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.3 Hi Yuntao, On 12/30/23 at 06:16pm, Baoquan He wrote: > 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 Can you repost this patchset with some updating, e.g adding ack in patch 1 and 2, and squash below patch into patch 3? This will be easier for patch merging. [PATCH] crash_core: optimize crash_exclude_mem_range() https://lore.kernel.org/all/20231219163418.108591-1-ytcoode@gmail.com/T/#u And, you may need to drop below patchset since patch 2 conflicts with this patchset, and patch 1 is conflicting with fuqiang's patch. [PATCH 0/2] crash: fix potential cmem->ranges array overflow Thanks Baoquan