#!/usr/bin/env bash # OWNER-RUN, NOT RUN BY THE AGENT. Needs root. Hypothesis test for docs/experiments/baseline-pair-5090.md section 5: a vanilla run that follows an ours run gets fewer transparent # huge pages (free memory in blocks of 2 MiB or more is 40-46 GiB instead of 49 GiB), so compact memory before every vanilla launch and see whether the "after ours" penalty disappears. # It changes no setting: it only asks the kernel to compact free memory once (writes 1 to /proc/sys/vm/compact_memory) and prints the free 2 MiB-or-larger blocks before and after. # # Use with the job: sudo-install this file, then queue # PRE_ARM_HOOK=/path/to/owner-compact-memory.sh SEQ="v2 ours v2 ours v2 ours v2 ours v2 ours" OUTR=/data/leleka-e2e/runs/baseline-pair-c ... bash baseline-pair-ab.sh # (the hook is called as `hook ` and must itself be allowed to write /proc/sys/vm/compact_memory, e.g. run the whole holder job as root or give this one script a sudoers NOPASSWD entry). # Compare against bp-b (same sequence without the hook). Do not leave the hook in place for any other measurement. set -u free_hi() { awk '/Normal|DMA32/ { for (o = 9; o <= 10; o++) s += $(5 + o) * (4096 * 2 ^ o) } END { printf "%.1f GiB\n", s / 2 ^ 30 }' /proc/buddyinfo; } echo "arm=$1 free>=2MiB before: $(free_hi)" sync echo 1 > /proc/sys/vm/compact_memory echo "free>=2MiB after: $(free_hi)"