All of lore.kernel.org
 help / color / mirror / Atom feed
* Hashtable implementation breaks on flow statements
@ 2013-01-14 10:51 Schrober
  2013-01-14 20:03 ` Sasha Levin
  0 siblings, 1 reply; 2+ messages in thread
From: Schrober @ 2013-01-14 10:51 UTC (permalink / raw)
  To: linux-kernel; +Cc: Sasha Levin

Hi,

I think the new hash implementation in include/linux/hashtable.h is slightly 
unintuitive when using things like hash_for_each, hash_for_each_rcu, 
hash_for_each_safe and hash_for_each_possible.

Users may want to get out of the loop through the hashtable iteration when 
some condition is met. This works well on hlist, list and other "abstract" 
data types. But the hash table would just jump to the next bucket and 
continue.
-- 
Franz Schrober

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Hashtable implementation breaks on flow statements
  2013-01-14 10:51 Hashtable implementation breaks on flow statements Schrober
@ 2013-01-14 20:03 ` Sasha Levin
  0 siblings, 0 replies; 2+ messages in thread
From: Sasha Levin @ 2013-01-14 20:03 UTC (permalink / raw)
  To: Schrober; +Cc: linux-kernel

Hi Franz,

The hashtable should behave correctly (that is, not continue iteration
from the next
bucket) with regards to a 'break' inside the loop, this issue was
raised previously
during one of the RFCs and has been dealt with before the merge of the hashtable
into the kernel.

Do you see a case where it behaves incorrectly? can you share your code which
does that?


Thanks,
Sasha

On Mon, Jan 14, 2013 at 5:51 AM, Schrober <franzschrober@yahoo.de> wrote:
> Hi,
>
> I think the new hash implementation in include/linux/hashtable.h is slightly
> unintuitive when using things like hash_for_each, hash_for_each_rcu,
> hash_for_each_safe and hash_for_each_possible.
>
> Users may want to get out of the loop through the hashtable iteration when
> some condition is met. This works well on hlist, list and other "abstract"
> data types. But the hash table would just jump to the next bucket and
> continue.
> --
> Franz Schrober

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2013-01-14 20:04 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-01-14 10:51 Hashtable implementation breaks on flow statements Schrober
2013-01-14 20:03 ` Sasha Levin

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.