GNU bug report logs - #54783
ZRAM default priority wrong

Previous Next

Package: guix;

Reported by: Stefan Baums <baums <at> stefanbaums.com>

Date: Fri, 8 Apr 2022 04:21:02 UTC

Severity: normal

Done: Maxim Cournoyer <maxim.cournoyer <at> gmail.com>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: help-debbugs <at> gnu.org (GNU bug Tracking System)
To: Maxim Cournoyer <maxim.cournoyer <at> gmail.com>
Cc: tracker <at> debbugs.gnu.org
Subject: bug#54783: closed (ZRAM default priority wrong)
Date: Sat, 11 Jun 2022 05:57:02 +0000
[Message part 1 (text/plain, inline)]
Your message dated Sat, 11 Jun 2022 01:56:38 -0400
with message-id <878rq3g2uh.fsf <at> gmail.com>
and subject line Re: bug#54783: ZRAM default priority wrong
has caused the debbugs.gnu.org bug report #54783,
regarding ZRAM default priority wrong
to be marked as done.

(If you believe you have received this mail in error, please contact
help-debbugs <at> gnu.org.)


-- 
54783: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=54783
GNU Bug Tracking System
Contact help-debbugs <at> gnu.org with problems
[Message part 2 (message/rfc822, inline)]
From: Stefan Baums <baums <at> stefanbaums.com>
To: bug-guix <at> gnu.org
Subject: ZRAM default priority wrong
Date: Thu, 07 Apr 2022 22:27:23 -0400
I have a swap file and zram configured without specifying
priority. The swap file was assigned -2, and zram -3, with the
effect that zram was never used. I had to manually change the zram
priority to something higher that that of the swap file.

The manual wrongly claims that the default priority for zram is
-1. The same paragraph of the manual also says:

   ‘swapon’ accepts values between -1 and 32767, with higher
   values indicating higher priority.

which makes the -2 priority of the swap file look suspect (though
it seems to work).


[Message part 3 (message/rfc822, inline)]
From: Maxim Cournoyer <maxim.cournoyer <at> gmail.com>
To: Josselin Poiret <dev <at> jpoiret.xyz>
Cc: 54783-done <at> debbugs.gnu.org, Stefan Baums <baums <at> stefanbaums.com>
Subject: Re: bug#54783: ZRAM default priority wrong
Date: Sat, 11 Jun 2022 01:56:38 -0400
Hi Josselin,

[...]
>
> 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.

I've made this smallish change:

--8<---------------cut here---------------start------------->8---
modified   gnu/services/linux.scm
@@ -296,14 +296,12 @@ (define (zram-device-configuration->udev-string config)
          "")
        "RUN+=\"/run/current-system/profile/sbin/mkswap /dev/zram0\" "
        "RUN+=\"/run/current-system/profile/sbin/swapon "
-       ;; XXX: The field is delayed while the deprecation warning remains in
-       ;; place, so we can't use match to fetch it (it would give a promise)
-       (if (zram-device-configuration-priority config)
-           (string-append "--priority "
-                          (number->string
-                           (zram-device-configuration-priority config))
-                          " ")
-         "")
+       ;; TODO: Revert to simply use 'priority' after removing the deprecation
+       ;; warning and the delayed property of the field.
+       (let ((priority* (force priority)))
+         (if priority*
+             (format #f "--priority ~a " priority*)
+             ""))
        "/dev/zram0\"\n"))))
 
 (define %zram-device-config
 
--8<---------------cut here---------------end--------------->8---

Because the TODO comments seems more actionable for my future self, and
pushed as a99015c878.

Thanks Stefan for reporting the issue and for Josselin for fixing it!

Closing.

Maxim


This bug report was last modified 3 years and 38 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.