#1105740 arc_summary data target values nonsensical

#1105740#5
Date:
2025-05-14 03:13:48 UTC
From:
To:
Hello,

In arc_summary's states breakdown, I noticed these rows:

  MFU data target:  -373596196279.3 %  -27644722171524358144 Bytes

  MRU data target:                     373596196366.3 %   24.0 EiB

I think these are wrong. I'm guessing some sort of signed arithmetic bug.

Full arc_summary output and /proc/spl/kstat/zfs/arcstats attached.

#1105740#10
Date:
2025-07-30 13:49:30 UTC
From:
To:
Hi,

arcstat is a python script [1], so it should have singed conversion problems.

From [1] we can see the calculation:

* s = 4294967296 = 2^32
* MFU data target: v = (s-int(pd))*(s-int(meta))/s
* MRU data target: v = int(pd)*(s-int(meta))/s
* MRU metadata target: v = int(pm)*int(meta)/s

Since MRU metadata target looks normal, meta and s should all be good.
By some calculation we know pd ~= -1.60e19, which is close to ~2^63.8.
And this number is read directly from /proc/spl/kstat/zfs.

I did not have time to investigate further, but I am sure this is some
issue from the zfs kmod statistics (maybe still signed / unsigned).
Does this problem reproduces after a reboot?

[1]: https://github.com/openzfs/zfs/blob/10a78e26479325a40ace80198249a36906b4d446/cmd/arc_summary#L629

Thanks,
Shengqi Chen

#1105740#15
Date:
2025-07-30 13:55:35 UTC
From:
To:
Hi,

I meant “should not” here.

Thanks,
Shengqi Chen

#1105740#20
Date:
2025-07-31 03:06:41 UTC
From:
To:
Hello,

The pd value in arcstats does look like it has nearly twice as many digits
in it than it's supposed to, so I'm inclined to agree that it's more likely
a kernel problem than userspace problem.  FWIW my zpool is 32TB (3x12TB
disks) and is in the household NAS, which also shares its 32GB RAM with a
handful of LXD containers.

As it happens there was a reboot yesterday. Values have returned to being
plausible values (for now!):

root@grook:~# arc_summary |grep data\ target
        MFU data target:                               49.7 %    3.0 GiB
        MFU metadata target:                            8.8 %  541.1 MiB
        MRU data target:                               32.7 %    2.0 GiB
        MRU metadata target:                            8.8 %  541.1 MiB

I'll keep an eye on it.  There have been both kernel and zfs updates in the
meantime, so I expect there's a possibility that the problem fixed itself.