> Moreover, if your thinking is that we do not need a static inline
> function replicated at every caller, maybe we should introduce a
> lib/hashtable.c that implements those 2 functions.
That was my thought...
Given their nature, I'd guess they aren't critical path.
Probably not worth adding an e
On Thu, 2012-09-27 at 09:11 -0400, Mathieu Desnoyers wrote:
> AFAIK, gcc nowadays use "inline" only as a hint
Only if CONFIG_OPTIMIZE_INLINING is set.
>From include/linux/compiler-gcc.h:
#if !defined(CONFIG_ARCH_SUPPORTS_OPTIMIZED_INLINING) || \
!defined(CONFIG_OPTIMIZE_INLINING) || (__GNUC
* Sasha Levin (levinsasha...@gmail.com) wrote:
> On 09/27/2012 10:25 AM, David Laight wrote:
> And even then, if we would do:
>
> for (i = 0; i < HASH_SIZE(hashtable); i++)
> if (!hlist_empty(&hashtable[i]))
> break;
>
* David Laight (david.lai...@aculab.com) wrote:
> > > > And even then, if we would do:
> > > >
> > > > for (i = 0; i < HASH_SIZE(hashtable); i++)
> > > > if (!hlist_empty(&hashtable[i]))
> > > > break;
> > > >
> > > > return i >= HASH_SIZE(has
On Thu, 2012-09-27 at 10:33 +0200, Sasha Levin wrote:
> Right, the flag thing in the macro was there just to make it work properly as
> a macro.
>
> >> Agreed that the flags should be removed. Moving to define + static
> >> inline is still important though.
> >
> > Not sure I'd bother making th
On 09/27/2012 10:25 AM, David Laight wrote:
And even then, if we would do:
for (i = 0; i < HASH_SIZE(hashtable); i++)
if (!hlist_empty(&hashtable[i]))
break;
return i >= HASH_SIZE(hashtable);
What happens if the last e
> > > And even then, if we would do:
> > >
> > > for (i = 0; i < HASH_SIZE(hashtable); i++)
> > > if (!hlist_empty(&hashtable[i]))
> > > break;
> > >
> > > return i >= HASH_SIZE(hashtable);
> > >
> > > What happens if the last entry of the table is non-empty ?
> >
>
* Steven Rostedt (rost...@goodmis.org) wrote:
> On Wed, 2012-09-26 at 10:39 -0400, Mathieu Desnoyers wrote:
> > * Sasha Levin (levinsasha...@gmail.com) wrote:
> > > On 09/26/2012 03:59 PM, Steven Rostedt wrote:
> > > > On Wed, 2012-09-26 at 14:45 +0100, David Laight wrote:
> > > >> Amazing how some
On Wed, 2012-09-26 at 10:39 -0400, Mathieu Desnoyers wrote:
> * Sasha Levin (levinsasha...@gmail.com) wrote:
> > On 09/26/2012 03:59 PM, Steven Rostedt wrote:
> > > On Wed, 2012-09-26 at 14:45 +0100, David Laight wrote:
> > >> Amazing how something simple gets lots of comments and versions :-)
> >
* Sasha Levin (levinsasha...@gmail.com) wrote:
> On 09/26/2012 03:59 PM, Steven Rostedt wrote:
> > On Wed, 2012-09-26 at 14:45 +0100, David Laight wrote:
> >> Amazing how something simple gets lots of comments and versions :-)
> >>
> >>> ...
> >>> + * This has to be a macro since HASH_BITS() will n
* David Laight (david.lai...@aculab.com) wrote:
> Amazing how something simple gets lots of comments and versions :-)
>
> > ...
> > + * This has to be a macro since HASH_BITS() will not work on pointers since
> > + * it calculates the size during preprocessing.
> > + */
> > +#define hash_empty(has
On 09/26/2012 03:59 PM, Steven Rostedt wrote:
> On Wed, 2012-09-26 at 14:45 +0100, David Laight wrote:
>> Amazing how something simple gets lots of comments and versions :-)
>>
>>> ...
>>> + * This has to be a macro since HASH_BITS() will not work on pointers since
>>> + * it calculates the size du
On Wed, 2012-09-26 at 14:45 +0100, David Laight wrote:
> Amazing how something simple gets lots of comments and versions :-)
>
> > ...
> > + * This has to be a macro since HASH_BITS() will not work on pointers since
> > + * it calculates the size during preprocessing.
> > + */
> > +#define hash_em
Amazing how something simple gets lots of comments and versions :-)
> ...
> + * This has to be a macro since HASH_BITS() will not work on pointers since
> + * it calculates the size during preprocessing.
> + */
> +#define hash_empty(hashtable)
>
This hashtable implementation is using hlist buckets to provide a simple
hashtable to prevent it from getting reimplemented all over the kernel.
Signed-off-by: Sasha Levin
---
Changes since v5:
- Fix hash_init.
- Clarify this implementation deals with statically allocated hashtables only.
i
15 matches
Mail list logo