[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <5055B852.4010906@gmail.com>
Date: Sun, 16 Sep 2012 13:30:26 +0200
From: Sasha Levin <levinsasha928@...il.com>
To: Matthias Diener <matthias.diener@...ener.org>
CC: linux-kernel@...r.kernel.org
Subject: Re: [PATCH v5] hashtable: introduce a small and naive hashtable
On 09/16/2012 01:08 AM, Matthias Diener wrote:
> Sasha Levin (levinsasha928 <at> gmail.com) wrote:
>> On Sat, Sep 15, 2012 at 5:14 PM, Mathieu Desnoyers
>> <mathieu.desnoyers <at> efficios.com> wrote:
>>> * Sasha Levin (levinsasha928 <at> gmail.com) wrote:
> [...]
>>>> +#define hash_init(hashtable) \
>>>> +({ \
>>>> + int __i; \
>>>> + \
>>>> + for (__i = 0; __i < HASH_BITS(hashtable); __i++) \
>>>
>>> I think this fails to initialize the whole table. You'd need
>>>
>>> HASH_BITS -> HASH_SIZE
>>
>> Right.
>>
>> Unfortunately it's pretty hard catching something like this :/
>>
>>> Which brings the following question: how did you test this code ? It
>>> would be nice to have a small test module along with this patchset that
>>> stress-tests this simple hash table in various configurations (on stack,
>>> in data, etc).
>>
>> I do two things:
>>
>> - A small userspace test (since this header works just fine from
>> userspace as well).
>
>
> It would be interesting to run some experiments with this hashtable in
> userspace.
> Could you post the test code here?
Sure, I've attached the test code. There are 2 things to remember it:
1. The code looks like crap :) I've never intended it to be seen by others.
2. It should be used in the context of "sanitized" kernel headers so it could
be included directly. I usually work in the directory of lkvm, and compile this
code using:
gcc -Iinclude/ -I../../include/ -O0 -ggdb hashtest.c
View attachment "hashtest.c" of type "text/x-csrc" (1353 bytes)
Powered by blists - more mailing lists