From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp12.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms5.migadu.com with LMTPS id CNnsCXATYWIEPAEAbAwnHQ (envelope-from ) for ; Thu, 21 Apr 2022 10:18:56 +0200 Received: from aspmx1.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp12.migadu.com with LMTPS id IHfSCXATYWK9HwAAauVa8A (envelope-from ) for ; Thu, 21 Apr 2022 10:18:56 +0200 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id CA4B5284F0 for ; Thu, 21 Apr 2022 10:18:55 +0200 (CEST) Received: from localhost ([::1]:33140 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nhS1e-00087Y-Ll for larch@yhetil.org; Thu, 21 Apr 2022 04:18:54 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:38908) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nhRhT-0007je-8w for bug-guix@gnu.org; Thu, 21 Apr 2022 03:58:06 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:54386) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nhRhR-0002iS-O1 for bug-guix@gnu.org; Thu, 21 Apr 2022 03:58:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1nhRhR-0003SW-MK for bug-guix@gnu.org; Thu, 21 Apr 2022 03:58:01 -0400 X-Loop: help-debbugs@gnu.org Subject: bug#54783: ZRAM default priority wrong Resent-From: Josselin Poiret Original-Sender: "Debbugs-submit" Resent-CC: bug-guix@gnu.org Resent-Date: Thu, 21 Apr 2022 07:58:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 54783 X-GNU-PR-Package: guix X-GNU-PR-Keywords: To: Stefan Baums , 54783@debbugs.gnu.org Received: via spool by 54783-submit@debbugs.gnu.org id=B54783.165052788013289 (code B ref 54783); Thu, 21 Apr 2022 07:58:01 +0000 Received: (at 54783) by debbugs.gnu.org; 21 Apr 2022 07:58:00 +0000 Received: from localhost ([127.0.0.1]:48283 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nhRhQ-0003SG-Gu for submit@debbugs.gnu.org; Thu, 21 Apr 2022 03:58:00 -0400 Received: from jpoiret.xyz ([206.189.101.64]:47280) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nhRhO-0003S7-W1 for 54783@debbugs.gnu.org; Thu, 21 Apr 2022 03:57:59 -0400 Received: from authenticated-user (jpoiret.xyz [206.189.101.64]) by jpoiret.xyz (Postfix) with ESMTPA id 375181851E0; Thu, 21 Apr 2022 07:57:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=jpoiret.xyz; s=dkim; t=1650527877; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=vAMMG81WrU7JImwWY877SIsNgFQYDcGucQHFbk9ekfA=; b=QZb695BvbF/lX4m2BepGSFynNG5O4VmIijsJTgzWK1Fbdp/e/eAZWfHlPGioYVYsSfGlAu +2LHU4swhsbyytYfJEGmIm5IVvqKHCDPNqE0rjllnS7v7db0B4TM4AKROE7QpDU6azJ567 0h2dk0L+UtW6xl6NsQ2KNAQ/yYmKKoWTFf3WL4W4mSBDiWfOfWc0HxYUHa02tCSi5Syx6d mO9Lz1QzKnxpekMJeXCb6omG4GtvpRmdXizv6is1VutTE0ZAw2n5doS3KlI3TDCKEUZQw5 o19MIapN2poxRJUhDiK6PGouHWtkiaASvp5shf5NmOQloO5rku/TsYbsJvE0UQ== In-Reply-To: <878rsgfgxg.fsf@lmu.de> References: <878rsgfgxg.fsf@lmu.de> Date: Thu, 21 Apr 2022 09:57:56 +0200 Message-ID: <87sfq6g96j.fsf@jpoiret.xyz> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spamd-Bar: / X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-guix@gnu.org List-Id: Bug reports for GNU Guix List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-guix-bounces+larch=yhetil.org@gnu.org Sender: "bug-Guix" Reply-to: Josselin Poiret From: Josselin Poiret via Bug reports for GNU Guix X-Migadu-Flow: FLOW_IN X-Migadu-To: larch@yhetil.org X-Migadu-Country: US ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1650529136; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding:resent-cc: resent-from:resent-sender:resent-message-id:in-reply-to:in-reply-to: references:references:list-id:list-help:list-unsubscribe: list-subscribe:list-post:dkim-signature; bh=vAMMG81WrU7JImwWY877SIsNgFQYDcGucQHFbk9ekfA=; b=rej4vv3pKo3Iik7DJ1GS6ckrmUviFBxEO5tm9XjpMQzmTiPvzkcSJTfq78GkiR8Ftb4zfZ u4CZSZBqACHQHdLLRHhIt354r4nY83uMd49EyTIuKSDCO7dm/ii5VI5ZLsT1Dgi7ysFDf7 a1zoBaQzHURupvJPdmKGBG537XYeKElyEp0cqijtxSV22ikYajyEQn0L8nawZ/xnJUJyzI CMp2Yn8vFuSbb20Nh7UFFDVQ8MjDPhF/ikrdLawNaYpMIjCOr7jckfB/TfrIc5FL3LYEYl I+KPZOYOZzFZrtsqbYa49V4x3asDPM+oGUnQswzL076/k1WZgSk6vu2mzNYYvA== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1650529136; a=rsa-sha256; cv=none; b=szoMymB8aufKrpQaucJ7B/bRO2xx7cybgUtXs9oGVGvE9qdyAF/L8zQlQnVTB1SjlCG2UM DrY5xXoyCQqCKq73RAh41VwqFFslyUEqd+R2RiYc9z0JYdLkbOqwbGu1HMFNQt6Frq+t8g KvAz8WAjB23fbvCmm2ABEEenfMom0qXyqROQ11NvJYPtxG3WDVmvHY9aJlz8XLJqII6Yf0 iggojSeF9DxXK5D+6klPJo3xisiy0RqFrmpu2v9VYNJ+xJAKjfqnu+T7o+2ao0Kt26TiiI ON7oWbVbQkc111ebCyrnfzCuqGUJtZIYjuodDIRqcz0c5dob5k0NdCbHHZKBAQ== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=jpoiret.xyz header.s=dkim header.b=QZb695Bv; dmarc=pass (policy=none) header.from=gnu.org; spf=pass (aspmx1.migadu.com: domain of "bug-guix-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="bug-guix-bounces+larch=yhetil.org@gnu.org" X-Migadu-Spam-Score: -2.04 Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=jpoiret.xyz header.s=dkim header.b=QZb695Bv; dmarc=pass (policy=none) header.from=gnu.org; spf=pass (aspmx1.migadu.com: domain of "bug-guix-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="bug-guix-bounces+larch=yhetil.org@gnu.org" X-Migadu-Queue-Id: CA4B5284F0 X-Spam-Score: -2.04 X-Migadu-Scanner: scn1.migadu.com X-TUID: i94YAgXgNJZE Hello Stefan and sorry for the late reply, Stefan Baums writes: > The manual wrongly claims that the default priority for zram is > -1. The same paragraph of the manual also says: > > =E2=80=98swapon=E2=80=99 accepts values between -1 and 32767, with hig= her > values indicating higher priority. > > which makes the -2 priority of the swap file look suspect (though > it seems to work). This issue comes from the inconsistency with which swap priorities are specified on Linux: `swapon` the binary from util-linux (man 8 swapon) has roughly the same description as above, but internally uses the syscall wrapper `swapon` from libc (man 2 swapon), which has a better description of priorities. The official interpretation of priorities for the syscall is summarized in the "Swap space" part of the Guix manual: A swap space can have no priority, or a priority specified as an integer between 0 and 32767. The kernel will first use swap spaces of higher priority when paging, and use same priority spaces on a round-robin basis. The kernel will use swap spaces without a set priority after prioritized spaces, and in the order that they appeared in (not round-robin). Note that these are called high (for specified priority) or low (unspecified) priority in `man 2 swapon` but that's a bit of a misnomer. So, `swapon` the binary actually maps -1 to no (low) priority, and there actually is no -1 priority in the Linux kernel ABI! Since your actual swap file is swapon'd first, and also has no priority set, according to the rules above it will be used before the ZRAM which also has no priority. On the Guix side of things, we should really be using the same interface as swap-space, as I think the distinction between #f and 0 to 32767 is clearer. I'll send some patches that adress this soon, along with the zram-service-type documentation. Best, --=20 Josselin Poiret