[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <54043C45.7090005@windriver.com>
Date: Mon, 1 Sep 2014 17:28:37 +0800
From: Ying Xue <ying.xue@...driver.com>
To: Thomas Graf <tgraf@...g.ch>
CC: <davem@...emloft.net>, <eric.dumazet@...il.com>,
<netdev@...r.kernel.org>
Subject: Re: [PATCH net-next v3] lib/rhashtable: allow user to set the minimum
shifts of shrinking
On 09/01/2014 05:03 PM, Thomas Graf wrote:
> On 08/30/14 at 02:48pm, Ying Xue wrote:
>> Although rhashtable library allows user to specify a quiet big size
>> for user's created hash table, the table may be shrunk to a
>> very small size - HASH_MIN_SIZE(4) after object is removed from
>> the table at the first time. Subsequently, even if the total amount
>> of objects saved in the table is quite lower than user's initial
>> setting in a long time, the hash table size is still dynamically
>> adjusted by rhashtable_shrink() or rhashtable_expand() each time
>> object is inserted or removed from the table. However, as
>> synchronize_rcu() has to be called when table is shrunk or
>> expanded by the two functions, we should permit user to set the
>> minimum table size through configuring the minimum number of shifts
>> according to user specific requirement, avoiding these expensive
>> actions of shrinking or expanding because of calling synchronize_rcu().
>>
>> Signed-off-by: Ying Xue <ying.xue@...driver.com>
>
> I see the following warning when compiling:
>
> In file included from lib/rhashtable.c:17:0:
> lib/rhashtable.c: In function ‘rhashtable_init’:
> include/linux/kernel.h:715:17: warning: comparison of distinct pointer types lacks a cast [enabled by default]
> (void) (&_max1 == &_max2); \
> ^
> lib/rhashtable.c:570:22: note: in expansion of macro ‘max’
> params->min_shift = max(params->min_shift, ilog2(HASH_MIN_SIZE));
>
>
Thanks for your check.
After I made below change, the compiling warning disappears.
+ params->min_shift = max(params->min_shift,
+ (size_t)ilog2(HASH_MIN_SIZE));
+
But when I check the patch format with scripts/checkpatch.pl, below
warning occurs:
./scripts/checkpatch.pl
0001-lib-rhashtable-allow-user-to-set-the-minimum-shifts-.patch
WARNING: max() should probably be max_t(size_t, params->min_shift,
ilog2(HASH_MIN_SIZE))
#77: FILE: lib/rhashtable.c:570:
+ params->min_shift = max(params->min_shift,
(size_t)ilog2(HASH_MIN_SIZE));
total: 0 errors, 1 warnings, 46 lines checked
0001-lib-rhashtable-allow-user-to-set-the-minimum-shifts-.patch has
style problems, please review.
Do you think it's worth replacing max() macro with max_t() regarding
above suggestion?
By the way, if the replacement should do, all max() macro in the
lib/rhashtable.c should be replaced as well.
Thanks,
Ying
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists