
When there are more nodes than available memory to put the minimum allowed memory by node, all the memory is put on the last node. This is because we put (ram_size / nb_numa_nodes) & ~((1 << mc->numa_mem_align_shift) - 1); on each node, and in this case the value is 0. This is particularly true with pseries, as the memory must be aligned to 256MB. To avoid this problem, this patch uses an error diffusion algorithm [1] to distribute equally the memory on nodes. We introduce numa_auto_assign_ram() function in MachineClass to keep compatibility between machine type versions. The legacy function is used with pseries-2.9, pc-q35-2.9 and pc-i440fx-2.9 (and previous), the new one with all others. Example: qemu-system-ppc64 -S -nographic -nodefaults -monitor stdio -m 1G -smp 8 \ -numa node -numa node -numa node \ -numa node -numa node -numa node Before: (qemu) info numa 6 nodes node 0 cpus: 0 6 node 0 size: 0 MB node 1 cpus: 1 7 node 1 size: 0 MB node 2 cpus: 2 node 2 size: 0 MB node 3 cpus: 3 node 3 size: 0 MB node 4 cpus: 4 node 4 size: 0 MB node 5 cpus: 5 node 5 size: 1024 MB After: (qemu) info numa 6 nodes node 0 cpus: 0 6 node 0 size: 0 MB node 1 cpus: 1 7 node 1 size: 256 MB node 2 cpus: 2 node 2 size: 0 MB node 3 cpus: 3 node 3 size: 256 MB node 4 cpus: 4 node 4 size: 256 MB node 5 cpus: 5 node 5 size: 256 MB [1] https://en.wikipedia.org/wiki/Error_diffusion Signed-off-by: Laurent Vivier <lvivier@redhat.com> Message-Id: <20170502162955.1610-2-lvivier@redhat.com> Reviewed-by: Eduardo Habkost <ehabkost@redhat.com> [ehabkost: s/ram_size/size/ at numa_default_auto_assign_ram()] Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
103 lines
4.0 KiB
C
103 lines
4.0 KiB
C
#ifndef QEMU_TYPEDEFS_H
|
|
#define QEMU_TYPEDEFS_H
|
|
|
|
/* A load of opaque types so that device init declarations don't have to
|
|
pull in all the real definitions. */
|
|
|
|
/* Please keep this list in alphabetical order */
|
|
typedef struct AdapterInfo AdapterInfo;
|
|
typedef struct AddressSpace AddressSpace;
|
|
typedef struct AioContext AioContext;
|
|
typedef struct AllwinnerAHCIState AllwinnerAHCIState;
|
|
typedef struct AudioState AudioState;
|
|
typedef struct BdrvDirtyBitmap BdrvDirtyBitmap;
|
|
typedef struct BdrvDirtyBitmapIter BdrvDirtyBitmapIter;
|
|
typedef struct BlockBackend BlockBackend;
|
|
typedef struct BlockBackendRootState BlockBackendRootState;
|
|
typedef struct BlockDriverState BlockDriverState;
|
|
typedef struct BusClass BusClass;
|
|
typedef struct BusState BusState;
|
|
typedef struct Chardev Chardev;
|
|
typedef struct CompatProperty CompatProperty;
|
|
typedef struct CPUAddressSpace CPUAddressSpace;
|
|
typedef struct CPUState CPUState;
|
|
typedef struct DeviceListener DeviceListener;
|
|
typedef struct DeviceState DeviceState;
|
|
typedef struct DirtyBitmapSnapshot DirtyBitmapSnapshot;
|
|
typedef struct DisplayChangeListener DisplayChangeListener;
|
|
typedef struct DisplayState DisplayState;
|
|
typedef struct DisplaySurface DisplaySurface;
|
|
typedef struct DriveInfo DriveInfo;
|
|
typedef struct Error Error;
|
|
typedef struct EventNotifier EventNotifier;
|
|
typedef struct FWCfgIoState FWCfgIoState;
|
|
typedef struct FWCfgMemState FWCfgMemState;
|
|
typedef struct FWCfgState FWCfgState;
|
|
typedef struct HCIInfo HCIInfo;
|
|
typedef struct I2CBus I2CBus;
|
|
typedef struct I2SCodec I2SCodec;
|
|
typedef struct ISABus ISABus;
|
|
typedef struct ISADevice ISADevice;
|
|
typedef struct IsaDma IsaDma;
|
|
typedef struct LoadStateEntry LoadStateEntry;
|
|
typedef struct MACAddr MACAddr;
|
|
typedef struct MachineClass MachineClass;
|
|
typedef struct MachineState MachineState;
|
|
typedef struct MemoryListener MemoryListener;
|
|
typedef struct MemoryMappingList MemoryMappingList;
|
|
typedef struct MemoryRegion MemoryRegion;
|
|
typedef struct MemoryRegionCache MemoryRegionCache;
|
|
typedef struct MemoryRegionSection MemoryRegionSection;
|
|
typedef struct MigrationIncomingState MigrationIncomingState;
|
|
typedef struct MigrationParams MigrationParams;
|
|
typedef struct MigrationState MigrationState;
|
|
typedef struct Monitor Monitor;
|
|
typedef struct MonitorDef MonitorDef;
|
|
typedef struct MouseTransformInfo MouseTransformInfo;
|
|
typedef struct MSIMessage MSIMessage;
|
|
typedef struct NetClientState NetClientState;
|
|
typedef struct NetFilterState NetFilterState;
|
|
typedef struct NICInfo NICInfo;
|
|
typedef struct PcGuestInfo PcGuestInfo;
|
|
typedef struct PCIBridge PCIBridge;
|
|
typedef struct PCIBus PCIBus;
|
|
typedef struct PCIDevice PCIDevice;
|
|
typedef struct PCIEAERErr PCIEAERErr;
|
|
typedef struct PCIEAERLog PCIEAERLog;
|
|
typedef struct PCIEAERMsg PCIEAERMsg;
|
|
typedef struct PCIEPort PCIEPort;
|
|
typedef struct PCIESlot PCIESlot;
|
|
typedef struct PCIExpressDevice PCIExpressDevice;
|
|
typedef struct PCIExpressHost PCIExpressHost;
|
|
typedef struct PCIHostDeviceAddress PCIHostDeviceAddress;
|
|
typedef struct PCIHostState PCIHostState;
|
|
typedef struct PCMachineClass PCMachineClass;
|
|
typedef struct PCMachineState PCMachineState;
|
|
typedef struct PCMCIACardState PCMCIACardState;
|
|
typedef struct PixelFormat PixelFormat;
|
|
typedef struct PostcopyDiscardState PostcopyDiscardState;
|
|
typedef struct Property Property;
|
|
typedef struct PropertyInfo PropertyInfo;
|
|
typedef struct QEMUBH QEMUBH;
|
|
typedef struct QemuConsole QemuConsole;
|
|
typedef struct QEMUFile QEMUFile;
|
|
typedef struct QemuOpt QemuOpt;
|
|
typedef struct QemuOpts QemuOpts;
|
|
typedef struct QemuOptsList QemuOptsList;
|
|
typedef struct QEMUSGList QEMUSGList;
|
|
typedef struct QEMUTimer QEMUTimer;
|
|
typedef struct QEMUTimerListGroup QEMUTimerListGroup;
|
|
typedef struct QObject QObject;
|
|
typedef struct RAMBlock RAMBlock;
|
|
typedef struct Range Range;
|
|
typedef struct SerialState SerialState;
|
|
typedef struct SHPCDevice SHPCDevice;
|
|
typedef struct SMBusDevice SMBusDevice;
|
|
typedef struct SSIBus SSIBus;
|
|
typedef struct uWireSlave uWireSlave;
|
|
typedef struct VirtIODevice VirtIODevice;
|
|
typedef struct Visitor Visitor;
|
|
typedef struct node_info NodeInfo;
|
|
|
|
#endif /* QEMU_TYPEDEFS_H */
|