All of lore.kernel.org
 help / color / mirror / Atom feed
* [Question] How we make fields of a structure fit in a cache line?
@ 2020-12-11 14:33 liqiuhao
  0 siblings, 0 replies; only message in thread
From: liqiuhao @ 2020-12-11 14:33 UTC (permalink / raw)
  To: qemu-devel

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.




^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2020-12-11 15:21 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-12-11 14:33 [Question] How we make fields of a structure fit in a cache line? liqiuhao

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.