🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: linux.debian.bugs.dist
5 messages
5 total messages Started by Aurelien Jarno Fri, 09 Oct 2026 18:20
Bug#1149922: guess-concurrency: Please consider using MemTotal instead of MemAvailable for --require-mem
#272
Author: Aurelien Jarno
Date: Fri, 09 Oct 2026 18:20
56 lines
4515 bytes
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.

At the end it still increases the package build time, and results in 
an inefficient use of our buildd hardware.

Regards
Aurelien

-- 
Aurelien Jarno                          GPG: 4096R/1DDD8C9B
aurelien@aurel32.net                     http://aurel32.net
Bug#1149922: guess-concurrency: Please consider using MemTotal instead of MemAvailable for --require-mem
#282
Author: 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
Bug#1149922: guess-concurrency: Please consider using MemTotal instead of MemAvailable for --require-mem
#342
Author: Helmut Grohne
Date: Sat, 10 Oct 2026 10:10
19 lines
2823 bytes
Hi Aurelien and Adrian,

On Fri, Oct 09, 2026 at 08:48:40PM +0200, Aurelien Jarno wrote:
> The memory used by tmpfs, but not yet swapped, appears in "Shmem". 
> Therefore how about using
> 
>   MemAvailable + min(SwapFree, Shmem) ?

Thank you for this suggestion. I implemented this in
https://salsa.debian.org/helmutg/guess_concurrency/-/commit/12e7a4d1d72d31fa0c731912985c0069210f3974.
Would you confirm that it adequately solves your problem?

Adrian, I also expanded the documentation given your feedback. Could you
have a look at
https://salsa.debian.org/helmutg/guess_concurrency/-/commit/55a7a06d2653a459855c476c914c31d5886f8c06
and let me know whether it adequately addresses your legitimate
concerns?

Helmut
Bug#1149922: guess-concurrency: Please consider using MemTotal instead of MemAvailable for --require-mem
#375
Author: Adrian Bunk
Date: Sat, 10 Oct 2026 15:50
18 lines
2566 bytes
On Sat, Oct 10, 2026 at 12:00:26PM +0200, Helmut Grohne wrote:
> Hi Aurelien and Adrian,

Hi Helmut,

>...
> Adrian, I also expanded the documentation given your feedback. Could you
> have a look at
> https://salsa.debian.org/helmutg/guess_concurrency/-/commit/55a7a06d2653a459855c476c914c31d5886f8c06
> and let me know whether it adequately addresses your legitimate
> concerns?

thanks, that looks better.

> Helmut

cu
Adrian
Bug#1149922: guess-concurrency: Please consider using MemTotal instead of MemAvailable for --require-mem
#386
Author: Aurelien Jarno
Date: Sat, 10 Oct 2026 17:50
30 lines
3293 bytes
Hi Helmut,

On 2026-10-10 12:00, Helmut Grohne wrote:
> Hi Aurelien and Adrian,
> 
> On Fri, Oct 09, 2026 at 08:48:40PM +0200, Aurelien Jarno wrote:
> > The memory used by tmpfs, but not yet swapped, appears in "Shmem". 
> > Therefore how about using
> > 
> >   MemAvailable + min(SwapFree, Shmem) ?
> 
> Thank you for this suggestion. I implemented this in
> https://salsa.debian.org/helmutg/guess_concurrency/-/commit/12e7a4d1d72d31fa0c731912985c0069210f3974.
> Would you confirm that it adequately solves your problem?

Yes, this solves the issue. It still return a bit less than the RAM 
available, depending on what is running on the host on the moment 
guess-concurrency is run (e.g. puppet run), but this is already a 
significant improvement.

For the vtk9 case, that will increase the number of jobs on a host with 
16GB RAM from 2 to 3. The next step is to work with the maintainer to 
define the correct required memory size.

Regards
Aurelien

-- 
Aurelien Jarno                          GPG: 4096R/1DDD8C9B
aurelien@aurel32.net                     http://aurel32.net
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads