[systemd-devel] systemctl show outputs incorrect MemoryCurrent value
Reindl Harald
h.reindl at thelounge.net
Wed Jul 25 23:19:46 UTC 2018
Am 25.07.2018 um 17:49 schrieb Lennart Poettering:
> On Mi, 25.07.18 17:06, Reindl Harald (h.reindl at thelounge.net) wrote:
>
>> Am 25.07.2018 um 17:01 schrieb Lennart Poettering:
>>> On Mi, 25.07.18 11:23, George Xie (georgexsh at gmail.com) wrote:
>>>
>>>> thanks for your reply.
>>>>
>>>> odds enough, on both aforementioned boxes, MemoryAccounting is set
>>>> to no:
>>>
>>> On old systemd versions we'd fill in the account props if the kernel
>>> had the data even if MemoryAccounting was not turned on. This has been
>>> changed in more recent versions, where all accounting props will
>>> report 2^64-1 unless accounting has been turned on for them.
>>
>> why?
>>
>> i mean why not just skip that output at all or at least ouput 0 instean
>> an arbitary number?
>
> The dbus property model doesn't know a concept of "unset". And if
> something uses 0 memory then this is actually completely valid, it
> just means "no memory currently used". We need to be able to
> distinguish "no memory" from "i have no information about memory
> use" and hence encode the former as 0 and the latter as 2^64-1 (aka
> UINT64_MAX, aka (uint64_t) -1)
dealing internally with surch arbiatry numbers is still a differnt world
than ouput it in a user-tool like "systemctl show" which could simply
translate it to some meaningful string
no user cares about UINT64_MAX in such outputs
More information about the systemd-devel
mailing list