1

Demote promoted processes when RSS drops below threshold

Previously, once a process was promoted to HIGH, it stayed HIGH forever
even if its RSS dropped well below the -mem threshold. Now promoted
processes are demoted back to NORMAL when RSS < -mem, and removed from
the promoted map.

Also: added TZ.md with full technical specification of the project.
This commit is contained in:
2026-06-23 08:58:11 +03:00
parent ea914101bb
commit da13a6d549
2 changed files with 362 additions and 4 deletions
+1 -4
View File
@@ -538,10 +538,6 @@ func main() {
continue
}
if _, ok := promoted[p.PID]; ok {
continue
}
h, err := openProc(p.PID, ProcessQueryLimitedInformation)
if err != nil {
continue
@@ -556,6 +552,7 @@ func main() {
p.Name, p.PID, formatMemSize(rssBytes), prioName(origPrio))
} else {
if trySetPrio(h, p.PID, p.Name, PriorityClassNormal) {
delete(promoted, p.PID)
logf("DEMOTE %s (PID %d) RSS=%s, %s -> NORMAL",
p.Name, p.PID, formatMemSize(rssBytes), prioName(origPrio))
}