Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 07 Oct 2023 00:02:42 +0000
From:      bugzilla-noreply@freebsd.org
To:        bugs@FreeBSD.org
Subject:   [Bug 274316] excessive memory consumed by static_single_cpu_mask
Message-ID:  <bug-274316-227-ba5DjCFwhv@https.bugs.freebsd.org/bugzilla/>
In-Reply-To: <bug-274316-227@https.bugs.freebsd.org/bugzilla/>
References:  <bug-274316-227@https.bugs.freebsd.org/bugzilla/>

next in thread | previous in thread | raw e-mail | index | archive | help
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D274316

--- Comment #2 from Ed Maste <emaste@freebsd.org> ---
We can switch to run-time sizing for these, but there's a very interesting
observation used by Linux that we can adopt, to significantly reduce the me=
mory
used.

We have (currently) MAXCPU count of cpuset_ts, each with one CPU set. Note =
that
all but one of the longs making up each cpuset_t is zero.

If n=3D__bitset_words(MAXCPU) then cpuset_t is an array of long __bits[n]. =
If we
have (n-1) long zeros, 0x1, (n-1) long zeros, 0x2, (n-1) long zeros, and so=
 on,
with an appropriate offset we can use that same 0x1 for:

0000000000000000 0000000000000000 ... 0000000000000000 0000000000000001
0000000000000000 0000000000000000 ... 0000000000000001 0000000000000000
...
0000000000000000 0000000000000001 ... 0000000000000000 0000000000000000
0000000000000001 0000000000000000 ... 0000000000000000 0000000000000000

and so on for 0x2, etc.

--=20
You are receiving this mail because:
You are the assignee for the bug.=



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bug-274316-227-ba5DjCFwhv>