On Wed, Feb 15, 2023 at 10:31:27PM -0800, Eric Biggers wrote: > I was hoping the compiler would know the pointer is non-NULL, since it's created > through an expression like &foo->bar where bar is at nonzero offset, and foo is > also dereferenced. Unfortunately it does seem that's not the case, though, > probably because of some of the compiler flags the kernel is compiled with > (-fno-strict-aliasing and -fno-delete-null-pointer-checks, maybe?). I'd be worried if the compiler optimised it away :) Just because p is not NULL, it does not follow that (p + X) where X is a small integer is also not NULL. Sure it happens to be true in kernel space but that's something that we'd have to explicitly tell the compiler and I don't think there is any way for us to communicate that through. > Anyway, if CONFIG_CRYPTO_STATS=y is the common case, that's unfortunate. Surely BTW that was just a completely wild guess on my part based on how distros operate. I just had a quick look and it seems that Debian at least disables this option but Fedora leaves it on. > hardly anyone actually uses the feature, and all this stats collection for every > crypto operation is for nothing? I know. > Here's a thread where someone claimed that disabling CONFIG_CRYPTO_STATS > significantly improves performance: > https://lists.ceph.io/hyperkitty/list/ceph-users@xxxxxxx/thread/44GMO5UGOXDZKFSOQMCPPHYTREUEA3ZI/ Not surprising as it's doing atomic ops on contended memory. At least this patch series kills two of those atomic ops. > IMO this feature should never have been accepted. But could we at least put the You're more than welcome to nack such patches in future :) > stats collection behind a static branch that defaults to off? If someone really > wants to collect stats, they can set a sysctl that turns on the static branch. Yes I would certainly be open to such a patch. Another avenue to explore is turning the atomic ops into percpu/local ones similar to what networking does to its counters. Thanks, -- Email: Herbert Xu <herbert@xxxxxxxxxxxxxxxxxxx> Home Page: http://gondor.apana.org.au/~herbert/ PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt