mirror of
https://github.com/xen-project/xen.git
synced 2026-10-28 02:01:24 +01:00
xen: add cache coloring allocator for domains
Add a new memory page allocator that implements the cache coloring mechanism. The allocation algorithm enforces equal frequency distribution of cache partitions, following the coloring configuration of a domain. This allows for an even utilization of cache sets for every domain. Pages are stored in a color-indexed array of lists. Those lists are filled by a simple init function which computes the color of each page. When a domain requests a page, the allocator extracts the page from the list with the maximum number of free pages among those that the domain can access, given its coloring configuration. The allocator can only handle requests of order-0 pages. This allows for easier implementation and since cache coloring targets only embedded systems, it's assumed not to be a major problem. The buddy allocator must coexist with the colored one because the Xen heap isn't colored. For this reason a new Kconfig option and a command line parameter are added to let the user set the amount of memory reserved for the buddy allocator. Even when cache coloring is enabled, this memory isn't managed by the colored allocator. Colored heap information is dumped in the dump_heap() debug-key function. Based on original work from: Luca Miccio <lucmiccio@gmail.com> Signed-off-by: Marco Solieri <marco.solieri@minervasys.tech> Signed-off-by: Carlo Nonato <carlo.nonato@minervasys.tech> Reviewed-by: Jan Beulich <jbeulich@suse.com> Acked-by: Michal Orzel <michal.orzel@amd.com>
This commit is contained in:
1 parent
5948dc1675
commit
95debe51a9
7 files changed
+267
-4
No files matched your search
@@ -13,6 +13,9 @@ To compile LLC coloring support set ``CONFIG_LLC_COLORING=y``.
|
||||
If needed, change the maximum number of colors with
|
||||
``CONFIG_LLC_COLORS_ORDER=<n>``.
|
||||
|
||||
If needed, change the buddy allocator reserved size with
|
||||
``CONFIG_BUDDY_ALLOCATOR_SIZE=<n>``.
|
||||
|
||||
Runtime configuration is done via `Command line parameters`_.
|
||||
For DomUs follow `DomUs configuration`_.
|
||||
|
||||
@@ -110,6 +113,8 @@ Specific documentation is available at `docs/misc/xen-command-line.pandoc`.
|
||||
+----------------------+-------------------------------+
|
||||
| ``dom0-llc-colors`` | Dom0 color configuration |
|
||||
+----------------------+-------------------------------+
|
||||
| ``buddy-alloc-size`` | Buddy allocator reserved size |
|
||||
+----------------------+-------------------------------+
|
||||
|
||||
Colors selection format
|
||||
***********************
|
||||
@@ -197,6 +202,17 @@ For example:
|
||||
**Note:** If no color configuration is provided for a domain, the default one,
|
||||
which corresponds to all available colors is used instead.
|
||||
|
||||
Colored allocator and buddy allocator
|
||||
*************************************
|
||||
|
||||
The colored allocator distributes pages based on color configurations of
|
||||
domains so that each domains only gets pages of its own colors.
|
||||
The colored allocator is meant as an alternative to the buddy allocator because
|
||||
its allocation policy is by definition incompatible with the generic one. Since
|
||||
the Xen heap is not colored yet, we need to support the coexistence of the two
|
||||
allocators and some memory must be left for the buddy one. Buddy memory
|
||||
reservation is configured via Kconfig or via command-line.
|
||||
|
||||
Known issues and limitations
|
||||
****************************
|
||||
|
||||
@@ -207,3 +223,24 @@ In the domain configuration, "xen,static-mem" allows memory to be statically
|
||||
allocated to the domain. This isn't possible when LLC coloring is enabled,
|
||||
because that memory can't be guaranteed to use only colors assigned to the
|
||||
domain.
|
||||
|
||||
Cache coloring is intended only for embedded systems
|
||||
####################################################
|
||||
|
||||
The current implementation aims to satisfy the need of predictability in
|
||||
embedded systems with small amount of memory to be managed in a colored way.
|
||||
Given that, some shortcuts are taken in the development. Expect worse
|
||||
performances on larger systems.
|
||||
|
||||
Colored allocator can only make use of order-0 pages
|
||||
####################################################
|
||||
|
||||
The cache coloring technique relies on memory mappings and on the smallest
|
||||
mapping granularity to achieve the maximum number of colors (cache partitions)
|
||||
possible. This granularity is what is normally called a page and, in Xen
|
||||
terminology, the order-0 page is the smallest one. The fairly simple
|
||||
colored allocator currently implemented, makes use only of such pages.
|
||||
It must be said that a more complex one could, in theory, adopt higher order
|
||||
pages if the colors selection contained adjacent colors. Two subsequent colors,
|
||||
for example, can be represented by an order-1 page, four colors correspond to
|
||||
an order-2 page, etc.
|
||||
@@ -270,6 +270,20 @@ and not running softirqs. Reduce this if softirqs are not being run frequently
|
||||
enough. Setting this to a high value may cause boot failure, particularly if
|
||||
the NMI watchdog is also enabled.
|
||||
|
||||
### buddy-alloc-size (arm64)
|
||||
> `= <size>`
|
||||
|
||||
> Default: `64M`
|
||||
|
||||
Amount of memory reserved for the buddy allocator when colored allocator is
|
||||
active. This option is available only when `CONFIG_LLC_COLORING` is enabled.
|
||||
The colored allocator is meant as an alternative to the buddy allocator,
|
||||
because its allocation policy is by definition incompatible with the generic
|
||||
one. Since the Xen heap systems is not colored yet, we need to support the
|
||||
coexistence of the two allocators for now. This parameter, which is optional
|
||||
and for expert only, it's used to set the amount of memory reserved to the
|
||||
buddy allocator.
|
||||
|
||||
### cet
|
||||
= List of [ <bool>, shstk=<bool>, ibt=<bool> ]
|
||||
|
||||
|
||||