On 2024-03-06 at 21:54:02 +0000, Luck, Tony wrote:
Figuring out if SNC is enabled is only one part of the problem, the other being whether the kernel supports it. As there is no easy interface that simply states SNC support in the kernel one can find that information by comparing L3 cache sizes from different sources. Cache size reported by /sys/devices/system/node/node0/cpu0/cache/index3/size will always show the full cache size even if it's split by enabled SNC. On the other hand /sys/fs/resctrl/size has information about L3 size, that with kernel support is adjusted for enabled SNC.
Early versions of the kernel SNC patch series added an info/l3_MON/snc_ways file to provide this information. I was talked out of it then:
https://lore.kernel.org/all/f0841866-315b-4727-0a6c-ec60d22ca29c@arm.com/
But that discussion didn't consider the question you discuss here: "Does this instance of the kernel support SNC?"
So you have a clever solution. But it seems like a roundabout way for an application to discover whether the kernel has configured resctrl for SNC mode.
Should the kernel provide an info/ file listing the SNC configuration?
I suppose it would be a benefit for other numa aware applications to have an easy access to this kernel support information.
If so, what should it be named? "snc_ways" as a kernel variable was later replaced by "snc_nodes_per_l3_cache". Is that a good filename?
"snc_nodes_per_l3_cache" seems okay to me.
And I understand that the file content would show SNC mode and the presence or absence of this file would tell if kernel supports SNC?
-Tony