From nobody Mon Jan 10 12:55:56 2022 X-Original-To: freebsd-hackers@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id CA03819494EF for ; Mon, 10 Jan 2022 12:56:02 +0000 (UTC) (envelope-from ralph41096@protonmail.com) Received: from mail-4319.protonmail.ch (mail-4319.protonmail.ch [185.70.43.19]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "protonmail.com", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4JXYjG0V0nz4l3P for ; Mon, 10 Jan 2022 12:56:02 +0000 (UTC) (envelope-from ralph41096@protonmail.com) Date: Mon, 10 Jan 2022 12:55:56 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=protonmail.com; s=protonmail2; t=1641819359; bh=23l4Y/DxPb/6whLVYkIauFHAjCcVo2pw5zlCULR+njM=; h=Date:To:From:Reply-To:Subject:Message-ID:From:To:Cc; b=nPmHR5syhPh/TOoRkdoho4VyYmDKq+M/QeqzGsRTVSzS8GEm+rIRmP9Z7uiDQXa/p mKe0b9EbUka7fTM6A/AuoPDnuLCUDJzUYY+FLy/FQpbGg0pQ/URdf95uATI/mSGF0c bo8b0hf/mWJpZqe8myj65OZ4vJwYwwlkm1rCYM9bUP10CZ5Z3bxQxafyFwJ1R4ol5B oet1bIKSvx6t8UbPDPOkbjIC9VNk1rbZbaCRL0Gq1oF00Fv17fjQPEmZ4cZ7agHDx9 aSWA/+oDBQrfMAJ1gXdvJjTEc/fm7jy6lXk3ulkrDwMZTO0jlbb1bbYstrfpSZcVdu CuZLNldZSil8A== To: "freebsd-hackers@freebsd.org" From: ralph41096 Reply-To: ralph41096 Subject: Out-of-swap killer and SIGTERM signal Message-ID: List-Id: Technical discussions relating to FreeBSD List-Archive: https://lists.freebsd.org/archives/freebsd-hackers List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-hackers@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-0.7 required=10.0 tests=ALL_TRUSTED,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_ENVFROM_END_DIGIT, FREEMAIL_FROM,FREEMAIL_REPLYTO_END_DIGIT shortcircuit=no autolearn=disabled version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on mailout.protonmail.ch X-Rspamd-Queue-Id: 4JXYjG0V0nz4l3P X-Spamd-Bar: + Authentication-Results: mx1.freebsd.org; dkim=pass header.d=protonmail.com header.s=protonmail2 header.b=nPmHR5sy; dmarc=pass (policy=quarantine) header.from=protonmail.com; spf=pass (mx1.freebsd.org: domain of ralph41096@protonmail.com designates 185.70.43.19 as permitted sender) smtp.mailfrom=ralph41096@protonmail.com X-Spamd-Result: default: False [1.98 / 15.00]; HAS_REPLYTO(0.00)[ralph41096@protonmail.com]; ARC_NA(0.00)[]; R_DKIM_ALLOW(-0.20)[protonmail.com:s=protonmail2]; REPLYTO_EQ_FROM(0.00)[]; FROM_HAS_DN(0.00)[]; RWL_MAILSPIKE_GOOD(0.00)[185.70.43.19:from]; FREEMAIL_FROM(0.00)[protonmail.com]; TO_MATCH_ENVRCPT_ALL(0.00)[]; MIME_GOOD(-0.10)[text/plain]; FREEMAIL_REPLYTO(0.00)[protonmail.com]; NEURAL_SPAM_SHORT(0.99)[0.992]; NEURAL_SPAM_MEDIUM(0.99)[0.994]; RCPT_COUNT_ONE(0.00)[1]; R_SPF_ALLOW(-0.20)[+ip4:185.70.43.0/24]; DKIM_TRACE(0.00)[protonmail.com:+]; DMARC_POLICY_ALLOW(-0.50)[protonmail.com,quarantine]; NEURAL_SPAM_LONG(1.00)[0.998]; TO_DN_EQ_ADDR_ALL(0.00)[]; RCVD_COUNT_ZERO(0.00)[0]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+]; FREEMAIL_ENVFROM(0.00)[protonmail.com]; ASN(0.00)[asn:62371, ipnet:185.70.43.0/24, country:CH]; MID_RHS_MATCH_FROM(0.00)[] X-ThisMailContainsUnwantedMimeParts: N Hello, Do you think it would be a good idea to introduce the following soft mode for the Out-of-swap killer? Old behaviour: 1) If there is no free swap space left, send SIGKILL signals to the condemned processes. (This is the hard mode.) New behaviour: 1) If there is less than 2 GiB of free swap space, send SIGTERM signals to the condemned processes, then wait for a 5 seconds grace period, then send SIGKILL signals to the condemned processes who are still running. 2) Repeat step 1) until the amount of free swap space becomes greater than 2 GiB. (This is the soft mode.) 3) If the soft mode does not release swap space fast enough, and the amount of free swap space becomes zero, enter hard mode and immediately send SIGKILL signals to the condemned processes. These two system-wide parameters (2 GiB of free swap space, 5 seconds grace period) could be defined in a configuration file, to allow the administrator to change them. The intent is to allow condemned processes to write some data on persistent storage and exit gracefully, when the shortage of swap space does not happen too quickly. Ambert