On 12/20/18 10:22 AM, Paul E. McKenney wrote:
On Thu, Dec 20, 2018 at 08:05:14AM -0800, Tejun Heo wrote:
Hello,
On Thu, Dec 20, 2018 at 08:04:08AM -0800, Paul E. McKenney wrote:
Yes, it is possible. Just do something like this:
struct srcu_struct my_srcu_struct;
And before the first use of my_srcu_struct, do this:
init_srcu_struct(&my_srcu_struct);
This will result in alloc_percpu() being invoked to allocate the
needed per-CPU space.
If my_srcu_struct is used in a module or some such, then to avoid memory
leaks, after the last use of my_srcu_struct, do this:
cleanup_srcu_struct(&my_srcu_struct);
There are several places in the kernel that take this approach.
Oops, my bad. Somehow I thought the dynamic init didn't exist (I
checked the header but somehow completely skipped over them). Thanks
for the explanation!
No problem, especially given that if things go as they usually do, I
will provide you ample opportunity to return the favor. ;-)
Ok, I didn't realize that SRCU took up so much space. It's true that
this isn't
something that requires performance, but SRCU was awfully convenient to
use for this.
Unfortunately, it's not just a matter of adding the init_srcu_struct()
to the
__init function. I'm going to have to hunt down all the initial startup
points
and add it there, and rework some of the other initialization code..
But that's
something I can do.
Unless someone else would rather do it :-).
-corey