Re: [PATCH -v3 3/4] lib, Make gen_pool memory allocator lockless

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



* Huang Ying (ying.huang@xxxxxxxxx) wrote:
> On 04/14/2011 05:07 AM, Mathieu Desnoyers wrote:
> > * Huang Ying (ying.huang@xxxxxxxxx) wrote:
> > [...]
> >> + * rcu_read_lock and rcu_read_unlock is not used int gen_pool_alloc,
> >> + * gen_pool_free, gen_pool_avail and gen_pool_size etc, because chunks
> >> + * are only added into pool, not deleted from pool unless the pool
> >> + * itself is destroyed.  If chunk will be deleted from pool,
> >> + * rcu_read_lock and rcu_read_unlock should be uses in these
> >> + * functions.
> > 
> > So how do you protect between pool destruction and adding chunks into
> > the pool ?
> 
> Because the pool itself will be freed when destruction, we need some
> mechanism outside of pool.  For example, if gen_pool_add() is called via
> device file IOCTL, we must un-register the device file first, and
> destroy the pool after the last reference to device has gone.

I am concerned about the list_for_each_entry_rcu() (and thus
rcu_dereference_raw()) used outside of rcu_read_lock/unlock pairs.
Validation infrastructure as recently been added to RCU: it triggers
warnings when these situations are encountered in some RCU debugging
configurations. The case of RCU list iteration is not covered by the
checks, but it would make sense to be aware of it.

So although it seems like your code does not require rcu read lock
critical sections, I'd prefer to let Paul McKenney have a look.

Thanks,

Mathieu

> 
> Best Regards,
> Huang Ying

-- 
Mathieu Desnoyers
Operating System Efficiency R&D Consultant
EfficiOS Inc.
http://www.efficios.com
--
To unsubscribe from this list: send the line "unsubscribe linux-acpi" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux IBM ACPI]     [Linux Power Management]     [Linux Kernel]     [Linux Laptop]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]     [Linux Resources]

  Powered by Linux