🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.debian.bugs.dist
Article #282

Bug#1149922: guess-concurrency: Please consider using MemTotal instead of MemAvailable for --require-mem

#282
From: Aurelien Jarno
Date: Fri, 09 Oct 2026 19:40
61 lines
4687 bytes
Hi again,

On 2026-10-09 20:09, Aurelien Jarno wrote:
> Hi Helmut,
> 
> On 2026-10-04 19:04, Helmut Grohne wrote:
> > Hi Aurelien,
> > 
> > On Sun, Oct 04, 2026 at 12:31:06PM +0200, Aurelien Jarno wrote:
> > > Thanks for providing guess-concurrency, it's a clear improvement over
> > > the number of open-coded equivalents in many debian/rules file.
> > 
> > Thank you!
> > 
> > > That said, I have observed that MemAvailable is sometimes significantly
> > > lower than expected on some build daemons. I have tracked that to the
> > > use of tmpfs as the build directory (which by the way is the default in
> > > sbuild): until the data is flushed to the swap, the corresponding memory
> > > amount disappears from MemAvailable. This causes the number of jobs to
> > > be reduced for no real reason (the memory is still be available for
> > > build), especially for packages with big sources.
> > > 
> > > Could you please consider using MemTotal instead? I think it represents
> > > better the amount of memory a build daemon is able to use.
> > 
> > I see where you are coming from. When designing it, I was considering
> > that system services (and in case of building on a desktop or laptop)
> > also user applications may consume RAM. Simply going from MemAvailable
> > to MemTotal would degrade that use case. An earlier version did use
> > MemTotal, so it is not clear cut to me just yet.
> > 
> > It seems like we do want to use some amount of swap, but swapping out
> > everything might be too much. Can we find a middle ground?
> > 
> > How about using
> > 
> >     MemAvailable + min(SwapFree, (MemTotal - MemAvailable) / 2)
> > 
> > as a better approximation? I recognize that this is not going all the
> > way that you want to go. However, it would still consider min(SwapFree,
> > MemTotal / 2) as a minimum even if MemAvailable would be fully consumed
> > with tmpfs. On systems without swap, this would result in the same
> > behavior as before the change.
> 
> While that's definitely an improvement, it's only a small improvement.  
> For a typical buildd with 16GB of RAM, if a package consists in 1GB of 
> source files, requires 4GB of build-dependencies installed in a 1GB 
> chroot, this reduces the available memory size as guessed by 
> guess-concurrency from 16GB to 13GB instead of 16GB to 10GB.

The memory used by tmpfs, but not yet swapped, appears in "Shmem". 
Therefore how about using

  MemAvailable + min(SwapFree, Shmem) ?

Regards
Aurelien

-- 
Aurelien Jarno                          GPG: 4096R/1DDD8C9B
aurelien@aurel32.net                     http://aurel32.net
Technical Details
Message-ID: <NMoBI-4xWS-29@gated-at.bofh.it>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!news.corradoroberto.it!news.servidellagleba.it!bofh.it!news.nic.it!robomod
References: <NKrNn-3tTU-1@gated-at.bofh.it> <NLk77-3WQi-15@gated-at.bofh.it> <NMnmh-4xlK-1@gated-at.bofh.it> <NKrNn-3tTU-1@gated-at.bofh.it> <NMnmh-4xlK-1@gated-at.bofh.it>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!news.corradoroberto.it!news.servidellagleba.it!bofh.it!news.nic.it!robomod
From: Aurelien Jarno <aurel32@debian.org>
Newsgroups: linux.debian.bugs.dist
Subject: Bug#1149922: guess-concurrency: Please consider using MemTotal instead of MemAvailable for --require-mem
Date: Fri, 09 Oct 2026 21:40:02 +0200
Message-ID: <NMoBI-4xWS-29@gated-at.bofh.it>
References: <NKrNn-3tTU-1@gated-at.bofh.it> <NLk77-3WQi-15@gated-at.bofh.it> <NMnmh-4xlK-1@gated-at.bofh.it> <NKrNn-3tTU-1@gated-at.bofh.it> <NMnmh-4xlK-1@gated-at.bofh.it>
X-Mailbox-Line: From debian-bugs-dist-request@lists.debian.org  Fri Oct  9 19:32:41 2026
Old-Return-Path: <debbugs@buxtehude.debian.org>
X-Spam-Flag: NO
X-Spam-Score: -1.699
Reply-To: Aurelien Jarno <aurel32@debian.org>, 1149922@bugs.debian.org
Resent-To: debian-bugs-dist@lists.debian.org
Resent-Cc: helmut@subdivi.de
X-Debian-Pr-Message: followup 1149922
X-Debian-Pr-Package: src:guess-concurrency
X-Debian-Pr-Source: guess-concurrency
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
User-Agent: Mutt/2.4.1 (2026-07-04)
X-Debian-User: aurel32
X-Debian-Message: from BTS
X-Mailing-List: <debian-bugs-dist@lists.debian.org> archive/latest/1995948
List-ID: <debian-bugs-dist.lists.debian.org>
List-URL: <https://lists.debian.org/debian-bugs-dist/>
Approved: robomod@news.nic.it
Lines: 61
Organization: linux.* mail to news gateway
Sender: robomod@news.nic.it
X-Original-Cc: 1149922@bugs.debian.org
X-Original-Date: Fri, 9 Oct 2026 20:48:40 +0200
X-Original-Message-ID: <ask3CL84zWE2dXOh@aurel32.net>
X-Original-References: <179110986695.1235681.8806750415812659926.reportbug@ohm.local> <20261004170411.GB3267@subdivi.de> <askt7xcP97t61BFT@aurel32.net> <179110986695.1235681.8806750415812659926.reportbug@ohm.local> <askt7xcP97t61BFT@aurel32.net>