Re: [PATCH 3/3] nfnetlink_queue: use hash table to speed up entry finding.

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

 



Changli Gao wrote:
> On Thu, Apr 15, 2010 at 6:36 PM, Patrick McHardy <kaber@xxxxxxxxx> wrote:
>> Changli Gao wrote:
>>> On Tue, Apr 13, 2010 at 9:25 PM, Patrick McHardy <kaber@xxxxxxxxx> wrote:
>>>>> Yes, that is why vmalloc() is perfect for this case. No extra memory for
>>>>> management, but one pointer for each page of memory.
>>>> I agree, if it works for conntrack, it certainly also works for
>>>> nfnetlink_queue.
>>>>
>>> I need to allocate memory in atomic section, so vmalloc() can't be used. :(
>> Why?
>>
> 
> instance_create() is called in rcu read-side critical section, and the
> whole body of this function is protected by the spinlock
> instances_lock. All these make memory allocation for queue instances
> should be atomic.

That should be easily fixable. For the lookup we can add a reference
counter so we don't need the rcu read side critical section.
For creation the lock actually looks unnecessary since all nfnetlink
handlers run under nfnl_mutex, so we can't have concurrent creation
and removal of queuing instances. Well, we need it for list insertion
to avoid races with the seq file handlers, but we don't need it
before that.
--
To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Netfitler Users]     [LARTC]     [Bugtraq]     [Yosemite Forum]

  Powered by Linux