From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-26.3 required=3.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, USER_AGENT_GIT,USER_IN_DEF_DKIM_WL autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 88215C432BE for ; Wed, 1 Sep 2021 22:10:38 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 72D4B61075 for ; Wed, 1 Sep 2021 22:10:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344950AbhIAWLc (ORCPT ); Wed, 1 Sep 2021 18:11:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52834 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344171AbhIAWL3 (ORCPT ); Wed, 1 Sep 2021 18:11:29 -0400 Received: from mail-qv1-xf49.google.com (mail-qv1-xf49.google.com [IPv6:2607:f8b0:4864:20::f49]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B3743C061760 for ; Wed, 1 Sep 2021 15:10:31 -0700 (PDT) Received: by mail-qv1-xf49.google.com with SMTP id et12-20020a056214176c00b0037279a2ce4cso24200qvb.13 for ; Wed, 01 Sep 2021 15:10:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=reply-to:date:in-reply-to:message-id:mime-version:references :subject:from:to:cc; bh=ijYiSiDDUHb3AX8DewnNIKO+XanSVwO3pukxO/BIptQ=; b=PIaib/UOcr8eqZtZtxH8TsMegPAAIPuTuFSHWDsKDNgXUi7HFb111cDWFixwg+vn1J yH74Vi9zPrwcpnOM43NTlCWphRUYs+X/VVstAxnZiwKv4NsgZfd9xfyjSJC3BVWcNh/U noBXYMev1g/hIMm/41n9iutstqp5C2xv5Wghy3hlSw4LTKbPGzKVcc9BZFoa0m/SHIoc 12G6Qcgpj3u+u98e9mxUxsv+OROUxDU66XjMab7LzGXJTM8BjftTDUTVC8G1PjwQu9MO oSAGWoQG7lJ6bdQai/CvUlZ4DeUvaSmXE4XBWesj8P8Pq94P0rJcROPOyrFQDKFhqvXC zEVA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:reply-to:date:in-reply-to:message-id :mime-version:references:subject:from:to:cc; bh=ijYiSiDDUHb3AX8DewnNIKO+XanSVwO3pukxO/BIptQ=; b=rjYzoiEnafR/uH1wEMQWY+ZQ14st/pl67Ri7fiHPGkcQVW6bBZUwVBrj2UVUFQwtnZ a2BmBQ3fQ1tQQ48ZA8qCiAkAEowiem/NNYhl852cYCwZ8okDBu3FkQyQETSv5l2t/lA6 dOEoobbIeA3rbl4OYe+UxVStSAIpS4HabOMJi7NVOZZpPdBIyirwKxrNTwX0lBGOHPka ix52Kai4gD8O85moI1LQ/voCH+6Uqsd5TIUZASyu4RMBPfGsw8Ngq+FnAcYUGd0yvt5A BLYjEWEYQvu/aLSylHpfDj36ID5/+SGfV6rhHW884pS2Mv5u4TNgwcWDMqxnvO8zEdtU oz6Q== X-Gm-Message-State: AOAM530f2FDLT/1RX6n34aUYalCIVbBAgSjGrNZMhgSKfjxO9dEPPKFS eEj23hVjCqnA36+fYX3ADSIhcTnyDj0= X-Google-Smtp-Source: ABdhPJwhT9bVSOgLzaDSDP/gOkZ1+NUgU5lq9FeD0s0kVgkw4RiNzBPbJEp0bal8001VwUfDiAQcmnRMmgM= X-Received: from seanjc798194.pdx.corp.google.com ([2620:15c:90:200:9935:5a5e:c7b6:e649]) (user=seanjc job=sendgmr) by 2002:a0c:e910:: with SMTP id a16mr1602642qvo.37.1630534230980; Wed, 01 Sep 2021 15:10:30 -0700 (PDT) Reply-To: Sean Christopherson Date: Wed, 1 Sep 2021 15:10:22 -0700 In-Reply-To: <20210901221023.1303578-1-seanjc@google.com> Message-Id: <20210901221023.1303578-3-seanjc@google.com> Mime-Version: 1.0 References: <20210901221023.1303578-1-seanjc@google.com> X-Mailer: git-send-email 2.33.0.153.gba50c8fa24-goog Subject: [PATCH 2/3] KVM: x86/mmu: Relocate kvm_mmu_page.tdp_mmu_page for better cache locality From: Sean Christopherson To: Paolo Bonzini Cc: Sean Christopherson , Vitaly Kuznetsov , Wanpeng Li , Jim Mattson , Joerg Roedel , kvm@vger.kernel.org, linux-kernel@vger.kernel.org, Jia He Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Move "tdp_mmu_page" into the 1-byte void left by the recently removed "mmio_cached" so that it resides in the first 64 bytes of kvm_mmu_page, i.e. in the same cache line as the most commonly accessed fields. Don't bother wrapping tdp_mmu_page in CONFIG_X86_64, including the field in 32-bit builds doesn't affect the size of kvm_mmu_page, and a future patch can always wrap the field in the unlikely event KVM gains a 1-byte flag that is 32-bit specific. Note, the size of kvm_mmu_page is also unchanged on CONFIG_X86_64=y due to it previously sharing an 8-byte chunk with write_flooding_count. No functional change intended. Signed-off-by: Sean Christopherson --- arch/x86/kvm/mmu/mmu_internal.h | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/arch/x86/kvm/mmu/mmu_internal.h b/arch/x86/kvm/mmu/mmu_internal.h index 9bfa46b35201..4b06e6040e90 100644 --- a/arch/x86/kvm/mmu/mmu_internal.h +++ b/arch/x86/kvm/mmu/mmu_internal.h @@ -35,6 +35,7 @@ struct kvm_mmu_page { struct hlist_node hash_link; struct list_head lpage_disallowed_link; + bool tdp_mmu_page; bool unsync; u8 mmu_valid_gen; bool lpage_disallowed; /* Can't be replaced by an equiv large page */ @@ -70,8 +71,6 @@ struct kvm_mmu_page { atomic_t write_flooding_count; #ifdef CONFIG_X86_64 - bool tdp_mmu_page; - /* Used for freeing the page asynchronously if it is a TDP MMU page. */ struct rcu_head rcu_head; #endif -- 2.33.0.153.gba50c8fa24-goog