diff options
author | Uladzislau Rezki (Sony) <urezki@gmail.com> | 2020-05-25 23:47:59 +0200 |
---|---|---|
committer | Paul E. McKenney <paulmck@kernel.org> | 2020-06-29 11:59:26 -0700 |
commit | 1835f475e3518ade61e25a57572c78b953778656 (patch) | |
tree | 7c34637bc5e3bd79ef2dd70b42d2f1537b4bf66e /lib/test_vmalloc.c | |
parent | 3042f83f19bec2e0cd356f72b39e4d816e8cd5ff (diff) | |
download | linux-rpi-1835f475e3518ade61e25a57572c78b953778656.tar.gz linux-rpi-1835f475e3518ade61e25a57572c78b953778656.tar.bz2 linux-rpi-1835f475e3518ade61e25a57572c78b953778656.zip |
rcu: Introduce single argument kvfree_rcu() interface
Make kvfree_rcu() capable of freeing objects that will not
embed an rcu_head within it. This saves storage overhead in
such objects. Reclaiming headless objects this way requires
only a single argument (pointer to the object).
After this patch, there are two ways to use kvfree_rcu():
a) kvfree_rcu(ptr, rhf);
struct X {
struct rcu_head rhf;
unsigned char data[100];
};
void *ptr = kvmalloc(sizeof(struct X), GFP_KERNEL);
if (ptr)
kvfree_rcu(ptr, rhf);
b) kvfree_rcu(ptr);
void *ptr = kvmalloc(some_bytes, GFP_KERNEL);
if (ptr)
kvfree_rcu(ptr);
Note that the headless usage (example b) can only be used in a code
that can sleep. This is enforced by the CONFIG_DEBUG_ATOMIC_SLEEP
option.
Co-developed-by: Joel Fernandes (Google) <joel@joelfernandes.org>
Reviewed-by: Joel Fernandes (Google) <joel@joelfernandes.org>
Signed-off-by: Uladzislau Rezki (Sony) <urezki@gmail.com>
Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
Diffstat (limited to 'lib/test_vmalloc.c')
0 files changed, 0 insertions, 0 deletions