diff mbox series

[v2,2/2] KVM: Shrink struct kvm_mmu_memory_cache

Message ID 20230217193336.15278-3-minipli@grsecurity.net (mailing list archive)
State New, archived
Headers show
Series KVM: Minor structure layout changes | expand

Commit Message

Mathias Krause Feb. 17, 2023, 7:33 p.m. UTC
Move the 'capacity' member around to make use of the padding hole on 64
bit systems instead of introducing yet another one.

This allows us to save 8 bytes per instance for 64 bit builds of which,
e.g., x86's struct kvm_vcpu_arch has a few.

Signed-off-by: Mathias Krause <minipli@grsecurity.net>
---
v2: use order as suggested by Sean

 include/linux/kvm_types.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Sean Christopherson March 17, 2023, 10:45 p.m. UTC | #1
On Fri, Feb 17, 2023, Mathias Krause wrote:
> Move the 'capacity' member around to make use of the padding hole on 64

Nit, 'nobjs' is the field that gets moved in this version.  No need for another
version, I can fix up when applying.

If no one objects, I'll plan on taking this through kvm-x86/generic.
Mathias Krause March 20, 2023, 9:37 p.m. UTC | #2
On 17.03.23 23:45, Sean Christopherson wrote:
> On Fri, Feb 17, 2023, Mathias Krause wrote:
>> Move the 'capacity' member around to make use of the padding hole on 64
> 
> Nit, 'nobjs' is the field that gets moved in this version.  No need for another
> version, I can fix up when applying.

Ahh, forgot to update the changelog after switching the layout. But as
it was 'nobjs' next to 'capacity' for both variants, I wrongly thought
there's no need to. But sure, you're right.

> 
> If no one objects, I'll plan on taking this through kvm-x86/generic.

Thanks,
Mathias
diff mbox series

Patch

diff --git a/include/linux/kvm_types.h b/include/linux/kvm_types.h
index 76de36e56cdf..0b2ddce47f11 100644
--- a/include/linux/kvm_types.h
+++ b/include/linux/kvm_types.h
@@ -91,11 +91,11 @@  struct gfn_to_pfn_cache {
  * is topped up (__kvm_mmu_topup_memory_cache()).
  */
 struct kvm_mmu_memory_cache {
-	int nobjs;
 	gfp_t gfp_zero;
 	gfp_t gfp_custom;
 	struct kmem_cache *kmem_cache;
 	int capacity;
+	int nobjs;
 	void **objects;
 };
 #endif