[Click] Query about HashContainer & HashAllocator

Eddie Kohler kohler at cs.ucla.edu
Tue Jun 23 18:43:29 EDT 2009


Yogesh,

SizedHashAllocator is not quite like slab_cache.  It hands out little chunks 
of memory from larger units, which are allocated from the slab_cache.

You could use "a combination of slab_cache and placement new" to manage 
entries in HashContainer, or you could use slab_cache on its own, or you could 
use HashAllocator.  If you observe relevant performance differences we'd be 
interested.

Like much of Click HashContainer is not particularly SMP safe on its own.  You 
need to develop a safe discipline for handling a HashContainer.  The 
discipline you choose will depend on how you access the HC.  ARPTable's HC is 
expected to be accessed from multiple different threads at different times, so 
we use a ReadWrite lock to protect both insertions and lookups.  RCU might be 
faster but we do not use it yet.

Eddie


Yogesh Mundada wrote:
> Hi,
> 
> Arptable, uses SizedHashAllocator to allocate entries. Is that similar
> to slab_cache?
> Can I use combination of slab_cache & placement new to manage entries
> in HashContainer?
> 
> HashContainer operations, are they RCU safe?
> In Arptable, I see that ReadWrite lock is used to insert/delete
> entries. If these operations are RCU safe, then may be I dont need to
> use spin locks.
> 
> -Yogesh
> _______________________________________________
> click mailing list
> click at amsterdam.lcs.mit.edu
> https://amsterdam.lcs.mit.edu/mailman/listinfo/click



More information about the click mailing list