On 2/13/23 10:33, Mathias Krause wrote:
Reshuffle the boolean members of struct kvm_queued_exception and make
them individual bits, allowing denser packing.
This allows us to shrink the object size from 24 to 16 bytes for 64 bit
builds.
Signed-off-by: Mathias Krause <minipli@xxxxxxxxxxxxxx>
---
arch/x86/include/asm/kvm_host.h | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/arch/x86/include/asm/kvm_host.h b/arch/x86/include/asm/kvm_host.h
index 43329c60a6b5..040eee3e9583 100644
--- a/arch/x86/include/asm/kvm_host.h
+++ b/arch/x86/include/asm/kvm_host.h
@@ -701,13 +701,13 @@ struct kvm_vcpu_xen {
};
struct kvm_queued_exception {
- bool pending;
- bool injected;
- bool has_error_code;
+ u8 pending : 1;
+ u8 injected : 1;
+ u8 has_error_code : 1;
+ u8 has_payload : 1;
I find doing something like this is clearer and easier to read:
u8 pending : 1,
injected : 1,
has_error_code : 1,
has_payload : 1,
__reserved : 4;
(you don't have to have the __reserved, though). Just throwing it out there.
Thanks,
Tom
u8 vector;
u32 error_code;
unsigned long payload;
- bool has_payload;
};
struct kvm_vcpu_arch {