From unknown Sun Jun 22 00:03:13 2025 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-Mailer: MIME-tools 5.509 (Entity 5.509) Content-Type: text/plain; charset=utf-8 From: bug#39283 <39283@debbugs.gnu.org> To: bug#39283 <39283@debbugs.gnu.org> Subject: Status: [PATCH] gnu: Add earlyoom. Reply-To: bug#39283 <39283@debbugs.gnu.org> Date: Sun, 22 Jun 2025 07:03:13 +0000 retitle 39283 [PATCH] gnu: Add earlyoom. reassign 39283 guix-patches submitter 39283 Pkill -9 severity 39283 normal tag 39283 patch thanks From debbugs-submit-bounces@debbugs.gnu.org Sat Jan 25 16:24:02 2020 Received: (at submit) by debbugs.gnu.org; 25 Jan 2020 21:24:02 +0000 Received: from localhost ([127.0.0.1]:56403 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ivSuP-0005gi-T1 for submit@debbugs.gnu.org; Sat, 25 Jan 2020 16:24:02 -0500 Received: from lists.gnu.org ([209.51.188.17]:55847) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ivSuN-0005ga-Tl for submit@debbugs.gnu.org; Sat, 25 Jan 2020 16:24:00 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:33848) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ivSuM-0000VE-FI for bug-guix@gnu.org; Sat, 25 Jan 2020 16:23:59 -0500 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: * X-Spam-Status: No, score=1.6 required=5.0 tests=BAYES_20, FREEMAIL_ENVFROM_END_DIGIT,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW,SPOOFED_FREEMAIL, URIBL_BLOCKED autolearn=disabled version=3.3.2 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ivSuK-0003CL-UC for bug-guix@gnu.org; Sat, 25 Jan 2020 16:23:58 -0500 Received: from aibo.runbox.com ([91.220.196.211]:47208) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1ivSuK-00034w-DU for bug-guix@gnu.org; Sat, 25 Jan 2020 16:23:56 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=runbox.com; s=rbselector1; h=Content-Transfer-Encoding:MIME-Version:Message-Id:Date: Subject:Cc:To:From; bh=F5X/4KxVwZXwR2dPOyp5BlZvKQuuqbBEY93Md5M7h9k=; b=ha+jTx OpkOvOrDk5/8UjRCX4Mon/IJl2gm+Icum4C+DzgPElRwsQc5MZdKvudAg4sgzUjX5iYitlqgjMVjz RXCIlSl3kMEybxYpwFaCWm7qveru+qfjtRN4GZ/gjePAYrLuJoTlivlcpaUdjGkYibMp54M/n3qel L3dG/FhfqXoW6wXGPpO1Bnni6j/gmsJ1LoqkMxOy21JRB+Cigavc85VQMxV7zB9ZonALhv6eZrclC UsarG8gyLcsq3fxQqTouwP2N4KjELyM98BB7bY+OkyQ9d4RcYrdbdI/MUYRL87732hoHjWWPxyQ3b b0cfdrCl/Tr/HilFc1puEVpdGCCg==; Received: from [10.9.9.204] (helo=mailfront22.runbox) by mailtransmit02.runbox with esmtp (Exim 4.86_2) (envelope-from ) id 1ivSuH-0008Nx-2y for bug-guix@gnu.org; Sat, 25 Jan 2020 22:23:53 +0100 Received: by mailfront22.runbox with esmtpsa [Authenticated alias (780724)] (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) id 1ivSu1-0005gy-Nl; Sat, 25 Jan 2020 22:23:37 +0100 From: Pkill -9 To: bug-guix@gnu.org Subject: [PATCH] gnu: Add earlyoom. Date: Sat, 25 Jan 2020 21:23:20 +0000 Message-Id: <20200125212320.12134-1-pkill9@runbox.com> X-Mailer: git-send-email 2.25.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 91.220.196.211 X-Spam-Score: 2.5 (++) X-Spam-Report: Spam detection software, running on the system "debbugs.gnu.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: * gnu/packages/linux.scm (earlyoom): New variable. --- gnu/packages/linux.scm | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/gnu/packages/linux.scm b/gnu/packages/linux.scm index e5cc773ecc..892906cc70 100644 --- a/gnu/packages/linux.scm +++ b/gnu/packages/linux.scm @@ -6215,3 +6215,40 @@ the Linux kernel, C st [...] Content analysis details: (2.5 points, 10.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- 0.0 URIBL_BLOCKED ADMINISTRATOR NOTICE: The query to URIBL was blocked. See http://wiki.apache.org/spamassassin/DnsBlocklists#dnsbl-block for more information. [URIs: runbox.com] -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at https://www.dnswl.org/, low trust [209.51.188.17 listed in list.dnswl.org] 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider (pkill9[at]runbox.com) 0.9 SPF_FAIL SPF: sender does not match SPF record (fail) [SPF failed: Please see http://www.openspf.org/Why?s=mfrom; id=pkill9%40runbox.com; ip=209.51.188.17; r=debbugs.gnu.org] 0.2 FREEMAIL_ENVFROM_END_DIGIT Envelope-from freemail username ends in digit (pkill9[at]runbox.com) 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record 2.0 SPOOFED_FREEMAIL No description available. X-Debbugs-Envelope-To: submit Cc: Pkill -9 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.5 (/) * gnu/packages/linux.scm (earlyoom): New variable. --- gnu/packages/linux.scm | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/gnu/packages/linux.scm b/gnu/packages/linux.scm index e5cc773ecc..892906cc70 100644 --- a/gnu/packages/linux.scm +++ b/gnu/packages/linux.scm @@ -6215,3 +6215,40 @@ the Linux kernel, C standard library, and libdl (for dynamic linking). While ELL is designed to be efficient and compact enough for use on embedded Linux platforms, it is not limited to resource-constrained systems.") (license license:lgpl2.1+))) + +(define-public earlyoom + (package + (name "earlyoom") + (version "1.3") + (source (origin + (method git-fetch) + (uri (git-reference + (url "https://github.com/rfjakob/earlyoom.git") + (commit (string-append "v" version)))) + (file-name (git-file-name name version)) + (sha256 + (base32 + "0fwbx0y80nqgkxrc9kf9j3iwa0wbps2jmqir3pgqbc2cj0wjh0lr")))) + (build-system gnu-build-system) + (arguments + `(#:make-flags `("CC=gcc" + ,(string-append "DESTDIR=" + (assoc-ref %outputs "out")) + "PREFIX=") + #:tests? #f ;; no tests + #:phases (modify-phases + %standard-phases + (delete 'configure) + (add-after 'install 'remove-systemd-service + (lambda* (#:key outputs #:allow-other-keys) + (let ((out (assoc-ref outputs "out"))) + (delete-file-recursively + (string-append out "/etc/systemd"))) + #t))))) + (home-page "https://github.com/rfjakob/earlyoom") + (synopsis "Automatically kill processes in low-memory situations") + (description "Earlyoom checks the amount of available memory and free swap +up to 10 times a second (less often if there is a lot of free memory). By +default if both are below 10%, it will kill the largest process (highest +oom_score). The percentage value is configurable via command line arguments.") + (license license:expat))) -- 2.25.0 From debbugs-submit-bounces@debbugs.gnu.org Mon Jan 27 16:25:08 2020 Received: (at control) by debbugs.gnu.org; 27 Jan 2020 21:25:09 +0000 Received: from localhost ([127.0.0.1]:59104 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1iwBsa-0008EZ-Eh for submit@debbugs.gnu.org; Mon, 27 Jan 2020 16:25:08 -0500 Received: from eggs.gnu.org ([209.51.188.92]:42281) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1iwBsY-0008Dz-QR for control@debbugs.gnu.org; Mon, 27 Jan 2020 16:25:07 -0500 Received: from fencepost.gnu.org ([2001:470:142:3::e]:42084) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1iwBsS-0004tr-Kw for control@debbugs.gnu.org; Mon, 27 Jan 2020 16:25:00 -0500 Received: from [2a01:e0a:1d:7270:af76:b9b:ca24:c465] (port=55662 helo=ribbon) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1iwBsS-0001DE-3n for control@debbugs.gnu.org; Mon, 27 Jan 2020 16:25:00 -0500 Date: Mon, 27 Jan 2020 22:24:58 +0100 Message-Id: <87sgk0fv85.fsf@gnu.org> To: control@debbugs.gnu.org From: =?utf-8?Q?Ludovic_Court=C3=A8s?= Subject: control message for bug #39283 MIME-version: 1.0 Content-type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: control X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.7 (-) reassign 39283 guix-patches quit From debbugs-submit-bounces@debbugs.gnu.org Fri Jan 31 02:44:00 2020 Received: (at 39283) by debbugs.gnu.org; 31 Jan 2020 07:44:00 +0000 Received: from localhost ([127.0.0.1]:36517 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ixQy2-0007Im-4B for submit@debbugs.gnu.org; Fri, 31 Jan 2020 02:44:00 -0500 Received: from mail-qt1-f194.google.com ([209.85.160.194]:41654) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ixQxz-0007IY-Qc for 39283@debbugs.gnu.org; Fri, 31 Jan 2020 02:43:52 -0500 Received: by mail-qt1-f194.google.com with SMTP id l19so4695708qtq.8 for <39283@debbugs.gnu.org>; Thu, 30 Jan 2020 23:43:51 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version; bh=XkkD4e6HJM9CkWMaOl3XUy/DEACW8csHisS8bcPVFyg=; b=N8cVN4UJFI7TdHByhZbMHCeZX+V6coTk1pWO3bBk9l1NoFhZh7Ux0Yk4A+6OUSpDtj qEJv5QPTxbkWkbF6z3zEb41JHJpetlObogCLUl/9ZYl27S4jjaNYCFY139fgsw2/Usg/ kXvqlTezX83DaqkYHqAOHdQHgkICgLII+OcCT8O8pa95QehFzPMOGyyEMiaouK0qbclx OIii63Oy8S6Ac81KfBO+QlDbOOPPKuWviBsu56ZuqtfkCsWqDHQv4LZU4vqTJyUExL0D PwtDWraR9drq8jmD8rflWzTt9X+Ra6mD3RvBxLg8EmVJzZeZ6itSvPHAfShfneS1VOAB QGxg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:references:date:in-reply-to :message-id:user-agent:mime-version; bh=XkkD4e6HJM9CkWMaOl3XUy/DEACW8csHisS8bcPVFyg=; b=YMD4UydH+OU0/UWfips0HcBzShwMaSrz/9LzV+fmWBHMX5rcaLyYk2J2ZwONiaURXO MVb+ARrsd/FAir/BVJ7Ant2KgXpzwXK2RS/yxEHfVLZEAnrkQuBS3XEFzTZUzB+63J1l xddbcPGrdb2Bhuk1vGj4tcr7glkbhunn1OrH3PFB7Eso3Euaj+ZR91u8C3lrCDJWfoHM Ui9wzg/DIdfrNH2MIne392btUvPtrywf8Z8HKP4epxtBzbhcnZXCLepV8t0dLHQwlvC1 +pBR3tG5hQ+YAs7wf+XU31qhgVwqTRMm77m3BEaHmlEelYZ5/bJOQWwbmYy1wxePpy/A /xKg== X-Gm-Message-State: APjAAAUsbXG73gtGCEGQOS5jS10JcnOH/ybbS68VmN5pVBgnQdc7TkDJ poqYOYUyJ1oK8vyiVGyS9SqEfIxP X-Google-Smtp-Source: APXvYqyHmCBHe9l9X3UZTZZ8MKimXwBumhXBbUW023r+LEAUUeL2Z2jkwO2DNOAodxRZul5dGELq0A== X-Received: by 2002:ac8:32ec:: with SMTP id a41mr9528058qtb.235.1580456625924; Thu, 30 Jan 2020 23:43:45 -0800 (PST) Received: from apteryx (dsl-236-123-170.b2b2c.ca. [207.236.123.170]) by smtp.gmail.com with ESMTPSA id h7sm4090816qke.30.2020.01.30.23.43.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 30 Jan 2020 23:43:45 -0800 (PST) From: Maxim Cournoyer To: Pkill -9 Subject: Re: bug#39283: [PATCH] gnu: Add earlyoom. References: <20200125212320.12134-1-pkill9@runbox.com> Date: Fri, 31 Jan 2020 02:43:44 -0500 In-Reply-To: <20200125212320.12134-1-pkill9@runbox.com> (Pkill's message of "Sat, 25 Jan 2020 21:23:20 +0000") Message-ID: <87a764rryn.fsf@gmail.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.3 (gnu/linux) MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 39283 Cc: 39283@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) --=-=-= Content-Type: text/plain Hello Pkill -9, Pkill -9 writes: > * gnu/packages/linux.scm (earlyoom): New variable. > --- > gnu/packages/linux.scm | 37 +++++++++++++++++++++++++++++++++++++ > 1 file changed, 37 insertions(+) > > diff --git a/gnu/packages/linux.scm b/gnu/packages/linux.scm > index e5cc773ecc..892906cc70 100644 > --- a/gnu/packages/linux.scm > +++ b/gnu/packages/linux.scm > @@ -6215,3 +6215,40 @@ the Linux kernel, C standard library, and libdl (for dynamic linking). While > ELL is designed to be efficient and compact enough for use on embedded Linux > platforms, it is not limited to resource-constrained systems.") > (license license:lgpl2.1+))) > + > +(define-public earlyoom > + (package > + (name "earlyoom") > + (version "1.3") > + (source (origin > + (method git-fetch) > + (uri (git-reference > + (url "https://github.com/rfjakob/earlyoom.git") > + (commit (string-append "v" version)))) > + (file-name (git-file-name name version)) > + (sha256 > + (base32 > + "0fwbx0y80nqgkxrc9kf9j3iwa0wbps2jmqir3pgqbc2cj0wjh0lr")))) > + (build-system gnu-build-system) > + (arguments > + `(#:make-flags `("CC=gcc" > + ,(string-append "DESTDIR=" > + (assoc-ref %outputs "out")) > + "PREFIX=") > + #:tests? #f ;; no tests > + #:phases (modify-phases > + %standard-phases > + (delete 'configure) > + (add-after 'install 'remove-systemd-service > + (lambda* (#:key outputs #:allow-other-keys) > + (let ((out (assoc-ref outputs "out"))) > + (delete-file-recursively > + (string-append out "/etc/systemd"))) > + #t))))) > + (home-page "https://github.com/rfjakob/earlyoom") > + (synopsis "Automatically kill processes in low-memory situations") > + (description "Earlyoom checks the amount of available memory and free swap > +up to 10 times a second (less often if there is a lot of free memory). By > +default if both are below 10%, it will kill the largest process (highest > +oom_score). The percentage value is configurable via command line arguments.") > + (license license:expat))) I happened to have prepared earlyoom recently, but delayed its inclusion due to finishing a service for it (only the doc remains). I'm attaching it. My version seems slightly more complete (I generate the doc and run the tests). If you don't have an objection I could push it to master. --=-=-= Content-Type: text/x-patch; charset=utf-8 Content-Disposition: attachment; filename=0001-gnu-Add-earlyoom.patch Content-Transfer-Encoding: quoted-printable >From 3692937bb2eb0659493dfb59c43a83b2ae094214 Mon Sep 17 00:00:00 2001 From: Maxim Cournoyer Date: Sun, 5 Jan 2020 00:44:48 -0500 Subject: [PATCH 1/2] gnu: Add earlyoom. * gnu/packages/linux.scm (earlyoom): New variable. --- gnu/packages/linux.scm | 47 +++++++++++++++++++++++++++++++++++++++++- 1 file changed, 46 insertions(+), 1 deletion(-) diff --git a/gnu/packages/linux.scm b/gnu/packages/linux.scm index cc3455b52b..7b0241ff4b 100644 --- a/gnu/packages/linux.scm +++ b/gnu/packages/linux.scm @@ -33,7 +33,7 @@ ;;; Copyright =C2=A9 2018 Pierre Langlois ;;; Copyright =C2=A9 2018 Vasile Dumitrascu ;;; Copyright =C2=A9 2019 Tim Gesthuizen -;;; Copyright =C2=A9 2019 Maxim Cournoyer +;;; Copyright =C2=A9 2019, 2020 Maxim Cournoyer ;;; Copyright =C2=A9 2019 Stefan Stefanovi=C4=87 ;;; Copyright =C2=A9 2019 Pierre Langlois ;;; Copyright =C2=A9 2019 Brice Waegeneire @@ -86,6 +86,7 @@ #:use-module (gnu packages gperf) #:use-module (gnu packages gstreamer) #:use-module (gnu packages gtk) + #:use-module (gnu packages haskell-xyz) #:use-module (gnu packages libunwind) #:use-module (gnu packages libusb) #:use-module (gnu packages man) @@ -2640,6 +2641,50 @@ kmod. The aim is to be compatible with tools, confi= gurations and indices from the module-init-tools project.") (license license:gpl2+))) ; library under lgpl2.1+ =20 +(define-public earlyoom + (package + (name "earlyoom") + (version "1.3") + (source (origin + (method git-fetch) + (uri (git-reference + (url "https://github.com/rfjakob/earlyoom.git") + (commit (string-append "v" version)))) + (file-name (git-file-name name version)) + (sha256 + (base32 + "0fwbx0y80nqgkxrc9kf9j3iwa0wbps2jmqir3pgqbc2cj0wjh0lr")))) + (build-system gnu-build-system) + (arguments + `(#:phases (modify-phases %standard-phases + (delete 'configure) + (add-before 'check 'set-home + (lambda _ + (setenv "HOME" (getcwd)) + #t)) + (add-after 'build 'install-contribs + ;; Install what seems useful from the contrib director= y. + (lambda* (#:key outputs #:allow-other-keys) + (let* ((out (assoc-ref outputs "out")) + (contrib (string-append + out "/share/earlyoom/contrib"))) + (install-file "contrib/notify_all_users.py" contri= b) + #t)))) + #:make-flags (let* ((prefix (assoc-ref %outputs "out"))) + (list "CC=3Dgcc" + (string-append "VERSION=3Dv" ,version) + (string-append "PREFIX=3D" prefix) + (string-append "SYSCONFDIR=3D" prefix "/etc"))) + #:test-target "test")) + (native-inputs `(("go" ,go) ;for the test suite + ("pandoc" ,ghc-pandoc))) ;to generate the manpage + (home-page "https://github.com/rfjakob/earlyoom") + (synopsis "Simple out of memory (OOM) daemon for the Linux kernel") + (description "Early OOM is a minimalist out of memory (OOM) daemon that +runs in user space and provides a more responsive and configurable alterna= tive +to the in-kernel OOM killer.") + (license license:expat))) + (define-public eudev ;; The post-systemd fork, maintained by Gentoo. (package --=20 2.24.1 --=-=-= Content-Type: text/plain Then there is a Shepherd service for convenience. I haven't tried all the switches, but I presume it'd work, given that they seem to be translated correctly into earyloom's command line options (there's a unit test for it). --=-=-= Content-Type: text/x-patch; charset=utf-8 Content-Disposition: attachment; filename=0002-gnu-Add-earlyoom-service-type.patch Content-Transfer-Encoding: quoted-printable >From 8ffb34822b6a394ef4699cdaf850e405e92009f6 Mon Sep 17 00:00:00 2001 From: Maxim Cournoyer Date: Mon, 6 Jan 2020 01:36:00 -0500 Subject: [PATCH 2/2] gnu: Add earlyoom-service-type. * gnu/services/linux.scm: New file. * tests/services/linux.scm: Add test. * Makefile.am (SCM_TESTS): Register test. * doc/guix.texi (Linux Services): Document the new service. --- Makefile.am | 1 + doc/guix.texi | 69 ++++++++++++++++++++- gnu/services/linux.scm | 125 +++++++++++++++++++++++++++++++++++++++ tests/services/linux.scm | 57 ++++++++++++++++++ 4 files changed, 251 insertions(+), 1 deletion(-) create mode 100644 gnu/services/linux.scm create mode 100644 tests/services/linux.scm diff --git a/Makefile.am b/Makefile.am index 7474b7f375..c6a2e6cf6c 100644 --- a/Makefile.am +++ b/Makefile.am @@ -426,6 +426,7 @@ SCM_TESTS =3D \ tests/scripts-build.scm \ tests/search-paths.scm \ tests/services.scm \ + tests/services/linux.scm \ tests/sets.scm \ tests/size.scm \ tests/snix.scm \ diff --git a/doc/guix.texi b/doc/guix.texi index 3141c4582f..3f1caa764b 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -48,7 +48,7 @@ Copyright @copyright{} 2017 humanitiesNerd@* Copyright @copyright{} 2017 Christopher Allan Webber@* Copyright @copyright{} 2017, 2018, 2019 Marius Bakke@* Copyright @copyright{} 2017, 2019 Hartmut Goebel@* -Copyright @copyright{} 2017, 2019 Maxim Cournoyer@* +Copyright @copyright{} 2017, 2019, 2020 Maxim Cournoyer@* Copyright @copyright{} 2017, 2018, 2019, 2020 Tobias Geerinckx-Rice@* Copyright @copyright{} 2017 George Clemmer@* Copyright @copyright{} 2017 Andy Wingo@* @@ -310,6 +310,7 @@ Services * Version Control Services:: Providing remote access to Git repositorie= s. * Game Services:: Game servers. * PAM Mount Service:: Service to mount volumes when logging in. +* Linux Services:: Services tied to the Linux kernel. * Miscellaneous Services:: Other services. =20 Defining Services @@ -12084,6 +12085,7 @@ declaration. * Game Services:: Game servers. * PAM Mount Service:: Service to mount volumes when logging in. * Guix Services:: Services relating specifically to Guix. +* Linux Services:: Services tied to the Linux kernel. * Miscellaneous Services:: Other services. @end menu =20 @@ -25129,6 +25131,71 @@ list. @end table @end deftp =20 +@node Linux Services +@subsubheading Linux Services + +@cindex oom +@cindex out of memory killer +@cindex earlyoom +@cindex early out of memory daemon +@subsection Early OOM Service + +@uref{https://github.com/rfjakob/earlyoom,Early OOM}, also known as +Earlyoom, is a minimalist out of memory (OOM) daemon that runs in user +space and provides a more responsive and configurable alternative to the +in-kernel OOM killer. It is useful to prevent the system from becoming +unresponsive when it runs out of memory. + +@deffn {Scheme Variable} earlyoom-service-type +The service type for running @command{earlyoom}, the Early OOM daemon. +Its value must be a @code{earlyoom-configuration} object, described +below. The service can be instantiated in its default configuration +with: + +@lisp +(service earlyoom-service-type) +@end lisp +@end deffn + +@deftp {Data Type} earlyoom-configuration +This is the configuration record for the @code{earlyoom-service-type}. + +@table @asis +@item @code{earlyoom} (default: @var{earlyoom}) +The Earlyoom package to use. + +@item @code{minimum-available-memory} (default: @code{10}) +Threshold for the minimum @emph{available} memory, in percents. + +@item @code{minimum-free-swap} (default: @code{10}) +Threshold for the minimum free swap memory, in percents. + +@item @code{prefer-regexp} (default: @code{#f}) +A regular expression (as a string) to match the names of the processes +that should be preferably killed. + +@item @code{avoid-regexp} (default: @code{#f}) +A regular expression (as a string) to match the names of the processes +that should @emph{not} be killed. + +@item @code{memory-report-interval} (default: @code{0}) +The interval in seconds at which a memory report is printed. It is +disabled by default. + +@item @code{ignore-positive-oom-score-adj?} (default: @code{#f}) +A boolean indicating whether the positive adjustments set in +@file{/proc/*/oom_score_adj}. + +@item @code{show-debug-messages?} (default: @code{#f}) +A boolean indicating whether debug messages should be printed. The logs +are saved at @file{/var/log/earlyoom.log}. + +@item @code{send-notification-command} (default: @code{#f}) +This can be used to provide a custom command used for sending +notifications. +@end table +@end deftp + =20 @node Miscellaneous Services @subsection Miscellaneous Services diff --git a/gnu/services/linux.scm b/gnu/services/linux.scm new file mode 100644 index 0000000000..caa0326c31 --- /dev/null +++ b/gnu/services/linux.scm @@ -0,0 +1,125 @@ +;;; GNU Guix --- Functional package management for GNU +;;; Copyright =C2=A9 2020 Maxim Cournoyer +;;; +;;; This file is part of GNU Guix. +;;; +;;; GNU Guix is free software; you can redistribute it and/or modify it +;;; under the terms of the GNU General Public License as published by +;;; the Free Software Foundation; either version 3 of the License, or (at +;;; your option) any later version. +;;; +;;; GNU Guix is distributed in the hope that it will be useful, but +;;; WITHOUT ANY WARRANTY; without even the implied warranty of +;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;;; GNU General Public License for more details. +;;; +;;; You should have received a copy of the GNU General Public License +;;; along with GNU Guix. If not, see . + +(define-module (gnu services linux) + #:use-module (guix gexp) + #:use-module (guix records) + #:use-module (guix modules) + #:use-module (gnu services) + #:use-module (gnu services shepherd) + #:use-module (gnu packages linux) + #:use-module (srfi srfi-1) + #:use-module (srfi srfi-26) + #:use-module (ice-9 match) + #:export (earlyoom-configuration + earlyoom-configuration? + earlyoom-configuration-earlyoom + earlyoom-configuration-minimum-available-memory + earlyoom-configuration-minimum-free-swap + earlyoom-configuration-prefer-regexp + earlyoom-configuration-avoid-regexp + earlyoom-configuration-memory-report-interval + earlyoom-configuration-ignore-positive-oom-score-adj? + earlyoom-configuration-show-debug-messages? + earlyoom-configuration-send-notification-command + earlyoom-service-type)) + + +;;; +;;; Early OOM daemon. +;;; + +(define-record-type* + earlyoom-configuration make-earlyoom-configuration + earlyoom-configuration? + (earlyoom earlyoom-configuration-earlyoom + (default earlyoom)) + (minimum-available-memory earlyoom-configuration-minimum-available-memory + (default 10)) ; in percent + (minimum-free-swap earlyoom-configuration-minimum-free-swap + (default 10)) ; in percent + (prefer-regexp earlyoom-configuration-prefer-regexp ; + (default #f)) + (avoid-regexp earlyoom-configuration-avoid-regexp ; + (default #f)) + (memory-report-interval earlyoom-configuration-memory-report-interval + (default 0)) ; in seconds; 0 means disabled + (ignore-positive-oom-score-adj? + earlyoom-configuration-ignore-positive-oom-score-adj? (default #f)) + (run-with-higher-priority? earlyoom-configuration-run-with-higher-priori= ty? + (default #f)) + (show-debug-messages? earlyoom-configuration-show-debug-messages? + (default #f)) + (send-notification-command + earlyoom-configuration-send-notification-command ; + (default #f))) + +(define (earlyoom-configuration->command-line-args config) + "Translate a object to its command line argumen= ts +representation." + (match config + (($ earlyoom minimum-available-memory + minimum-free-swap prefer-regexp avoid-reg= exp + memory-report-interval + ignore-positive-oom-score-adj? + run-with-higher-priority? show-debug-mess= ages? + send-notification-command) + `(,(file-append earlyoom "/bin/earlyoom") + ,@(if minimum-available-memory + (list "-m" (format #f "~s" minimum-available-memory)) + '()) + ,@(if minimum-free-swap + (list "-s" (format #f "~s" minimum-free-swap)) + '()) + ,@(if prefer-regexp + (list "--prefer" prefer-regexp) + '()) + ,@(if avoid-regexp + (list "--avoid" avoid-regexp) + '()) + "-r" ,(format #f "~s" memory-report-interval) + ,@(if ignore-positive-oom-score-adj? + (list "-i") + '()) + ,@(if run-with-higher-priority? + (list "-p") + '()) + ,@(if show-debug-messages? + (list "-d") + '()) + ,@(if send-notification-command + (list "-N" send-notification-command) + '()))))) + +(define (earlyoom-shepherd-service config) + (shepherd-service + (documentation "Run the Early OOM daemon.") + (provision '(earlyoom)) + (start #~(make-forkexec-constructor + '#$(earlyoom-configuration->command-line-args config) + #:log-file "/var/log/earlyoom.log")) + (stop #~(make-kill-destructor)))) + +(define earlyoom-service-type + (service-type + (name 'earlyoom) + (default-value (earlyoom-configuration)) + (extensions + (list (service-extension shepherd-root-service-type + (compose list earlyoom-shepherd-service)))) + (description "Run @command{earlyoom}, the Early OOM daemon."))) diff --git a/tests/services/linux.scm b/tests/services/linux.scm new file mode 100644 index 0000000000..8ad119c49f --- /dev/null +++ b/tests/services/linux.scm @@ -0,0 +1,57 @@ +;;; GNU Guix --- Functional package management for GNU +;;; Copyright =C2=A9 2020 Maxim Cournoyer +;;; +;;; This file is part of GNU Guix. +;;; +;;; GNU Guix is free software; you can redistribute it and/or modify it +;;; under the terms of the GNU General Public License as published by +;;; the Free Software Foundation; either version 3 of the License, or (at +;;; your option) any later version. +;;; +;;; GNU Guix is distributed in the hope that it will be useful, but +;;; WITHOUT ANY WARRANTY; without even the implied warranty of +;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;;; GNU General Public License for more details. +;;; +;;; You should have received a copy of the GNU General Public License +;;; along with GNU Guix. If not, see . + +(define-module (tests services linux) + #:use-module (ice-9 match) + #:use-module (gnu packages linux) + #:use-module (gnu services linux) + #:use-module (guix gexp) + #:use-module (srfi srfi-64)) + +;;; Tests for the (gnu services linux) module. + +(test-begin "linux-services") + + +;;; +;;; Early OOM daemon. +;;; + +(define earlyoom-configuration->command-line-args + (@@ (gnu services linux) earlyoom-configuration->command-line-args)) + +(define %earlyoom-configuration-sample + (earlyoom-configuration + (minimum-available-memory 10) + (minimum-free-swap 20) + (prefer-regexp "icecat") + (avoid-regexp "guix-daemon") + (memory-report-interval 60) + (ignore-positive-oom-score-adj? #f) + (run-with-higher-priority? #t) + (show-debug-messages? #f) + (send-notification-command "python \"/some/path/notify-all-users.py\"")= )) + +(test-equal "earlyoom-configuration->command-line-args" + (list (file-append earlyoom "/bin/earlyoom") + "-m" "10" "-s" "20" "--prefer" "icecat" + "--avoid" "guix-daemon" "-r" "60" "-p" + "-N" "python \"/some/path/notify-all-users.py\"") + (earlyoom-configuration->command-line-args %earlyoom-configuration-sampl= e)) + +(test-end "linux-services") --=20 2.24.1 --=-=-= Content-Type: text/plain And then enjoy your hang free system :-) Thank you, Maxim --=-=-=-- From debbugs-submit-bounces@debbugs.gnu.org Fri Jan 31 07:31:48 2020 Received: (at 39283) by debbugs.gnu.org; 31 Jan 2020 12:31:48 +0000 Received: from localhost ([127.0.0.1]:36654 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ixVSe-00073l-Jr for submit@debbugs.gnu.org; Fri, 31 Jan 2020 07:31:48 -0500 Received: from aibo.runbox.com ([91.220.196.211]:49270) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ixVSc-00070R-Nq for 39283@debbugs.gnu.org; Fri, 31 Jan 2020 07:31:47 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=runbox.com; s=rbselector1; h=Content-Transfer-Encoding:Content-Type:MIME-Version: References:In-Reply-To:Message-ID:Subject:Cc:To:From:Date; bh=XbUnfHlDyOg/1PyXRl6z27psbTJEmBW4UBXLSAqqilM=; b=mZl6qz82KS1A7RL/5MItLy+0Xp wH2d0CqRO8aESxyeiU00pFwduR1dUn+nuUU7HQN8Q4CgKxonFhxB0tc3FBv8Hs2YsSK4zgs/2cwLV j5sfxKyKNo12aKmK311Ox6Vg8CHOTfAX4qXnyrUWm7DVqyo/jziYurwaPPYBDuS34JFHajp5JMBbK ZY+ZLejCYXO2jUB4zy8TdERGXVmFU03MajgdD6Cz128eg+PMEW5Dfjbwfq+mRWygfiv+6ItldWjm1 bOubz7adEmWvAG2xFaSDvnenwaLZj47F0mfM/A1TJoez8v3VZJEEPbqqp00rbXpqkvWfMm+Ac0WpK 3nQTehTA==; Received: from [10.9.9.202] (helo=mailfront20.runbox) by mailtransmit03.runbox with esmtp (Exim 4.86_2) (envelope-from ) id 1ixVSZ-0008LC-Tp; Fri, 31 Jan 2020 13:31:44 +0100 Received: by mailfront20.runbox with esmtpsa [Authenticated alias (780724)] (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) id 1ixVSX-0008Md-RT; Fri, 31 Jan 2020 13:31:42 +0100 Date: Fri, 31 Jan 2020 12:31:39 +0000 From: pkill9 To: Maxim Cournoyer Subject: Re: bug#39283: [PATCH] gnu: Add earlyoom. Message-ID: <20200131123139.7117b0de@runbox.com> In-Reply-To: <87a764rryn.fsf@gmail.com> References: <20200125212320.12134-1-pkill9@runbox.com> <87a764rryn.fsf@gmail.com> X-Mailer: Claws Mail 3.17.4 (GTK+ 2.24.32; x86_64-unknown-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Spam-Score: -0.4 (/) X-Debbugs-Envelope-To: 39283 Cc: 39283@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.4 (-) Hi Maxim, > I happened to have prepared earlyoom recently, but delayed its > inclusion due to finishing a service for it (only the doc remains). > > I'm attaching it. My version seems slightly more complete (I generate > the doc and run the tests). If you don't have an objection I could > push it to master. I have no objection, go for it :) From debbugs-submit-bounces@debbugs.gnu.org Fri Jan 31 23:39:18 2020 Received: (at 39283-done) by debbugs.gnu.org; 1 Feb 2020 04:39:18 +0000 Received: from localhost ([127.0.0.1]:38289 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ixkYw-0007tH-8d for submit@debbugs.gnu.org; Fri, 31 Jan 2020 23:39:18 -0500 Received: from mail-qt1-f193.google.com ([209.85.160.193]:45336) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ixkYu-0007t4-LI for 39283-done@debbugs.gnu.org; Fri, 31 Jan 2020 23:39:17 -0500 Received: by mail-qt1-f193.google.com with SMTP id d9so7127815qte.12 for <39283-done@debbugs.gnu.org>; Fri, 31 Jan 2020 20:39:16 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version; bh=H3NWcU68LkCWuSF/Vi3jVwlmzjnNGI4sOw5azLtgM4Q=; b=VRkb/4s3UIENpSh/w3tDoK23x1tCC2QhSnp44xweJWsBZ117a91WrRxetSxIT3yaVe 1/xl0txndS2tEreLqsDsI4pZu5HN9G60DO/b6+JEPGew3hWjrQi1fw6VcDyJEoi50ien pIXzsoX+GOb7+Cl6VZeyb21E1Q+Jd37xEuN4uHLGTqH1+IljZ2C6WZZIW+F2Xbc/3AG8 Liu+yV3fxnbc4WxALud+suuwTEHYmlMi4FaGf8x4Xm+/yNykB81hz14h09lVvatElwUd Qlb+8Ymj/yAbvny56bxvmjzD/cZd3di/1W5BEPI3ex3J4uRe13OhbxQz9B05bmMSLX0g /R8g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:references:date:in-reply-to :message-id:user-agent:mime-version; bh=H3NWcU68LkCWuSF/Vi3jVwlmzjnNGI4sOw5azLtgM4Q=; b=XV5i/KeXUJRQrkHEAJ43ZsYkgBwgzVAPQghMSi2baoTvxPTVGrQQQ2M7DAbtKu6ABY qV0sCBVttb4mppIsNlrvVGlwTZcAF7rj6E5HRpcafzoh3ZIG26Bz720TcX3YvftE2t7D vXFecOHxoBK4VjaY/vpXQI6cI/hKLMPNYzBEb5Hn37YXkiznotj7t8lbQgWjPALXYFX9 Qxmy8R4QHpXfCcX3Fj+3ieAeeSCxOx6mtK9yXSYUI6AIb8JXqjIDr+DmTrlKoCgz0yOd DTOj6ckyhO2arIPdZaQY6Na5uH//VpDC8o5EGOk/C0nG2WzBPCQr55EVXlbslmvMwY7L QWsA== X-Gm-Message-State: APjAAAVIuKPiaaRvoTaZUZQR/gsYdusLom+vFJ0oQNi3c0DqH7D/WVuJ 6WczLoLUW2FkhjRK7+QnG/Lwe6rm X-Google-Smtp-Source: APXvYqzZbXbkY6DObD2su9dvFl+ukebngGe0xTUibvVYFCWg2Vj8kshssMgGtveZqxFPY2LWNAlrrQ== X-Received: by 2002:ac8:1ac1:: with SMTP id h1mr13921500qtk.255.1580531951080; Fri, 31 Jan 2020 20:39:11 -0800 (PST) Received: from apteryx (dsl-10-135-79.b2b2c.ca. [72.10.135.79]) by smtp.gmail.com with ESMTPSA id t2sm5590503qkc.31.2020.01.31.20.39.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 31 Jan 2020 20:39:10 -0800 (PST) From: Maxim Cournoyer To: pkill9 Subject: Re: [bug#39283] [PATCH] gnu: Add earlyoom. References: <20200125212320.12134-1-pkill9@runbox.com> <87a764rryn.fsf@gmail.com> <20200131123139.7117b0de@runbox.com> Date: Fri, 31 Jan 2020 23:39:09 -0500 In-Reply-To: <20200131123139.7117b0de@runbox.com> (pkill9@runbox.com's message of "Fri, 31 Jan 2020 12:31:39 +0000") Message-ID: <87sgjurkeq.fsf@gmail.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.3 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: 2.0 (++) X-Spam-Report: Spam detection software, running on the system "debbugs.gnu.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: pkill9 writes: > Hi Maxim, > >> I happened to have prepared earlyoom recently, but delayed its >> inclusion due to finishing a service for it (only the doc remains). >> >> I'm attaching it. My version seems slightly [...] Content analysis details: (2.0 points, 10.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider (maxim.cournoyer[at]gmail.com) -0.0 SPF_PASS SPF: sender matches SPF record 0.0 URIBL_BLOCKED ADMINISTRATOR NOTICE: The query to URIBL was blocked. See http://wiki.apache.org/spamassassin/DnsBlocklists#dnsbl-block for more information. [URIs: runbox.com] 0.0 RCVD_IN_MSPIKE_H3 RBL: Good reputation (+3) [209.85.160.193 listed in wl.mailspike.net] -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [209.85.160.193 listed in list.dnswl.org] 2.0 PDS_TONAME_EQ_TOLOCAL_SHORT Short body with To: name matches everything in local email 0.0 RCVD_IN_MSPIKE_WL Mailspike good senders X-Debbugs-Envelope-To: 39283-done Cc: 39283-done@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: 1.0 (+) pkill9 writes: > Hi Maxim, > >> I happened to have prepared earlyoom recently, but delayed its >> inclusion due to finishing a service for it (only the doc remains). >> >> I'm attaching it. My version seems slightly more complete (I generate >> the doc and run the tests). If you don't have an objection I could >> push it to master. > > I have no objection, go for it :) Merged (with the service) with commit d3e439e355. Thank you! Maxim From unknown Sun Jun 22 00:03:13 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Sat, 29 Feb 2020 12:24:05 +0000 User-Agent: Fakemail v42.6.9 # This is a fake control message. # # The action: # bug archived. thanks # This fakemail brought to you by your local debbugs # administrator