Received: by 2002:a05:7412:8d10:b0:f3:1519:9f41 with SMTP id bj16csp5058945rdb; Tue, 12 Dec 2023 18:48:16 -0800 (PST) X-Google-Smtp-Source: AGHT+IFB/8FQ1TcHpL8FsSThSaQy0JASoZ+2+nd1Z6o/wXniZVrUMAMIvBAPbAUA/fTyveNKXrKt X-Received: by 2002:a05:6e02:1544:b0:35f:6c6b:abd6 with SMTP id j4-20020a056e02154400b0035f6c6babd6mr1369351ilu.25.1702435696613; Tue, 12 Dec 2023 18:48:16 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702435696; cv=none; d=google.com; s=arc-20160816; b=YvFvVnQ5Mdb5fd9jJJXKops9bWqrCmlw86/LLCaSlpi41QJ5mpVJPhDPq3WqdBMTit Iq9TegvWl8gtEKevE7kG5+KpE6r3JfOCa7ztIljDVX4ISKpb8f2pI9AM+sRj4dTnFymM 0yUkeR1Hx6xNket21uctS5I8WUI3QNg/HqCYIi8OqpIXDZ3mECSu19UZLswbkepSw09Z GKLbD55C+vWEvN6JeBI9i9VmjiuHs3ksnKTQ+oAws+on2JM5v3aTls+1hsORHxN7u6rg 2lxGqammzpGrTXuPAxpVC1FUZrHX0mSSQCFcs5xFBw+4n5Baw0BC7VzEtmlLF0Pm7Ed5 HMYg== 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:dkim-signature; bh=dDe3Xx994EAr7fXMmd7lwT7nn7a4sVje/xUjU4I8WuA=; fh=B1KgcGtIm9vvIKNLApX9lJHp8u1yL0OX+sPe+qA8YAM=; b=wD4tVGrHJsVNIdMFVgSpUeYMxTQ4csIUtNtyxEtL7pYe+s8P/1BsKtkcvFmeWxUiMS IFvEMVarytYWkLNPSWEku4qd3xXTU5Sk5C0R3X10guQ6EC0lUvzfrWNjtlG+3Xbz4Brm kOgZLE+NkK2wontKLwdHySz0cD9paaTrZfEMxI8F3UjQOS8HmcPwTtXHddv6xXJaLBH3 Fa3fjdOwf3q81JbZDwVNjgRkGb83e+N4xCfvkuonYsYWzXmGGXab8ThexXjIViWsMMey PpVHk3UrPZ/Imzno0HU08JxqypO+4hO0bv06hoYjDakoo13tpY1R4x4G9MKSjBaa6CMn oLqw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=Ai45uxPp; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from morse.vger.email (morse.vger.email. [23.128.96.31]) by mx.google.com with ESMTPS id q6-20020a17090311c600b001bdd0d0530dsi8907503plh.129.2023.12.12.18.48.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Dec 2023 18:48:16 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 as permitted sender) client-ip=23.128.96.31; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=Ai45uxPp; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by morse.vger.email (Postfix) with ESMTP id 4A01781DE6B8; Tue, 12 Dec 2023 18:48:14 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at morse.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1378327AbjLMCsA (ORCPT + 99 others); Tue, 12 Dec 2023 21:48:00 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49506 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1378325AbjLMCr7 (ORCPT ); Tue, 12 Dec 2023 21:47:59 -0500 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B0DEBA6 for ; Tue, 12 Dec 2023 18:48:04 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1702435683; 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=dDe3Xx994EAr7fXMmd7lwT7nn7a4sVje/xUjU4I8WuA=; b=Ai45uxPpCRi6eKRxeB9qk24PNUHhqFo3cgyGYaSkIyJqxRMnjwtkDt56YZ9DDuu8DraxH9 qpS6pvRj1rhGIcKyVin5gUcFbmbaacERd8QF5DN6tdYGX0QikEPelizPlrowPS/fUocQ7j ebAgDiSLNETTuCmkHhA0JBlJMycc2dA= 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-252-MWXzzuQbPDKUI1J342W0UA-1; Tue, 12 Dec 2023 21:47:57 -0500 X-MC-Unique: MWXzzuQbPDKUI1J342W0UA-1 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (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 E6001185A781; Wed, 13 Dec 2023 02:47:56 +0000 (UTC) Received: from localhost (unknown [10.72.116.83]) by smtp.corp.redhat.com (Postfix) with ESMTPS id BBD285190; Wed, 13 Dec 2023 02:47:55 +0000 (UTC) Date: Wed, 13 Dec 2023 10:47:52 +0800 From: Baoquan He To: Yuntao Wang Cc: linux-kernel@vger.kernel.org, x86@kernel.org, Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , "H. Peter Anvin" , Bjorn Helgaas , Simon Horman , Andrew Morton Subject: Re: [PATCH] x86/kexec: Simplify the logic of mem_region_callback() Message-ID: References: <20231212150506.31711-1-ytcoode@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20231212150506.31711-1-ytcoode@gmail.com> X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.5 X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on morse.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (morse.vger.email [0.0.0.0]); Tue, 12 Dec 2023 18:48:14 -0800 (PST) On 12/12/23 at 11:05pm, Yuntao Wang wrote: > The expression `mstart + resource_size(res) - 1` is actually equivalent to > `res->end`, simplify the logic of this function to improve readability. > > Signed-off-by: Yuntao Wang > --- > arch/x86/kernel/machine_kexec_64.c | 7 ++----- > 1 file changed, 2 insertions(+), 5 deletions(-) LGTM, Acked-by: Baoquan He > > diff --git a/arch/x86/kernel/machine_kexec_64.c b/arch/x86/kernel/machine_kexec_64.c > index 1a3e2c05a8a5..6f8df998890e 100644 > --- a/arch/x86/kernel/machine_kexec_64.c > +++ b/arch/x86/kernel/machine_kexec_64.c > @@ -42,12 +42,9 @@ struct init_pgtable_data { > static int mem_region_callback(struct resource *res, void *arg) > { > struct init_pgtable_data *data = arg; > - unsigned long mstart, mend; > - > - mstart = res->start; > - mend = mstart + resource_size(res) - 1; > > - return kernel_ident_mapping_init(data->info, data->level4p, mstart, mend); > + return kernel_ident_mapping_init(data->info, data->level4p, > + res->start, res->end); > } > > static int > -- > 2.43.0 >