Re: [PATCH V4 1/1] rcu: introduce kfree_rcu()

Lai Jiangshan
2011-03-16T02:22:14Z

On 03/15/2011 06:15 PM, Arnd Bergmann wrote:
> On Tuesday 15 March 2011 10:46:20 Lai Jiangshan wrote:
>> +static __always_inline bool __is_kfree_rcu_offset(unsigned long offset)
>> +{
>> + return offset < 4096;
>> +}
>
> So this relies on the assumptions that
>
> a) the rcu_head is within the first 4 KB of the data structure to be freed
> b) no callback ever gets called in the first 4 KB of virtual address space
>
> It's probably a reasonable assumption, but I think it should be documented
> more explicitly, especially the first one. It's entirely possible that
> an RCU managed data structure is larger than 4 KB.

The first one is not a problem nor assumption, if an rcu_head offset is larger
than 4096, the BUILD_BUG_ON() will be triggered, and the user can use the original
call_rcu() instead.

b) is not a problem, the TEXT section is no at the first 4 KB of virtual address space.

> Another alternative might be to encode the difference between a
> function pointer and an offset in one of the lower bits of the address.
>
> Arnd
>