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:
@@ -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))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user