Jarek Poplawski a écrit :
Jarek Poplawski wrote, On 11/04/2007 06:58 PM:

Eric Dumazet wrote, On 11/04/2007 12:31 PM:

...

+static inline int inet_ehash_locks_alloc(struct inet_hashinfo *hashinfo)
+{

...

+       if (sizeof(rwlock_t) != 0) {

...

+               for (i = 0; i < size; i++)
+                       rwlock_init(&hashinfo->ehash_locks[i]);

This looks better now, but still is doubtful to me: even if it's safe with
current rwlock implementation, can't we imagine some new debugging or
statistical code added, which would be called from rwlock_init() without
using rwlock_t structure? IMHO, if read_lock() etc. are called in such a
case, rwlock_init() should be done as well.


Of course I mean: if sizeof(rwlock_t) == 0.

Given those two choices :

#if defined(CONFIG_SMP) || defined(CONFIG_PROVE__LOCKING)
    kmalloc(sizeof(rwlock_t) * size);
#endif

and

   if (sizeof(rwlock_t) != 0) {
       kmalloc(sizeof(rwlock_t) * size);
   }

I prefer the 2nd one. Less error prone, and no need to remember how are spelled the gazillions CONFIG_something we have.


-
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to