Message ID | f9423a6ee10d91bd6bad32beefd1b96cad4d28f1.1676620879.git.christophe.jaillet@wanadoo.fr |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp758980wrn; Fri, 17 Feb 2023 00:03:18 -0800 (PST) X-Google-Smtp-Source: AK7set8+zgyVvkkLCpXWg5eR5aTxPxpKSKOzoZH9ahrtnE4c8lmp4lAYgM8WgIqn0t5yRSf4yS4u X-Received: by 2002:a05:6a20:840c:b0:c7:1f31:8792 with SMTP id c12-20020a056a20840c00b000c71f318792mr6820745pzd.7.1676620998155; Fri, 17 Feb 2023 00:03:18 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1676620998; cv=none; d=google.com; s=arc-20160816; b=EgdsNVtIg0YiKStTKKk9H0OX/qGq6DpLlrV1H/44RVWiF5idG/dQy9xfbZe5+E0skE STBryoTkhasb040FDBgCLyZD0SVOKzONI0id6W8VcF0SsPKwFQ3wao4EMODDwBsjxWeo 0LneICAsvcct8djga+7tXVYdwqOeUshb6UzXbBparzTKhwXCcXdF8LIJLXbdIcgV+m8t znCgF4hQJ3o7woHloMm3lterJff9TBftUmgzv+nXk667Kyi4cGYwZZAOUAjHyBJRbCCL o1SvVRPPSyYPIJ9iTSf44G6cchfCn5hIZIbL1r8S/YoDa7c7LEx2jyd+EeO6vwpIncyd Q/EA== 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; bh=q6SDGsDhNljf+WVhCR603D19iscI08ipdVNt2kWc3DY=; b=AiuFAl13Q6Vmsx/Rl7P2QDG8Os1L4zw7ZPHMMtNjmHor/C1W09fuTniy3+KTxkdwZh vOhx3BB9yAuuzKZUZqGmINrgXkCSMWSkHVXD9tAsh+l38oCjlqRKoMey1Z7CmxzCqqvv 1uL6RjdmW9rbwRkR59DVhe5TWAcbmIn2AElVurJTsrsa9YIv+yQLdFnOS2Y7EXAMsGQZ jpeU5QtkpCf8/JZVT4p+rUv2DOmyS3rs9LtPMaDNQCoRqTrqjwatwMsoE7FnGiydQ/Zc tMtrcPvXdHjCRYZu4v7b/t27gkVy8DL6QcGgEFP7U5PQuW4yg1BzubCcbvPjeW7lplu6 WlAQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id 19-20020a630213000000b004fbd79d66c9si4336282pgc.23.2023.02.17.00.03.05; Fri, 17 Feb 2023 00:03:18 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229576AbjBQICx (ORCPT <rfc822;aimixsaka@gmail.com> + 99 others); Fri, 17 Feb 2023 03:02:53 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38354 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229496AbjBQICv (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Fri, 17 Feb 2023 03:02:51 -0500 Received: from smtp.smtpout.orange.fr (smtp-15.smtpout.orange.fr [80.12.242.15]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 03CAE5E5A8 for <linux-kernel@vger.kernel.org>; Fri, 17 Feb 2023 00:01:58 -0800 (PST) Received: from pop-os.home ([86.243.2.178]) by smtp.orange.fr with ESMTPA id SvggpHzY6ReC5Svghp1MLD; Fri, 17 Feb 2023 09:01:47 +0100 X-ME-Helo: pop-os.home X-ME-Auth: Y2hyaXN0b3BoZS5qYWlsbGV0QHdhbmFkb28uZnI= X-ME-Date: Fri, 17 Feb 2023 09:01:47 +0100 X-ME-IP: 86.243.2.178 From: Christophe JAILLET <christophe.jaillet@wanadoo.fr> To: Paolo Bonzini <pbonzini@redhat.com> Cc: linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org, Christophe JAILLET <christophe.jaillet@wanadoo.fr>, kvm@vger.kernel.org Subject: [PATCH] KVM: Reorder fields in 'struct kvm_mmu_memory_cache' Date: Fri, 17 Feb 2023 09:01:38 +0100 Message-Id: <f9423a6ee10d91bd6bad32beefd1b96cad4d28f1.1676620879.git.christophe.jaillet@wanadoo.fr> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-0.6 required=5.0 tests=BAYES_00, RCVD_IN_BL_SPAMCOP_NET,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2, SPF_HELO_PASS,SPF_PASS autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1758064539454895791?= X-GMAIL-MSGID: =?utf-8?q?1758064539454895791?= |
Series |
KVM: Reorder fields in 'struct kvm_mmu_memory_cache'
|
|
Commit Message
Christophe JAILLET
Feb. 17, 2023, 8:01 a.m. UTC
Group some variables based on their sizes to reduce hole and avoid padding.
On x86_64, this shrinks the size from 40 to 32 bytes.
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
---
Using pahole
Before:
======
struct kvm_mmu_memory_cache {
int nobjs; /* 0 4 */
gfp_t gfp_zero; /* 4 4 */
gfp_t gfp_custom; /* 8 4 */
/* XXX 4 bytes hole, try to pack */
struct kmem_cache * kmem_cache; /* 16 8 */
int capacity; /* 24 4 */
/* XXX 4 bytes hole, try to pack */
void * * objects; /* 32 8 */
/* size: 40, cachelines: 1, members: 6 */
/* sum members: 32, holes: 2, sum holes: 8 */
/* last cacheline: 40 bytes */
};
---
include/linux/kvm_types.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
Comments
On Fri, Feb 17, 2023, Christophe JAILLET wrote: > Group some variables based on their sizes to reduce hole and avoid padding. > On x86_64, this shrinks the size from 40 to 32 bytes. Heh, a hair too late[*]. Unless I'm mistaken, Mathias will be sending a new version in the not-too-distant future. Thanks! [*] https://lore.kernel.org/all/Y+puefrgtqf430fs@google.com
Le 17/02/2023 à 17:41, Sean Christopherson a écrit : > On Fri, Feb 17, 2023, Christophe JAILLET wrote: >> Group some variables based on their sizes to reduce hole and avoid padding. >> On x86_64, this shrinks the size from 40 to 32 bytes. > > Heh, a hair too late[*]. Unless I'm mistaken, Mathias will be sending a new > version in the not-too-distant future. > > Thanks! > > [*] https://lore.kernel.org/all/Y+puefrgtqf430fs@google.com > Ok, great :) Thanks for the feed-back. CJ
On 17.02.23 17:41, Sean Christopherson wrote: > On Fri, Feb 17, 2023, Christophe JAILLET wrote: >> Group some variables based on their sizes to reduce hole and avoid padding. >> On x86_64, this shrinks the size from 40 to 32 bytes. > > Heh, a hair too late[*]. Unless I'm mistaken, Mathias will be sending a new > version in the not-too-distant future. Jepp, patches should appear here anytime soon: https://lore.kernel.org/kvm/20230217193336.15278-1-minipli@grsecurity.net > > Thanks! > > [*] https://lore.kernel.org/all/Y+puefrgtqf430fs@google.com
diff --git a/include/linux/kvm_types.h b/include/linux/kvm_types.h index 2728d49bbdf6..76af8425dbc6 100644 --- a/include/linux/kvm_types.h +++ b/include/linux/kvm_types.h @@ -94,8 +94,8 @@ struct kvm_mmu_memory_cache { int nobjs; gfp_t gfp_zero; gfp_t gfp_custom; - struct kmem_cache *kmem_cache; int capacity; + struct kmem_cache *kmem_cache; void **objects; }; #endif