-
Notifications
You must be signed in to change notification settings - Fork 1.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
.rodata globals and .data pruning: modules #12899
Conversation
c9c8f90
to
1625ed1
Compare
3962e47
to
8460b6c
Compare
@behlendorf Given that this touches the following with the same proverbial commit message (much like #12844):
Does a cleave line like this make sense?
|
8460b6c
to
d3e1be6
Compare
a06c3e1
to
0c1cf36
Compare
Rebased |
I'm fine with a single commit for "prune .data, global .rodata" changes. Since it'll take me a while to work through that diff I'll go ahead and get those other 4 cleanup patches merged first. They all looked good to me. |
Would you I split them off into a separate PR or are you fine just picking them off this one? |
man/man4/zfs.4
Outdated
@@ -595,7 +595,7 @@ Under Linux, half of system memory will be used as the limit. | |||
Under | |||
.Fx , | |||
the larger of | |||
.Sy all_system_memory - 1GB No and Sy 5/8 * all_system_memory | |||
.Sy all_system_memory No - Sy 1GB No and Sy 5/8 No \(md Sy all_system_memory |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No \(md Sy
does not render as an *
for me with man v2.7.6.1, but instead as an empty square. This was with RHEL 8.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
md
is the multiplication dot, and present in every groff version as far back as the git repository goes (1991) – are you on a VT or some other generally-incapable terminal (or, uh, have broken locales maybe?)?
Let me grab the first three. The man page change seems to not render for me correctly. Can you see what the issue is there, then open up a new PR for that fix.
|
Before: $ time make cstyle real 0m23.118s user 0m23.002s sys 0m0.114s After: $ time make cstyle real 0m4.577s user 0m31.487s sys 0m0.699s Reviewed-by: Brian Behlendorf <[email protected]> Signed-off-by: Ahelenia Ziemiańska <[email protected]> Issue openzfs#12899
Reviewed-by: Brian Behlendorf <[email protected]> Signed-off-by: Ahelenia Ziemiańska <[email protected]> Issue openzfs#12899
Reviewed-by: Brian Behlendorf <[email protected]> Signed-off-by: Ahelenia Ziemiańska <[email protected]> Issue openzfs#12899
Signed-off-by: Ahelenia Ziemiańska <[email protected]>
Clean rebase |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've gone over this twice now, and it all looks pretty reasonable. Though it's really easy to gloss over-something in a change this large and repetitive, but we have the CI to help with that! One question, are there additional compiler warnings we should consider enabling by default after this change?
I don't know? AFAICT this is all valid and just a very unfortunate side-effect of copying/following the everything-global-mutable default. Maybe there's a "static is mutable but doesn't need to be" warning? (A quick look through the Clang warning list says there isn't.) But even that's.. weak for most of this, since consumers mask this by over-requiring mutable data, and the default is non-static (hell, there's bits in the freebsd sysctl handling that do |
Reviewed-by: Brian Behlendorf <[email protected]> Signed-off-by: Ahelenia Ziemiańska <[email protected]> Issue openzfs#12899
Reviewed-by: Brian Behlendorf <[email protected]> Signed-off-by: Ahelenia Ziemiańska <[email protected]> Issue openzfs#12899
Reviewed-by: Brian Behlendorf <[email protected]> Signed-off-by: Ahelenia Ziemiańska <[email protected]> Issue openzfs#12899
Reviewed-by: Brian Behlendorf <[email protected]> Signed-off-by: Ahelenia Ziemiańska <[email protected]> Issue openzfs#12899
Reviewed-by: Brian Behlendorf <[email protected]> Signed-off-by: Ahelenia Ziemiańska <[email protected]> Issue openzfs#12899
Reviewed-by: Brian Behlendorf <[email protected]> Signed-off-by: Ahelenia Ziemiańska <[email protected]> Issue #12899
Before: $ time make cstyle real 0m23.118s user 0m23.002s sys 0m0.114s After: $ time make cstyle real 0m4.577s user 0m31.487s sys 0m0.699s Reviewed-by: Brian Behlendorf <[email protected]> Signed-off-by: Ahelenia Ziemiańska <[email protected]> Issue openzfs#12899
Reviewed-by: Brian Behlendorf <[email protected]> Signed-off-by: Ahelenia Ziemiańska <[email protected]> Issue openzfs#12899
Reviewed-by: Brian Behlendorf <[email protected]> Signed-off-by: Ahelenia Ziemiańska <[email protected]> Issue openzfs#12899
Evaluated every variable that lives in .data (and globals in .rodata) in the kernel modules, and constified/eliminated/localised them appropriately. This means that all read-only data is now actually read-only data, and, if possible, at file scope. A lot of previously- global-symbols became inlinable (and inlined!) constants. Probably not in a big Wowee Performance Moment, but hey. Reviewed-by: Brian Behlendorf <[email protected]> Signed-off-by: Ahelenia Ziemiańska <[email protected]> Closes openzfs#12899
Before: $ time make cstyle real 0m23.118s user 0m23.002s sys 0m0.114s After: $ time make cstyle real 0m4.577s user 0m31.487s sys 0m0.699s Reviewed-by: Brian Behlendorf <[email protected]> Signed-off-by: Ahelenia Ziemiańska <[email protected]> Issue openzfs#12899
Reviewed-by: Brian Behlendorf <[email protected]> Signed-off-by: Ahelenia Ziemiańska <[email protected]> Issue openzfs#12899
Reviewed-by: Brian Behlendorf <[email protected]> Signed-off-by: Ahelenia Ziemiańska <[email protected]> Issue openzfs#12899
Evaluated every variable that lives in .data (and globals in .rodata) in the kernel modules, and constified/eliminated/localised them appropriately. This means that all read-only data is now actually read-only data, and, if possible, at file scope. A lot of previously- global-symbols became inlinable (and inlined!) constants. Probably not in a big Wowee Performance Moment, but hey. Reviewed-by: Brian Behlendorf <[email protected]> Signed-off-by: Ahelenia Ziemiańska <[email protected]> Closes openzfs#12899
Before: $ time make cstyle real 0m23.118s user 0m23.002s sys 0m0.114s After: $ time make cstyle real 0m4.577s user 0m31.487s sys 0m0.699s Reviewed-by: Brian Behlendorf <[email protected]> Signed-off-by: Ahelenia Ziemiańska <[email protected]> Issue openzfs#12899
Evaluated every variable that lives in .data (and globals in .rodata) in the kernel modules, and constified/eliminated/localised them appropriately. This means that all read-only data is now actually read-only data, and, if possible, at file scope. A lot of previously- global-symbols became inlinable (and inlined!) constants. Probably not in a big Wowee Performance Moment, but hey. Reviewed-by: Brian Behlendorf <[email protected]> Signed-off-by: Ahelenia Ziemiańska <[email protected]> Closes openzfs#12899
Motivation and Context
I haven't moved for the over seven hours since I started, but I've evaluated every variable that lives in .data (and globals in .rodata) in the kernel modules, and constified/eliminated/localised them appropriately. This means that all read-only data is now actual read-only data (except for if i missed something in my 12k of policies, doubt it though), and, if possible, at file scope. A lot of previously-global-symbols became inlinable (and inlined!) constants. Probably not in a big Wowee Performance Moment, but hey.
This is in many ways a follow-up to #12836 except that that took fifty seven seconds instead.
Also this does minor pre-#12895-clean-up. Just the obvious stuff near the diffhunks I was touching already to make it, uh, have a const in the file, just one.
Description
On top of #12844. One big commit (the one at the very top). Needs cstyle. Whatever.zfs.ko can go [REDACTED]How Has This Been Tested?
Builds on Linux. CI will show if the lua lightuserdatas actually need to be writable (i.e. the kernel will crash horribly if they do).
The methodology here is quite simple:
and git grep -> const -> rebuild -> rerun until you're satisfied for your module of choice, then
and git grep -> static -> rebuild -> rerun until you're satisfied with your module of choice.
The Big Problem here is zfs.ko – well, the fact that it has a lot of platform-conditional code and it's bloody huge, compared to even the sum of all the others. Here's the final filter that removes all the variables that are Known Good, if you run it on FreeBSD you'll catch just the superfluous FreeBSD symbols:
Types of changes
Checklist:
Signed-off-by
.