<?xml version="1.0"?>
<!DOCTYPE flagsdescription SYSTEM "http://www.spec.org/dtd/cpuflags2.dtd">
<flagsdescription>

<filename>Polystack-Platform-AMD-EPYC-v1.1</filename>

<title>SPEC CPU2026 Flag Description - Polystack Platform settings</title>

<os_tuning>
<![CDATA[
  <p></p>
  <b>ulimit</b><br>
  This sets user limits of system-wide resources and can set the stack size to n kbytes,
  or unlimited to allow the stack size to grow without limit. Common ulimit commands may include:
  <ul>
    <li>ulimit -s [n | unlimited]: Set the stack size to n kbytes, or unlimited to allow the stack
        size to grow without limit.</li>
    <li>ulimit -l (number): Set the maximum size that can be locked into memory.</li>
  </ul>
  <p></p>
  <b>Kernel Parameters</b><br>
  The following Linux Kernel parameters (run as 'root') can be used to optimize performance.
  More information on standard Linux kernal parameters may be found at:
  <ul>
    <li><a href="https://www.kernel.org/doc/html/latest/admin-guide/sysctl/vm.html">proc/sys/vm</a></li>
    <li><a href="https://www.kernel.org/doc/html/latest/admin-guide/sysctl/kernel.html">proc/sys/kernel</a></li>
    <li><a href="https://www.kernel.org/doc/html/latest/admin-guide/mm/transhuge.html">sys/kernel/mm/transparent_hugepage</a>
  </ul>
  <p></p>
  <b>dirty_ratio</b><br>
  This sets the percentage of total system memory that can be filled with dirty pages before
  everything must get committed to disk.  It helps manage memory usage by controlling how
  much dirty memory can accumulate before the system starts to write it back to disk; excessive
  accumulation of dirty memory can lead to performance issues or system instability.
  <p></p>
  The command <i>"sysctl -w vm.dirty_ratio=8"</i> sets the dirty cache to 8% of memory.
  <p></p>
  <b>drop_caches</b><br>
  This instructs the kernel free the file system page cache, and reclaimable slab objects such as
  dentries and inodes, which can help free up memory.
  <br>
  Possible settings are:
  <ul>
    <li>1: Drops page cache</li>
    <li>2: Drops dentries and inodes</li>
    <li>3: Drops page cache, dentries, and inodes</li>
  </ul>
  The command <i>"echo 3> /proc/sys/vm/drop_caches"</i> is used to free up the all filesystem page cache.
  <p></p>
  <b>randomize_va_space</b><br>
  This setting can be used to select the type of process address space layout randomization (ASLR) used on
  the system.  Disabling ASLR can make process execution more deterministic and runtimes more consistent.<br>
  Possible settings are:
  <ul>
    <li>0: Turn process address space randomization off.</li>
    <li>1: Randomize addresses of mmap base, stack, and VDSO pages.</li>
    <li>2: Additionally randomize the heap.</li>
  </ul>
  The command <i>"sysctl -w kernel.randomize_va_space=0"</i> is used to reduce run-to-run variability.
  <p></p>
  <b>swappiness</b><br>
  This setting is used to define the rough relative cost of swapping and filesystem paging as value
  from 1 to 100 (default 60). It determines the balance between swapping out process memory and dropping
  pages from the page cache.  A value of 1 will avoid swapping until memory is very low and swapping to
  disk is absolutely necessary. A value of 100 treats swapping and filesystem paging as equally costly
  and will cause the kernel to swap out inactive processes frequently in favor of file system performance, 
  resulting in large disk cache sizes.
  <p></p>
  The command <i>"sysctl -w vm.swappiness=1"</i> is used to minimize swapping.
  <p></p>
  <b>Transparent Hugepages (THP)</b><br>
  THP is an abstraction layer that uses huge pages to back virtual memory automatically, including
  promotion and demotion of page sizes.  It can improve performance by reducing page faults and TLB
  misses. Huge pages increase the memory page size from 4 KB to 2 MB. 
  <p></p>
  The command <i>"echo option > /sys/kernel/mm/transparent_hugepage/enabled"</i> is used to control THP usage.<br>
  Common values for <i>option</i> are:
  <ul>
    <li>always: enable THP usage. (default)</li>
    <li>madvise: enable THP only insied regions marked MADV_HUGEPAGE using madvise(3).</li>
    <li>never: disable THP usage.</li>
  </ul>
  <p></p>
  The command <i>"echo option > /sys/kernel/mm/transparent_hugepage/defrag"</i> is used to limit defrag efforts in the
  VM to generate anonymous hugepates in case they are not immediately free.
  <br>
  Common values for <i>option</i> are:
  <ul>
    <li>always: An allocation requesting THP when none are available will stall until some are made.</li>
    <li>defer: An allocation requesting THP when none are available get normal pages while requesting THP creation in the background.</li>
    <li>defer+madvise: Acts like "always", but only for allocations in regions marked MADV_HUGEPAGE using madvise(3); for all other regions it's like "defer".</li>
    <li>madvise: Acts like "always", but only for allocations in regions marked MADV_HUGEPAGE using madvise(3). (Default) </li>
    <li>never: If no THP are available to satisfy a request, do not attempt to make any.</li>
  </ul>
  <p></p>
  The command <i>"echo option > /sys/kernel/mm/transparent_hugepage/shmem_enabled"</i> is used to affect
  the allocation policy of shared memory (shmem or tmpfs) mounts.
  <br>
  Common values for <i>option</i> are:
  <ul>
    <li>advise: Attempt to allocate huge pages based on application advice.</li>
    <li>always: Always attempt to allocate huge pages for shared memory.</li>
    <li>deny: Prevent the allocation of huge pages shared memory mounts. (Emergency use)</li>
    <li>force: Force the allocation of huge pages on for all mounts. (Useful for testing)</li>
    <li>never: Do not allocate huge pages for shared memory. (Default)</li>
    <li>within_size: Allocate huge pages only if the request size is within a specified limit.</li>
  </ul>
  <p></p>
  <b>zone_reclaim-mode</b><br>
  Zone reclaim controls how aggressively the kernel reclaims free pages when a zone runs out of memory.
  Reclaiming a page can be more beneficial than taking the performance penalties that are associated
  with allocating a page on a remote zone, especially for systems with Non-Uniform Memory Access (NUMA).
  <br>
  Possible settings:
  <ul>
    <li>0: No zone reclaim (default).</li>
    <li>1: Enables zone reclaim - recommended for NUMA systems.</li>
    <li>2: Enables zone reclaim and allows writing dirty pages during reclaim.</li>
    <li>4: Allows unmapping of mapped file pages during reclaim.</li>
    <li>7: Enables all reclaim behaviours (zone reclaim, writing dirty pages, and unmapping).</li>
  </ul>
  The command <i>"sysctl -w vm.zone_reclaim_mode=1"</i> is used to reclaim memory more efficiently within
  the same node before accessing memory from other nodes.
]]>
</os_tuning>
<firmware>
<![CDATA[
  <p></p>
  <b>C-States</b><br>
  Controls processor low-power idle states (C-states).
  <ul>
    <li>Enabled: The processor may enter power-saving idle states when inactive.</li>
    <li>Disabled: The processor stays in the active C0 state to reduce wakeup latencies.</li>
  </ul>
  Default: Enabled
  <p></p>
  <b>Fan Control</b><br>
  Selects system cooling fan speed profile.
  <ul>
    <li>Standard: Fan speed adjusts dynamically based on thermal load.</li>
    <li>Full speed mode: System fans run at maximum speed continuously to ensure optimal thermal performance.</li>
  </ul>
  Default: Standard
  <p></p>
  <b>NUMA nodes per socket</b><br>
  Controls the number of desired NUMA nodes per populated processor socket.
  <ul>
    <li>NPS0: All memory channels are interleaved across the entire system.</li>
    <li>NPS1: All memory channels on a socket are interleaved into one NUMA domain.</li>
    <li>NPS2: Memory channels on a socket are split into two NUMA domains.</li>
    <li>NPS4: Memory channels on a socket are split into four NUMA domains. </li>
  </ul>
  Default: NPS1.
  <p></p>
  <b>Virtualization Technology (AMD-V)</b><br>
  Enables or disables hardware virtualization extensions provided by AMD processors.
  <ul>
    <li>Enabled: Processor virtualization features are available to the OS/hypervisor.</li>
    <li>Disabled: Processor virtualization features are hidden from the OS.</li>
  </ul>
  Default: Enabled
]]>
</firmware>
</flagsdescription>
