Scope-based Resource Management for 6.5
Hi Linus,
Please consider pulling the SBRM infrastructure so that people can start building upon it. Specifically Greg also wants to start using this soon.
Once this lands, I'll start to trickle in the conversions I've done for the next release.
Thanks!
---
The following changes since commit 6995e2de6891c724bfeb2db33d7b87775f913ad1:
Linux 6.4 (2023-06-25 16:29:58 -0700)
are available in the Git repository at:
git://git.kernel.org/pub/scm/linux/kernel/git/peterz/queue.git tags/core_guards_for_6.5_rc1
for you to fetch changes up to b5ec6fd286dfa466f64cb0e56ed768092d0342ae:
kbuild: Drop -Wdeclaration-after-statement (2023-06-26 11:14:19 +0200)
----------------------------------------------------------------
Scope-based Resource Management infrastructure
These are the first few patches in the Scope-based Resource Management series that introduce the infrastructure but not any conversions as of yet.
Adding the infrastructure now allows multiple people to start using them.
Of note is that Sparse will need some work since it doesn't yet understand this attribute and might have decl-after-stmt issues -- but I think that's being worked on.
----------------------------------------------------------------
Peter Zijlstra (4):
dmaengine: ioat: Free up __cleanup() name
apparmor: Free up __cleanup() name
locking: Introduce __cleanup() based infrastructure
kbuild: Drop -Wdeclaration-after-statement
Makefile | 6 +- arch/arm64/kernel/vdso32/Makefile | 2 - drivers/dma/ioat/dma.c | 12 +-- include/linux/cleanup.h | 171 ++++++++++++++++++++++++++++++++++++ include/linux/compiler-clang.h | 9 ++ include/linux/compiler_attributes.h | 6 ++ include/linux/device.h | 7 ++ include/linux/file.h | 6 ++ include/linux/irqflags.h | 7 ++ include/linux/mutex.h | 4 + include/linux/percpu.h | 4 + include/linux/preempt.h | 5 ++ include/linux/rcupdate.h | 3 + include/linux/rwsem.h | 8 ++ include/linux/sched/task.h | 2 + include/linux/slab.h | 3 + include/linux/spinlock.h | 31 +++++++ include/linux/srcu.h | 5 ++ scripts/checkpatch.pl | 2 +- security/apparmor/include/lib.h | 6 +- 20 files changed, 282 insertions(+), 17 deletions(-) create mode 100644 include/linux/cleanup.h
Quoted 6 lines · Peter Zijlstra
Please consider pulling the SBRM infrastructure so that people can start building upon it. Specifically Greg also wants to start using this soon.
Once this lands, I'll start to trickle in the conversions I've done for the next release.
So things are quiet (partly presumably due to July 4th in the US) and I've mostly emptied my merge window queue, so I've pulled this since I obviously was happy with the final syntax.
However, let's agree to not really use it for 6.5 yet, and consider it all purely infrastructure for the next release, and for testing it all out in linux-next etc.
We should probably also strive to avoid it for bug-fixes that end up going to stable. I'm sure this will all be backported to stable eventually, but I'd at least personally be happier if that started happening only after we actually have some more interaction with this.
I hope - and expect - that the core compiler infrastructure should be stable due to C++ uses of destructors, but I also note that at least in the system headers I have, the only use of the __cleanup__ attribute seems to be a very special pthread_cleanup_push() helper, and some (fairly minimal) glib use in the g_auto*() types.
So this attribute has been around forever, and the low-level functionality has presumably gotten a lot of testing, but at the same time it really looks like the C interface is somewhat limited in its use.
I did do a Debian core search on g_autoptr() use, and in the first ten pages, most uses seemed to be either comments or tests. But there are certainly *some* real users too.
Anyway, I did find enough use that I'm not worried, but I'd still like us to take this somewhat slowly.
Let's *not* treat this as a "W00t! Black Friday at Walmart! Everybody rush in at once!"
Linus
Quoted 8 lines · Linus Torvalds
Quoted 6 lines · Peter Zijlstra
Please consider pulling the SBRM infrastructure so that people can start building upon it. Specifically Greg also wants to start using this soon.
Once this lands, I'll start to trickle in the conversions I've done for the next release.
Quoted 7 lines
So things are quiet (partly presumably due to July 4th in the US) and I've mostly emptied my merge window queue, so I've pulled this since I obviously was happy with the final syntax.
However, let's agree to not really use it for 6.5 yet, and consider it all purely infrastructure for the next release, and for testing it all out in linux-next etc.
Sounds good to me.
Quoted 4 lines
We should probably also strive to avoid it for bug-fixes that end up going to stable. I'm sure this will all be backported to stable eventually, but I'd at least personally be happier if that started happening only after we actually have some more interaction with this.
Yeah, it will probably need to be backported to maybe 6.1.y if some real bugfix needs it, but for all of the trivial "clean up the error path" patches that we constantly get, we'll resist that for the stable tree if they use the cleanup logic. That might actually be a good thing overall anyway.
Quoted 6 lines
I hope - and expect - that the core compiler infrastructure should be stable due to C++ uses of destructors, but I also note that at least in the system headers I have, the only use of the
__cleanup__attribute seems to be a very specialpthread_cleanup_push()helper, and some (fairly minimal) glib use in the g_auto*() types.
Quoted 8 lines
So this attribute has been around forever, and the low-level functionality has presumably gotten a lot of testing, but at the same time it really looks like the C interface is somewhat limited in its use.
I did do a Debian core search on
g_autoptr()use, and in the first ten pages, most uses seemed to be either comments or tests. But there are certainly *some* real users too.
systemd has been using it for a long time so the infrastructure has been there and should be stable, but I'm sure we will find out if not.
thanks,
greg k-h
The pull request you sent on Mon, 26 Jun 2023 14:57:26 +0200:
The pull request you sent on Mon, 26 Jun 2023 14:57:26 +0200:
Quoted 1 line
git://git.kernel.org/pub/scm/linux/kernel/git/peterz/queue.gittags/core_guards_for_6.5_rc1
has been merged into torvalds/linux.git:
https://git.kernel.org/torvalds/c/04f2933d375e3f90d4435b7b518d3065afd1fa25
Thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/prtracker.html