-
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
Ignore too large stack in case of dsl_deadlist_merge #14524
Conversation
Does it tell how big is the frame? Can it be fixed instead by some noinline's? |
In debug:
|
That is quite a lot for kernel. Would be good to make sure we've done everything we could to reduce it. |
It looks like the two |
In the case of a regular compilation, the compiler raises a warning for a dsl_deadlist_merge function, that the stack size is to large. In debug build this can generate an error. Move to large structores to heap. Signed-off-by: Mariusz Zaborski <mariusz.zaborski@klarasystems.com> Sponsored-by: Klara, Inc. Sponsored-by: Wasabi Technology, Inc.
02ea8dd
to
8616e2d
Compare
@@ -875,28 +875,31 @@ dsl_deadlist_merge(dsl_deadlist_t *dl, uint64_t obj, dmu_tx_t *tx) | |||
return; | |||
} | |||
|
|||
za = kmem_alloc(sizeof (*za), KM_SLEEP); | |||
pza = kmem_alloc(sizeof (*pza), KM_SLEEP); |
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.
It would be more efficient to do a single allocation like this:
za = kmem_alloc(sizeof (*za) * 2, KM_SLEEP);
pza = &za[1];
Then we would free the memory by calling kmem_free(za, sizeof (*za) * 2);
at the end of the function.
That said, I do not feel strongly about this, so I am fine with merging this either way. This is purely a suggestion for a way to minimize the runtime overhead of using dynamic memory to reduce stack space usage that stood out to me.
In the case of a regular compilation, the compiler raises a warning for a dsl_deadlist_merge function, that the stack size is to large. In debug build this can generate an error. Move large structures to heap. Reviewed-by: Richard Yao <richard.yao@alumni.stonybrook.edu> Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Signed-off-by: Mariusz Zaborski <mariusz.zaborski@klarasystems.com> Sponsored-by: Klara, Inc. Sponsored-by: Wasabi Technology, Inc. Closes openzfs#14524
In the case of a regular compilation, the compiler raises a warning for a dsl_deadlist_merge function, that the stack size is to large. In debug build this can generate an error. Move large structures to heap. Reviewed-by: Richard Yao <richard.yao@alumni.stonybrook.edu> Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Signed-off-by: Mariusz Zaborski <mariusz.zaborski@klarasystems.com> Sponsored-by: Klara, Inc. Sponsored-by: Wasabi Technology, Inc. Closes openzfs#14524
In the case of a regular compilation, the compiler raises a warning for a dsl_deadlist_merge function, that the stack size is to large. In debug build this can generate an error. Move large structures to heap. Reviewed-by: Richard Yao <richard.yao@alumni.stonybrook.edu> Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Signed-off-by: Mariusz Zaborski <mariusz.zaborski@klarasystems.com> Sponsored-by: Klara, Inc. Sponsored-by: Wasabi Technology, Inc. Closes #14524
Motivation and Context
In the case of a regular compilation, the compiler raises a warning for a dsl_deadlist_merge function. However, in debug build this can generate an error.
For this single function, let's ignore the limit of stack size.
Signed-off-by: Mariusz Zaborski mariusz.zaborski@klarasystems.com
Sponsored-by: Klara, Inc.
Sponsored-by: Wasabi Technology, Inc.
Description
For this single function override the compiler option of stack size.
How Has This Been Tested?
I have built a project using
gcc
andclang
.Types of changes
Checklist:
Signed-off-by
.