ioctl: Remove attribute packed and alignedof for args structs#321
Merged
igaw merged 1 commit intolinux-nvme:masterfrom Mar 31, 2022
Merged
ioctl: Remove attribute packed and alignedof for args structs#321igaw merged 1 commit intolinux-nvme:masterfrom
igaw merged 1 commit intolinux-nvme:masterfrom
Conversation
The attribute packed is usually used to make sure the data structures
is compatible between different compilers in regards of padding rules.
As we have sorted the members of all argument structs according their
naturual size, there are no holes to pad. This makes the packed
attributed superflous as compilers are agree on the data layout in
this case.
The alignedof attribute is used to tell the outer alignmen of the data
structure because the aligment of a packed data structure is 1.
Anyway, both attributes doen't add any benefits to the layout and
pahole agrees on this.
This is an example the diff between the packed/aligneof version and
the plain version:
struct nvme_dim_args {
__u32 * result; /* 0 8 */
void * data; /* 8 8 */
@@ -776,4 +777,4 @@
/* size: 40, cachelines: 1, members: 7 */
/* padding: 7 */
/* last cacheline: 40 bytes */
-} __attribute__((__aligned__(8)));
+};
Thus, just remove the attributes.
Signed-off-by: Daniel Wagner <dwagner@suse.de>
Collaborator
Author
|
The complete pahole diff output (note we even fix a problem for |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The attribute packed is usually used to make sure the data structures
is compatible between different compilers in regards of padding rules.
As we have sorted the members of all argument structs according their
naturual size, there are no holes to pad. This makes the packed
attributed superflous as compilers are agree on the data layout in
this case.
The alignedof attribute is used to tell the outer alignmen of the data
structure because the aligment of a packed data structure is 1.
Anyway, both attributes doen't add any benefits to the layout and
pahole agrees on this.
This is an example the diff between the packed/aligneof version and
the plain version:
struct nvme_dim_args {
__u32 * result; /* 0 8 /
void * data; / 8 8 /
@@ -776,4 +777,4 @@
/ size: 40, cachelines: 1, members: 7 /
/ padding: 7 /
/ last cacheline: 40 bytes */
-} attribute((aligned(8)));
+};
Thus, just remove the attributes.
Signed-off-by: Daniel Wagner dwagner@suse.de
Fixes: #285