[systemd-devel] Antw: [EXT] Re: minimum space needed for reload/reexec

Zbigniew Jędrzejewski-Szmek zbyszek at in.waw.pl
Wed Jun 30 14:18:07 UTC 2021


On Wed, Jun 30, 2021 at 02:14:36PM +0200, Ulrich Windl wrote:
> >>> "CHEN, Jack" <zenghuchen at siemens.com> schrieb am 30.06.2021 um 13:39 in
> Nachricht
> <BYAPR07MB5927C804D4314E586DCB3332D4019 at BYAPR07MB5927.namprd07.prod.outlook.com>
> 
> > Hi,
> > 
> > I happen to see to a fix in system, which adds a space checking before 
> > reload/reexec.
> > From the code:
> > Require 16MiB free in /run/systemd for reloading/reexecing. After all we 
> > need to serialize our state there, and if
> > * we can't we'll fail badly
> > #define RELOAD_DISK_SPACE_MIN (UINT64_C(16) * UINT64_C(1024) * 
> > UINT64_C(1024))
> > And I got further explanation from poettering:
> > it's a "safety buffer", see commit msg of the fix. It's set to 16M because 
> > it has to be set to something, and it sounded like a reasonably value, and
> so 
> > far we got no feedback to the contrary
> > 
> > However, just for “serialize our state there”, literally, there is no need 
> > for such a big space (16M).
> > There is no problem for PC. But for embedded devices, 16M is quite
> prodigal.
> > And in my test, even 1M free space would allow reloading/reexecing to work 
> > normally.
> > 
> > Shall we remove this restriction? (Removing I mean we just check if there is
> 
> > free space or not) Or at least lower the threshold.
> > It is not good to forbid reloading/reexecing when there is enough free 
> > space, just because it is smaller than the threshold (16M)。
> 
> The obvious solution seems to be:
> 1) Monitor the actual memory usage across different platforms
> 2) Add 25% to set the final value
> Or if really paranoid: use four times the maximum measured value ;-)

Four times the measured value seems reasonable. Or maybe
derive some measure that applies to an "average unit" and multiply
it by the number of loaded units times four.

I guess adding a log message what the size of the serialized buffer
is as part of reload would be a very good first step.

Zbyszek


More information about the systemd-devel mailing list