From patchwork Fri Feb 17 08:01:38 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christophe JAILLET X-Patchwork-Id: 58402 Return-Path: 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 + 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 ); 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 ; 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 To: Paolo Bonzini Cc: linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org, Christophe JAILLET , 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: X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 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: 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?= 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 --- 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(-) 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