Received: by 2002:a05:7412:8d10:b0:f3:1519:9f41 with SMTP id bj16csp4699364rdb; Tue, 12 Dec 2023 07:06:13 -0800 (PST) X-Google-Smtp-Source: AGHT+IElJq8+IcmPBBS+E6pfiBF4Bd4Hto2L/yh8JtAe03Lz2YmURiN5e8fnLxdsQBkEgNJSwiOC X-Received: by 2002:a05:6a00:2451:b0:6ce:4010:d206 with SMTP id d17-20020a056a00245100b006ce4010d206mr2992164pfj.20.1702393573151; Tue, 12 Dec 2023 07:06:13 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702393573; cv=none; d=google.com; s=arc-20160816; b=vw2NrS6lZu/n/ak+F+nrkZzIGZ83qCuqyQclrtJxxeLvpEJz4/RocyfTtqcWRZPVba IFmetIiJtKTIe+9Z9LDSfzJRpSoY80ShEGfDwv3q9yFAUgcUG6TgSgZPYyrYSgsHk9s4 6PEMmU3tEXPYMm5mC56PNzpCRRFlJe/xN2pDG5Df99bO5mVsrPrCOt0NEpZccA7PCXrk 3k5d0zXeFQYG6eFy6Er7/1l7trNoVCZz8FKHgPUINKb8SZvRIX8qKpD9lD2A83GSkBUn NrwswqiRnTCF+Xq5ax7lH4gMTLRlII5XAU0MytN5+5bLhbUtMHcVhZmPjGCE7yreysaG vhzA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=3txP48XMkWU7VdifF1r+KohcEJ8EmE42oAUbDKnZrMo=; fh=Uuz3WXC1xC7kp6ccKfZGHCAB8kFReq2NYA0u9jiqGt4=; b=MPLiwOU/+eia0SG4YTMhZ8LPq55LS7klwXsvO84Dvhzho2iv1wXYdx3/lkYzNjn4YP MtgveoMRljWk2Wnt++9c83WcQQl8ZNL0snD1VAlc26Xa6ZDwzy21eUm807ve0IwcPg/N +KSK5VZdEfnzfrCIT/I1y4ko14R99+7HninNRdKrtnvd1LJlaDQQF+ZCC46OfA+KwE/8 RiaUiZde18cslXOL4NYHA9SPkCSJSgBeG5vtncXv4QI1isSF2MqKtTfEdR0nerjnfbV/ 9k6xLEUR3rVleEUz1lbOmdMBmSTKfSaKb8SR/6e5ftNe8pXrnhXPqMRkhNVIvkXMe/IX RjAg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=i2itJ4T5; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from agentk.vger.email (agentk.vger.email. [23.128.96.32]) by mx.google.com with ESMTPS id x20-20020a631714000000b005c6b59c91bcsi7873473pgl.651.2023.12.12.07.06.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Dec 2023 07:06:13 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) client-ip=23.128.96.32; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=i2itJ4T5; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by agentk.vger.email (Postfix) with ESMTP id 0CC2A80A32F8; Tue, 12 Dec 2023 07:06:04 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at agentk.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1376318AbjLLPFu (ORCPT + 99 others); Tue, 12 Dec 2023 10:05:50 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55074 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232716AbjLLPFt (ORCPT ); Tue, 12 Dec 2023 10:05:49 -0500 Received: from mail-pj1-x1032.google.com (mail-pj1-x1032.google.com [IPv6:2607:f8b0:4864:20::1032]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 53AE8DB for ; Tue, 12 Dec 2023 07:05:55 -0800 (PST) Received: by mail-pj1-x1032.google.com with SMTP id 98e67ed59e1d1-2866fe08b32so3992231a91.2 for ; Tue, 12 Dec 2023 07:05:55 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1702393554; x=1702998354; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=3txP48XMkWU7VdifF1r+KohcEJ8EmE42oAUbDKnZrMo=; b=i2itJ4T5uborrMbjtJtD+rnhEgZm1WNVg6vpVm0c6VzlAU/sdxcW5kVX5yx+5x3Gp8 VffOaMu/lsak4A4KSjtFjwsNfTTzqv8kGRtYsOkj5sKo2uA7PjqNq/xM36fZSMjdK4rg GN5AjkzVIE+j5gElLUgpp2U+fNh6cHQeOiHdkAec4+X8oI/uLG0IybpQ257F3/lKKBan Bfxr8lFA0CXH+CVu/GI6b88ofCd9uJkA8XSVuHHwneRKAKZylacYxAE8/cOF5Ftc782d KZJnpsqQ8n/USs9C/Po20xNyPwCMRkommD2+FvEymqKmM57xUu/uq4O7Yb5mxKjO2xrt ZYbg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1702393554; x=1702998354; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=3txP48XMkWU7VdifF1r+KohcEJ8EmE42oAUbDKnZrMo=; b=wIrSI7giNtsK5uttk5drRs7JiII/8DiW8dtPRXuaMCRcZbYS0rAGglywk+VeCjh8m4 zUOpAiZ7WxZLf45WLrGLKKa++0W6l4gDU+k4iDQ+HUSXzMGjaRiXa6V3nihkrWEh3QOi DonWkgkjgMai3jR1efLBAQOBRZqWJ23YPfoBfjGKFtg18I0/i9BwE6CsxjUHlLkKtERW TgNZR6MUxEDW6mNcx59mL+f4A45pjZli0L5+bhKwz4OcD6ZqA06kvHJzzxZsPUHAMDvq F1DqiNwrjXHp1SQsKemZsIbT/xhBtL/p/gL1EL5cC272cE1kOQK9ov2+hQErM5gaYfXD 63jA== X-Gm-Message-State: AOJu0Ywczf2hXt4g2gEmdnQat6zGfwOOEKsfs6zzEbNc+RLlaj4ufX7H KGaM0wzntJ0fFvfsltw2Do2ERLhpwcY= X-Received: by 2002:a17:90a:c58d:b0:28a:b5e0:b569 with SMTP id l13-20020a17090ac58d00b0028ab5e0b569mr827977pjt.37.1702393554470; Tue, 12 Dec 2023 07:05:54 -0800 (PST) Received: from code.. ([144.202.108.46]) by smtp.gmail.com with ESMTPSA id pb17-20020a17090b3c1100b00286ed94466dsm9188599pjb.32.2023.12.12.07.05.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Dec 2023 07:05:54 -0800 (PST) From: Yuntao Wang To: linux-kernel@vger.kernel.org, x86@kernel.org Cc: Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , "H. Peter Anvin" , Baoquan He , Bjorn Helgaas , Simon Horman , Andrew Morton , Yuntao Wang Subject: [PATCH] x86/kexec: Simplify the logic of mem_region_callback() Date: Tue, 12 Dec 2023 23:05:06 +0800 Message-ID: <20231212150506.31711-1-ytcoode@gmail.com> X-Mailer: git-send-email 2.43.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-0.6 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, 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 agentk.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 (agentk.vger.email [0.0.0.0]); Tue, 12 Dec 2023 07:06:04 -0800 (PST) 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(-) 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