]> git.openfabrics.org - ~aditr/compat.git/commit
compat: backport kfree_rcu()
authorHauke Mehrtens <hauke@hauke-m.de>
Thu, 17 Nov 2011 23:05:45 +0000 (00:05 +0100)
committerLuis R. Rodriguez <mcgrof@qca.qualcomm.com>
Fri, 18 Nov 2011 00:28:37 +0000 (16:28 -0800)
commit46c619e9b5196622cb9ff07998aaaab492f29965
tree0b2bfead9b0428eae130ae580385fe19df57a545
parent63ea3fade83abd8b66f27c00aea9965883b6797a
compat: backport kfree_rcu()

This adds a nested function everywhere kfree_rcu() was called. This
function frees the memory and is given as a function to call_rcu().
The kfree_rcu define was made by Johannes Berg.
The rcu callback could happen every time also after the module was
unloaded and this will cause problems.
A rcu_barrier() was added into every module_exit so that this will not
be called after the module was unloaded.

The define overwriting module_exit is based on the original module_exit
which looks like this:
/* This is only required if you want to be unloadable. */
/#define module_exit(exitfn)                                    \
        static inline exitcall_t __exittest(void)               \
        { return exitfn; }                                      \
        void cleanup_module(void) __attribute__((alias(#exitfn)));

We replaced the call to the actual function exitfn() with a call to our
function which calls the original exitfn() and then rcu_barrier()

As a module will not be unloaded that ofter it should not have a big
performance impact when rcu_barrier() is called on every module exit,
also when no kfree_rcu() backport is used in that module.

Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
CC: Johannes Berg <johannes@sipsolutions.net>
Signed-off-by: Luis R. Rodriguez <mcgrof@qca.qualcomm.com>
include/linux/compat-3.0.h