From aff81a13e3616002ee3cabdf127f05108bf763e0 Mon Sep 17 00:00:00 2001 From: MaxsTechReview Date: Thu, 26 Nov 2026 18:04:24 -0500 Subject: [PATCH] perf(session): read process command lines in one call in the zRAM watcher (#3302) Read process command lines in one call in the zRAM watcher The watcher read every /proc//cmdline one byte per system call, costing about 390 ms of CPU per scan every 5 s (every second under memory pressure). mapfile reads in blocks and yields the same argument list, cutting a scan to about 17 ms. --- tools/linuxfs/overlay/usr/local/bin/droiddeck-session | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/linuxfs/overlay/usr/local/bin/droiddeck-session b/tools/linuxfs/overlay/usr/local/bin/droiddeck-session index 23c22edfa2..83777ced29 100755 --- a/tools/linuxfs/overlay/usr/local/bin/droiddeck-session +++ b/tools/linuxfs/overlay/usr/local/bin/droiddeck-session @@ -778,7 +778,7 @@ case $mode in for _d in /proc/[0-9]*; do [ "${_d##*/}" != "$BASHPID" ] || continue _args=() - while IFS= read -r -d '' _c; do _args+=("$_c"); done 2>/dev/null < "$_d/cmdline" || true + mapfile -d '' -t _args 2>/dev/null < "$_d/cmdline" || true [ "${#_args[@]}" -gt 0 ] || continue _name=${_args[0]} _fex=0 if [ "${#_args[@]}" -gt 1 ]; then