[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Question] How we make fields of a structure fit in a cache line?
From: |
liqiuhao |
Subject: |
[Question] How we make fields of a structure fit in a cache line? |
Date: |
Fri, 11 Dec 2020 22:33:18 +0800 |
User-agent: |
Evolution 3.36.4-0ubuntu1 |
Hi,
While learning QEMU, I notice that some fields of structures are
comment with "should fit in a cache line." For instance, the
MemoryRegion is defined as:
struct MemoryRegion {
Object parent_obj;
/* private: */
/* The following fields should fit in a cache line */
bool romd_mode;
bool ram;
/* ... */
I know we can get better memory performance if their size can fit in a
cache line, but doesn't it would do so only if they aligned adequately
on an address that's a multiple of 64? Do we make sure most uses of
those structures are aligned, or I misunderstood something?
Thanks.
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Question] How we make fields of a structure fit in a cache line?,
liqiuhao <=