🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

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

#255
From: Adrian Bunk
Date: Fri, 09 Oct 2026 14:40
101 lines
6721 bytes
On Sun, Oct 04, 2026 at 07:04:11PM +0200, 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.
> 
> Can you give me an idea of whether that would improve the buildd use
> case? Would it be a sufficient improvement in your view?

Let me try to explain the severity of the problem caused by 
guess-concurrency.

IMHO the most important fix would be to make it clear in the 
documentation that guess-concurrency should only be used when
***really*** necessary.

Sometimes guess-concurrency is used with an insanely high value 
(#1149937), people guessing numbers is just harmful.

From a decade of experience keeping packages alive on 32-bit I can tell 
that it is usually exactly one ld call or the one compilation of the 
swig-generated Python bindings for a C++ library that is the memory hog.
Using guess-concurrency does not make much sense in this typical case.
Packages where the maximum memory usage scales with the number of cores 
do exist, but they are rare.

On 32-bit architectures, requiring more memory per process than the 
address space available for a process is obviously wrong.

In [1] the removal of guess-concurrency in my 9.6.2+ds-2+test1 package
uses 6 instead of 2 cores on the buildd, resulting in a 2.76x build time
difference. A 2.76x speedup for a 3x increase in the number of cores is
as close to perfect scaling as might happen practice.

In practice we have to pick one of the following:
1. treat build time increases due to guess-concurrency as RC bugs, or
2. drop riscv64 as release architecture

And I mean 2. seriously, [2] increases the build time of a package 
currently involved in a transition from 4 to 6 days on the slower 
buildds due to only using 2 instead of 4 cores. Even on the new faster 
buildds[3] it would likely also push the build time above 2 days.

And riscv64 is just the tip of the iceberg:
We spent a decade getting parallel builds working in nearly all packages,
we don't want to lose a large part of that when people start modifying 
packages on a large scale with super-high guessed limits to
guess-concurrency - requiring in the need for more buildds on multiple 
architectures.

And you also want to be conservative regarding how to calculate the 
available memory. Not using all cores on a 4-core riscv64 buildd with
16 GB RAM because your proposed formula would use only 3 cores when
an uploader used 4 GB as guessed value[4] - that's just bad.

Can we agree that guess-concurrency increasing build times is a bad 
thing that should usually result in an RC bug, or do you insist on
killing riscv64?

> Helmut

cu
Adrian

[1] https://buildd.debian.org/status/logs.php?pkg=vtk9&arch=i386
[2] https://buildd.debian.org/status/logs.php?pkg=vtk9&arch=riscv64
[3] rv-manda-0{2,4}
[4] which seems to be the most common uploader guess
Technical Details
Message-ID: <NMjVn-4tFB-5@gated-at.bofh.it>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!2.eu.feeder.erje.net!3.eu.feeder.erje.net!feeder.erje.net!newsfeed.bofh.team!news.samoylyk.net!gothmog.csi.it!bofh.it!news.nic.it!robomod
References: <NKrNn-3tTU-1@gated-at.bofh.it> <NKrNn-3tTU-1@gated-at.bofh.it> <NLk77-3WQi-15@gated-at.bofh.it> <NKrNn-3tTU-1@gated-at.bofh.it> <NLk77-3WQi-15@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!2.eu.feeder.erje.net!3.eu.feeder.erje.net!feeder.erje.net!newsfeed.bofh.team!news.samoylyk.net!gothmog.csi.it!bofh.it!news.nic.it!robomod
From: Adrian Bunk <bunk@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 16:40:01 +0200
Message-ID: <NMjVn-4tFB-5@gated-at.bofh.it>
References: <NKrNn-3tTU-1@gated-at.bofh.it> <NKrNn-3tTU-1@gated-at.bofh.it> <NLk77-3WQi-15@gated-at.bofh.it> <NKrNn-3tTU-1@gated-at.bofh.it> <NLk77-3WQi-15@gated-at.bofh.it>
X-Mailbox-Line: From debian-bugs-dist-request@lists.debian.org  Fri Oct  9 14:33:08 2026
Old-Return-Path: <debbugs@buxtehude.debian.org>
X-Spam-Flag: NO
X-Spam-Score: -1.7
Reply-To: Adrian Bunk <bunk@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=utf-8
Content-Disposition: inline
X-Debian-User: bunk
X-Debian-Message: from BTS
X-Mailing-List: <debian-bugs-dist@lists.debian.org> archive/latest/1995900
List-ID: <debian-bugs-dist.lists.debian.org>
List-URL: <https://lists.debian.org/debian-bugs-dist/>
Approved: robomod@news.nic.it
Lines: 101
Organization: linux.* mail to news gateway
Sender: robomod@news.nic.it
X-Original-Cc: Aurelien Jarno <aurel32@debian.org>
X-Original-Date: Fri, 9 Oct 2026 17:31:45 +0300
X-Original-Message-ID: <asj60euNxKdkuC_V@localhost>
X-Original-References: <179110986695.1235681.8806750415812659926.reportbug@ohm.local> <179110986695.1235681.8806750415812659926.reportbug@ohm.local> <20261004170411.GB3267@subdivi.de> <179110986695.1235681.8806750415812659926.reportbug@ohm.local> <20261004170411.GB3267@subdivi.de>