diff options
Diffstat (limited to 'community/earlyoom/remove-i-flag.patch')
-rw-r--r-- | community/earlyoom/remove-i-flag.patch | 160 |
1 files changed, 0 insertions, 160 deletions
diff --git a/community/earlyoom/remove-i-flag.patch b/community/earlyoom/remove-i-flag.patch deleted file mode 100644 index 37c1d09c308..00000000000 --- a/community/earlyoom/remove-i-flag.patch +++ /dev/null @@ -1,160 +0,0 @@ -From 7ebc4554f3940b4540b1b4330da732cc00933230 Mon Sep 17 00:00:00 2001 -From: Jakob Unterwurzacher <jakobunt@gmail.com> -Date: Fri, 7 May 2021 18:03:39 +0200 -Subject: [PATCH] Remove -i flag - -Kernel 5.9 changed how oom_score_adj works, and -I don't think this feature is worth having kernel -version detection to make it work on older & newer -kernels. Just drop it. - -Fixes https://github.com/rfjakob/earlyoom/issues/234 - -Patch-Source: https://github.com/rfjakob/earlyoom/commit/7ebc4554f3940b4540b1b4330da732cc00933230 -Patch-Source: https://github.com/rfjakob/earlyoom/commit/7da33c6278ee1f18dcdbc277cf00f64352a364a0 - -diff --git a/MANPAGE.md b/MANPAGE.md -index 7a2315b..b6b62b5 100644 ---- a/MANPAGE.md -+++ b/MANPAGE.md -@@ -71,7 +71,7 @@ Send SIGKILL if at or below KILL_SIZE (default SIZE/2), otherwise SIGTERM. - removed in earlyoom v1.2, ignored for compatibility - - #### -i --user-space oom killer should ignore positive oom_score_adj values -+removed in earlyoom v1.7, ignored for compatibility - - #### -d - enable debugging messages -diff --git a/kill.c b/kill.c -index 57305b9..5c175da 100644 ---- a/kill.c -+++ b/kill.c -@@ -171,17 +171,6 @@ procinfo_t find_largest_process(const poll_loop_args_t* args) - } - cur.badness = res; - } -- if (args->ignore_oom_score_adj) { -- int oom_score_adj = 0; -- int res = get_oom_score_adj(cur.pid, &oom_score_adj); -- if (res < 0) { -- debug(" error reading oom_score_adj: %s\n", strerror(-res)); -- continue; -- } -- if (oom_score_adj > 0) { -- cur.badness -= oom_score_adj; -- } -- } - - if ((args->prefer_regex || args->avoid_regex)) { - int res = get_comm(cur.pid, cur.name, sizeof(cur.name)); -diff --git a/kill.h b/kill.h -index d854dc8..33d92bb 100644 ---- a/kill.h -+++ b/kill.h -@@ -14,8 +14,6 @@ typedef struct { - double mem_kill_percent; - double swap_term_percent; - double swap_kill_percent; -- /* ignore /proc/PID/oom_score_adj? */ -- bool ignore_oom_score_adj; - /* send d-bus notifications? */ - bool notify; - /* kill all processes within a process group */ -diff --git a/main.c b/main.c -index b0c09cd..8d62558 100644 ---- a/main.c -+++ b/main.c -@@ -166,8 +166,7 @@ int main(int argc, char* argv[]) - fprintf(stderr, "Option -k is ignored since earlyoom v1.2\n"); - break; - case 'i': -- args.ignore_oom_score_adj = 1; -- fprintf(stderr, "Ignoring positive oom_score_adj values (-i)\n"); -+ fprintf(stderr, "Option -i is ignored since earlyoom v1.7\n"); - break; - case 'n': - args.notify = true; -diff --git a/testsuite_cli_test.go b/testsuite_cli_test.go -index d315fff..4fb51e4 100644 ---- a/testsuite_cli_test.go -+++ b/testsuite_cli_test.go -@@ -4,8 +4,6 @@ import ( - "fmt" - "io/ioutil" - "math" -- "os/exec" -- "regexp" - "strconv" - "strings" - "testing" -@@ -105,7 +103,7 @@ func TestCli(t *testing.T) { - // Test --avoid and --prefer - {args: []string{"--avoid", "MyProcess1"}, code: -1, stderrContains: "Will avoid killing", stdoutContains: memReport}, - {args: []string{"--prefer", "MyProcess2"}, code: -1, stderrContains: "Preferring to kill", stdoutContains: memReport}, -- {args: []string{"-i"}, code: -1, stderrContains: "Ignoring positive oom_score_adj values"}, -+ {args: []string{"-i"}, code: -1, stderrContains: "Option -i is ignored"}, - // Extra arguments should error out - {args: []string{"xyz"}, code: 13, stderrContains: "extra argument not understood", stdoutEmpty: true}, - {args: []string{"-i", "1"}, code: 13, stderrContains: "extra argument not understood", stdoutEmpty: true}, -@@ -216,47 +214,3 @@ func TestRss(t *testing.T) { - } - t.Logf("earlyoom RSS: %d kiB", res.rss) - } -- --// TestI tests that `earlyoom -i` works as expected --func TestI(t *testing.T) { -- cmd := exec.Command("sleep", "60") -- err := cmd.Start() -- if err != nil { -- t.Fatal(err) -- } -- defer cmd.Process.Kill() -- path := fmt.Sprintf("/proc/%d/oom_score_adj", cmd.Process.Pid) -- err = ioutil.WriteFile(path, []byte("1000"), 0600) -- if err != nil { -- t.Fatal(err) -- } -- res := runEarlyoom(t, "-d") -- // We should see a line like this: -- // pid 2308155: badness 1000 vm_rss 708 uid 1026 "sleep" <--- new victim -- // Or, for some reason, this: -- // pid 6950: badness 999 vm_rss 772 uid 1026 "sleep" <--- new victim -- matched := false -- for _, b := range []int{1000, 999} { -- pattern := fmt.Sprintf(`pid\s+%d: badness %d`, cmd.Process.Pid, b) -- matched, err = regexp.MatchString(pattern, res.stdout) -- if err != nil { -- t.Fatal(err) -- } -- if matched { -- break -- } -- } -- if !matched { -- t.Error("did not see badness 1000 or 999 in output") -- t.Log(res.stdout) -- } -- res = runEarlyoom(t, "-d", "-i") -- pattern := fmt.Sprintf(`pid\s+%d: badness %d`, cmd.Process.Pid, 1000) -- matched, err = regexp.MatchString(pattern, res.stdout) -- if err != nil { -- t.Fatal(err) -- } -- if matched { -- t.Error("saw badness 1000, but should not have") -- } --} -diff --git a/main.c b/main.c -index 8d62558..7e6ca7c 100644 ---- a/main.c -+++ b/main.c -@@ -219,8 +219,6 @@ int main(int argc, char* argv[]) - " earlyoom to act.\n" - " -M SIZE[,KILL_SIZE] set available memory minimum to SIZE KiB\n" - " -S SIZE[,KILL_SIZE] set free swap minimum to SIZE KiB\n" -- " -i user-space oom killer should ignore positive\n" -- " oom_score_adj values\n" - " -n enable d-bus notifications\n" - " -g kill all processes within a process group\n" - " -d enable debugging messages\n" |