Lai Jiangshan
9ab1544eb4
rcu: introduce kfree_rcu()
...
Many rcu callbacks functions just call kfree() on the base structure.
These functions are trivial, but their size adds up, and furthermore
when they are used in a kernel module, that module must invoke the
high-latency rcu_barrier() function at module-unload time.
The kfree_rcu() function introduced by this commit addresses this issue.
Rather than encoding a function address in the embedded rcu_head
structure, kfree_rcu() instead encodes the offset of the rcu_head
structure within the base structure. Because the functions are not
allowed in the low-order 4096 bytes of kernel virtual memory, offsets
up to 4095 bytes can be accommodated. If the offset is larger than
4095 bytes, a compile-time error will be generated in __kfree_rcu().
If this error is triggered, you can either fall back to use of call_rcu()
or rearrange the structure to position the rcu_head structure into the
first 4096 bytes.
Note that the allowable offset might decrease in the future, for example,
to allow something like kmem_cache_free_rcu().
The new kfree_rcu() function can replace code as follows:
call_rcu(&p->rcu, simple_kfree_callback);
where "simple_kfree_callback()" might be defined as follows:
void simple_kfree_callback(struct rcu_head *p)
{
struct foo *q = container_of(p, struct foo, rcu);
kfree(q);
}
with the following:
kfree_rcu(&p->rcu, rcu);
Note that the "rcu" is the name of a field in the structure being
freed. The reason for using this rather than passing in a pointer
to the base structure is that the above approach allows better type
checking.
This commit is based on earlier work by Lai Jiangshan and Manfred Spraul:
Lai's V1 patch: http://lkml.org/lkml/2008/9/18/1
Manfred's patch: http://lkml.org/lkml/2009/1/2/115
Signed-off-by: Lai Jiangshan <laijs@cn.fujitsu.com >
Signed-off-by: Manfred Spraul <manfred@colorfullife.com >
Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com >
Reviewed-by: David Howells <dhowells@redhat.com >
Reviewed-by: Josh Triplett <josh@joshtriplett.org >
2011-05-05 23:16:59 -07:00
..
2011-03-31 11:26:23 -03:00
2011-04-11 07:27:24 -07:00
2011-03-29 12:11:16 -07:00
2011-03-31 11:26:23 -03:00
2011-03-23 10:42:00 +01:00
2011-04-18 10:15:43 -07:00
2011-03-31 11:26:23 -03:00
2011-05-02 20:26:32 -07:00
2011-03-23 12:24:23 -07:00
2011-04-27 19:16:12 -04:00
2011-03-31 11:26:23 -03:00
2011-04-11 07:27:24 -07:00
2011-03-31 11:26:23 -03:00
2011-03-31 11:26:23 -03:00
2011-03-16 15:11:04 -07:00
2011-03-01 22:24:19 +03:00
2011-03-31 11:26:23 -03:00
2011-03-26 14:15:06 +00:00
2011-03-31 11:26:23 -03:00
2011-02-18 16:54:54 -05:00
2011-04-24 14:28:45 -04:00
2011-04-28 12:56:09 -07:00
2011-03-31 11:26:23 -03:00
2011-02-24 19:58:42 +01:00
2011-03-21 22:59:08 -04:00
2011-03-15 02:42:32 -04:00
2011-03-30 16:53:38 -07:00
2011-03-10 08:52:07 +01:00
2011-03-22 17:43:59 -07:00
2011-03-11 14:25:50 +00:00
2011-03-08 08:28:01 +01:00
2011-04-25 18:10:58 -07:00
2011-03-10 08:52:27 +01:00
2011-04-19 13:32:46 +02:00
2011-03-03 10:53:20 -05:00
2011-03-23 19:47:19 -07:00
2011-03-10 08:52:07 +01:00
2011-03-23 19:47:06 -07:00
2011-03-31 11:26:23 -03:00
2011-03-31 11:26:23 -03:00
2011-03-31 11:26:23 -03:00
2011-03-31 11:26:23 -03:00
2011-03-22 17:44:00 -07:00
2011-03-22 17:44:10 -07:00
2011-03-22 17:44:10 -07:00
2011-03-22 17:44:10 -07:00
2011-03-31 11:26:23 -03:00
2011-03-30 17:14:33 -07:00
2011-03-31 11:26:23 -03:00
2011-03-16 17:54:33 -04:00
2011-03-22 17:44:15 -07:00
2011-03-23 19:47:02 -07:00
2011-03-22 19:25:05 -07:00
2011-04-24 07:58:46 -07:00
2011-03-14 17:02:43 -07:00
2011-03-08 16:10:38 +01:00
2011-04-18 18:25:41 +10:00
2011-03-23 22:16:41 +01:00
2011-03-24 13:54:30 +00:00
2011-03-31 11:26:23 -03:00
2011-02-25 12:00:34 -08:00
2011-03-31 11:26:23 -03:00
2011-03-10 11:35:17 +01:00
2011-03-10 11:35:15 +01:00
2011-03-31 11:26:23 -03:00
2011-03-07 01:12:28 +05:30
2011-03-14 08:40:51 -07:00
2011-04-05 23:51:37 +02:00
2011-03-22 17:44:11 -07:00
2011-03-31 11:26:23 -03:00
2011-03-31 11:26:23 -03:00
2011-03-31 11:26:23 -03:00
2011-03-23 19:46:17 -07:00
2011-03-31 11:26:23 -03:00
2011-03-14 19:12:20 -04:00
2011-03-15 02:21:45 -04:00
2011-03-31 11:26:23 -03:00
2011-03-21 10:05:22 -07:00
2011-04-12 15:21:04 -07:00
2011-03-31 11:26:23 -03:00
2011-03-31 11:26:23 -03:00
2011-03-10 10:31:48 -05:00
2011-03-22 08:35:35 +01:00
2011-03-22 17:44:05 -07:00
2011-03-05 10:56:00 +01:00
2011-03-31 11:26:23 -03:00
2011-03-31 11:26:23 -03:00
2011-03-10 19:15:58 +01:00
2011-04-28 11:28:20 -07:00
2011-02-23 00:53:26 +00:00
2011-03-20 14:50:53 +01:00
2011-03-31 11:26:23 -03:00
2011-03-12 15:08:54 -08:00
2011-03-09 16:10:56 -05:00
2011-03-18 15:14:45 -07:00
2011-02-27 16:11:51 -08:00
2011-03-10 16:37:26 -08:00
2011-02-18 12:42:28 -08:00
2011-04-18 13:29:03 -07:00
2011-05-05 23:16:54 -07:00
2011-03-23 19:47:08 -07:00
2011-03-31 11:26:23 -03:00
2011-03-30 00:37:41 +02:00
2011-03-29 14:48:19 +02:00
2011-03-31 11:26:23 -03:00
2011-03-20 21:13:43 -04:00
2011-03-31 11:26:23 -03:00
2011-03-20 20:08:48 -04:00
2011-03-24 08:36:10 +01:00
2011-03-22 16:17:32 -07:00
2011-03-22 04:53:54 -03:00
2011-03-22 17:44:14 -07:00
2011-04-01 16:14:30 +11:00
2011-03-08 11:17:18 +11:00
2011-03-08 11:17:18 +11:00
2011-03-08 11:17:22 +11:00
2011-03-18 16:54:31 +00:00
2011-02-18 08:02:10 -08:00
2011-03-22 17:44:01 -07:00
2011-03-31 11:26:23 -03:00
2011-03-17 13:08:30 -03:00
2011-03-31 11:26:23 -03:00
2011-03-25 21:00:29 -07:00
2011-04-24 11:32:16 -04:00
2011-04-25 18:14:10 -07:00
2011-02-18 11:32:28 -08:00
2011-03-31 11:26:23 -03:00
2011-03-18 22:33:38 -07:00
2011-03-22 04:53:56 -03:00
2011-04-14 16:06:54 -07:00
2011-03-22 17:44:03 -07:00
2011-04-28 11:28:20 -07:00
2011-02-21 15:21:53 -08:00
2011-03-31 11:26:23 -03:00
2011-03-02 13:43:15 -08:00
2011-03-18 09:04:20 -04:00
2011-02-22 10:19:31 -08:00
2011-04-01 20:23:25 -07:00
2011-04-04 17:00:54 +02:00
2011-03-03 13:32:07 -08:00
2011-03-31 11:26:23 -03:00
2011-04-24 14:28:18 -04:00
2011-03-23 15:29:04 -04:00
2011-03-11 15:39:26 -05:00
2011-03-11 15:38:44 -05:00
2011-03-27 17:48:07 +02:00
2011-04-27 15:57:16 -04:00
2011-03-10 17:29:40 +09:00
2011-03-31 11:26:23 -03:00
2011-03-31 11:26:23 -03:00
2011-02-28 01:36:38 -07:00
2011-03-23 14:55:56 -06:00
2011-03-16 17:28:10 -07:00
2011-03-31 11:26:23 -03:00
2011-03-31 11:26:23 -03:00
2011-03-22 17:44:03 -07:00
2011-03-24 10:16:26 -07:00
2011-03-14 02:58:03 -04:00
2011-05-01 18:18:49 +02:00
2011-03-31 11:26:23 -03:00
2011-03-21 09:40:43 -07:00
2011-03-21 09:38:02 -07:00
2011-02-28 11:20:03 +01:00
2011-04-07 11:14:49 -07:00
2011-03-09 11:59:33 -08:00
2011-04-18 10:35:30 -07:00
2011-03-31 11:26:23 -03:00
2011-04-12 11:13:00 +02:00
2011-03-11 15:13:26 -05:00
2011-03-15 00:43:14 +01:00
2011-03-15 00:43:14 +01:00
2011-03-23 22:16:41 +01:00
2011-03-31 11:26:23 -03:00
2011-04-18 10:39:38 +02:00
2011-03-01 22:27:26 +03:00
2011-03-31 11:26:23 -03:00
2011-03-23 19:46:37 -07:00
2011-03-04 09:23:30 -08:00
2011-03-22 17:44:00 -07:00
2011-03-31 11:26:23 -03:00
2011-03-24 21:16:31 -04:00
2011-05-05 23:16:59 -07:00
2011-05-05 23:16:56 -07:00
2011-03-31 11:26:23 -03:00
2011-03-23 19:46:23 -07:00
2011-03-09 13:52:27 -05:00
2011-03-23 19:46:41 -07:00
2011-04-14 16:06:56 -07:00
2011-02-25 15:07:37 -08:00
2011-04-14 16:06:56 -07:00
2011-03-22 17:44:03 -07:00
2011-03-29 18:44:05 -07:00
2011-04-14 16:06:55 -07:00
2011-04-22 16:17:29 -07:00
2011-03-22 17:44:15 -07:00
2011-04-07 11:14:49 -07:00
2011-03-22 20:48:04 +02:00
2011-03-22 17:16:34 +09:00
2011-03-31 11:26:23 -03:00
2011-03-23 07:48:42 -07:00
2011-03-31 11:26:23 -03:00
2011-03-09 14:08:09 -08:00
2011-03-28 06:05:24 -04:00
2011-03-31 11:26:23 -03:00
2011-03-31 11:26:23 -03:00
2011-03-31 11:26:23 -03:00
2011-03-31 11:26:23 -03:00
2011-04-11 22:54:42 +02:00
2011-03-22 15:47:22 +09:00
2011-03-24 10:16:26 -07:00
2011-03-21 00:40:29 -04:00
2011-03-15 00:43:46 +01:00
2011-03-09 16:43:24 -08:00
2011-03-31 11:26:23 -03:00
2011-02-28 18:00:31 -08:00
2011-02-21 12:53:08 -08:00
2011-03-31 11:26:23 -03:00
2011-03-13 16:35:18 -04:00
2011-02-23 18:05:11 -05:00
2011-03-31 11:26:23 -03:00
2011-02-17 11:59:56 -08:00
2011-03-22 16:17:32 -07:00
2011-03-22 17:44:09 -07:00
2011-03-31 11:26:23 -03:00
2011-03-31 11:26:23 -03:00
2011-03-23 19:47:03 -07:00
2011-03-31 11:26:23 -03:00
2011-04-19 11:23:31 -03:00
2011-03-22 04:53:33 -03:00
2011-03-31 11:26:23 -03:00
2011-04-19 11:20:56 -03:00
2011-03-28 12:53:29 +01:00
2011-04-14 16:06:55 -07:00
2011-03-31 11:26:23 -03:00
2011-02-21 10:07:23 +01:00
2011-03-24 21:17:51 -04:00
2011-03-13 20:22:28 -07:00
2011-03-31 11:26:23 -03:00
2011-03-22 17:44:17 -07:00