Received: from eggs.gnu.org ([2001:4830:134:3::10]:42470) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1a99oY-00052b-NO for qemu-devel@nongnu.org; Wed, 16 Dec 2015 06:00:11 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1a99oX-0003YI-TI for qemu-devel@nongnu.org; Wed, 16 Dec 2015 06:00:10 -0500 Received: from mail-wm0-x230.google.com ([2a00:1450:400c:c09::230]:37489) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1a99oX-0003Y5-OB for qemu-devel@nongnu.org; Wed, 16 Dec 2015 06:00:09 -0500 Received: by mail-wm0-x230.google.com with SMTP id n186so65443766wmn.0 for ; Wed, 16 Dec 2015 03:00:09 -0800 (PST) Sender: Paolo Bonzini From: Paolo Bonzini Date: Wed, 16 Dec 2015 11:59:55 +0100 Message-Id: <1450263601-2828-4-git-send-email-pbonzini@redhat.com> In-Reply-To: <1450263601-2828-1-git-send-email-pbonzini@redhat.com> References: <1450263601-2828-1-git-send-email-pbonzini@redhat.com> Subject: [Qemu-devel] [PATCH 3/8] memory: reorder MemoryRegion fields List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: v.maffione@gmail.com Order fields so that all fields accessed during a RAM read/write fit in the same cache line. Signed-off-by: Paolo Bonzini --- include/exec/memory.h | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/include/exec/memory.h b/include/exec/memory.h index 9bbd247..5b1fd12 100644 --- a/include/exec/memory.h +++ b/include/exec/memory.h @@ -159,27 +159,32 @@ typedef struct MemoryRegionIoeventfd MemoryRegionIoeventfd; struct MemoryRegion { Object parent_obj; + /* All fields are private - violators will be prosecuted */ - const MemoryRegionOps *ops; + + /* The following fields should fit in a cache line */ + bool romd_mode; + bool ram; + bool subpage; + bool readonly; /* For RAM regions */ + bool rom_device; + bool flush_coalesced_mmio; + bool global_locking; + uint8_t dirty_log_mask; + ram_addr_t ram_addr; const MemoryRegionIOMMUOps *iommu_ops; + + const MemoryRegionOps *ops; void *opaque; MemoryRegion *container; Int128 size; hwaddr addr; void (*destructor)(MemoryRegion *mr); - ram_addr_t ram_addr; uint64_t align; - bool subpage; bool terminates; - bool romd_mode; - bool ram; bool skip_dump; - bool readonly; /* For RAM regions */ bool enabled; - bool rom_device; bool warning_printed; /* For reservations */ - bool flush_coalesced_mmio; - bool global_locking; uint8_t vga_logging_count; MemoryRegion *alias; hwaddr alias_offset; @@ -189,7 +194,6 @@ struct MemoryRegion { QTAILQ_ENTRY(MemoryRegion) subregions_link; QTAILQ_HEAD(coalesced_ranges, CoalescedMemoryRange) coalesced; const char *name; - uint8_t dirty_log_mask; unsigned ioeventfd_nb; MemoryRegionIoeventfd *ioeventfds; NotifierList iommu_notify; -- 2.5.0