* [PATCH] KVM: Reorder fields in 'struct kvm_mmu_memory_cache'
@ 2023-02-17 8:01 Christophe JAILLET
2023-02-17 16:41 ` Sean Christopherson
0 siblings, 1 reply; 4+ messages in thread
From: Christophe JAILLET @ 2023-02-17 8:01 UTC (permalink / raw)
To: Paolo Bonzini; +Cc: linux-kernel, kernel-janitors, Christophe JAILLET, kvm
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(-)
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
--
2.34.1
^ permalink raw reply related [flat|nested] 4+ messages in thread* Re: [PATCH] KVM: Reorder fields in 'struct kvm_mmu_memory_cache'
2023-02-17 8:01 [PATCH] KVM: Reorder fields in 'struct kvm_mmu_memory_cache' Christophe JAILLET
@ 2023-02-17 16:41 ` Sean Christopherson
2023-02-17 19:22 ` Christophe JAILLET
2023-02-17 19:33 ` Mathias Krause
0 siblings, 2 replies; 4+ messages in thread
From: Sean Christopherson @ 2023-02-17 16:41 UTC (permalink / raw)
To: Christophe JAILLET
Cc: Paolo Bonzini, linux-kernel, kernel-janitors, kvm, Mathias Krause
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
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] KVM: Reorder fields in 'struct kvm_mmu_memory_cache'
2023-02-17 16:41 ` Sean Christopherson
@ 2023-02-17 19:22 ` Christophe JAILLET
2023-02-17 19:33 ` Mathias Krause
1 sibling, 0 replies; 4+ messages in thread
From: Christophe JAILLET @ 2023-02-17 19:22 UTC (permalink / raw)
To: Sean Christopherson
Cc: Paolo Bonzini, linux-kernel, kernel-janitors, kvm, Mathias Krause
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
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] KVM: Reorder fields in 'struct kvm_mmu_memory_cache'
2023-02-17 16:41 ` Sean Christopherson
2023-02-17 19:22 ` Christophe JAILLET
@ 2023-02-17 19:33 ` Mathias Krause
1 sibling, 0 replies; 4+ messages in thread
From: Mathias Krause @ 2023-02-17 19:33 UTC (permalink / raw)
To: Sean Christopherson, Christophe JAILLET
Cc: Paolo Bonzini, linux-kernel, kernel-janitors, kvm
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
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2023-02-17 19:33 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-02-17 8:01 [PATCH] KVM: Reorder fields in 'struct kvm_mmu_memory_cache' Christophe JAILLET
2023-02-17 16:41 ` Sean Christopherson
2023-02-17 19:22 ` Christophe JAILLET
2023-02-17 19:33 ` Mathias Krause
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox