unofficial mirror of bug-guix@gnu.org 
 help / color / mirror / code / Atom feed
From: Josselin Poiret via Bug reports for GNU Guix <bug-guix@gnu.org>
To: Stefan Baums <baums@stefanbaums.com>, 54783@debbugs.gnu.org
Subject: bug#54783: ZRAM default priority wrong
Date: Thu, 21 Apr 2022 09:57:56 +0200	[thread overview]
Message-ID: <87sfq6g96j.fsf@jpoiret.xyz> (raw)
In-Reply-To: <878rsgfgxg.fsf@lmu.de>

Hello Stefan and sorry for the late reply,

Stefan Baums <baums@stefanbaums.com> writes:

> 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).

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,
-- 
Josselin Poiret




  reply	other threads:[~2022-04-21  8:18 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-04-08  2:27 bug#54783: ZRAM default priority wrong Stefan Baums
2022-04-21  7:57 ` Josselin Poiret via Bug reports for GNU Guix [this message]
2022-04-21  8:06   ` Stefan Baums
2022-04-21 13:49   ` bug#54783: [PATCH 1/2] system: Align zram priority with swap-space spec to clarify Josselin Poiret via Bug reports for GNU Guix
2022-05-24 15:42     ` bug#54783: ZRAM default priority wrong Maxim Cournoyer
2022-05-24 17:16       ` bug#54783: [v2 0/2] Clarify zram priority Josselin Poiret via Bug reports for GNU Guix
2022-05-24 17:16         ` bug#54783: [PATCH v2 1/2] system: Align zram priority with swap-space spec to clarify Josselin Poiret via Bug reports for GNU Guix
2022-05-24 17:16         ` bug#54783: [PATCH v2 2/2] doc: Remove double copyright Josselin Poiret via Bug reports for GNU Guix
2022-04-21 13:49   ` bug#54783: [PATCH " Josselin Poiret via Bug reports for GNU Guix
2022-06-11  5:56   ` bug#54783: ZRAM default priority wrong Maxim Cournoyer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://guix.gnu.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87sfq6g96j.fsf@jpoiret.xyz \
    --to=bug-guix@gnu.org \
    --cc=54783@debbugs.gnu.org \
    --cc=baums@stefanbaums.com \
    --cc=dev@jpoiret.xyz \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).