On Tue, Jul 30, 2024 at 11:40:28AM +0200, Greg Kroah-Hartman wrote:
On Tue, Jul 30, 2024 at 11:30:51AM +0200, Lukas Wunner wrote:
From: Peter Zijlstra peterz@infradead.org
commit 54da6a0924311c7cf5015533991e44fb8eb12773 upstream.
Use __attribute__((__cleanup__(func))) to build:
simple auto-release pointers using __free()
'classes' with constructor and destructor semantics for scope-based resource management.
lock guards based on the above classes.
Signed-off-by: Peter Zijlstra (Intel) peterz@infradead.org Signed-off-by: Lukas Wunner lukas@wunner.de Link: https://lkml.kernel.org/r/20230612093537.614161713%40infradead.org
Do we really want this in 5.10?
I think so because we may have to apply a lot more patches between now and Dec 2026 which use __cleanup variable attributes.
(Dec 2026 is EOL for 5.10 and 5.15.)
Are there any compiler versions that 5.10 still has to support that will break with this?
No, apparently not.
5.10 requires gcc >= 4.9 or clang >= 10.0.1 5.15 requires gcc >= 5.1 or clang >= 10.0.1
I've looked through gcc docs and the first version mentioning __cleanup is gcc 3.3.6.
The situation around clang seems odd: __cleanup isn't mentioned in their docs before 15.0.0, yet we're only requiring 13.0.1 in the just-released v6.10.
Same for 5.15.y, I'm loath to apply this to older kernels without loads of testing.
I'm sorry, I don't have the resources to perform that amount of testing. I've sent you a backport of the PCI/DPC patch instead which avoids __cleanup.
Thanks,
Lukas