# Re: \[PATCH net\] rhashtable: avoid large lock-array allocations

- From: kbuild test robot \<hidden\>
- Date: 2016-08-12 02:28:52 
- List: netdev
- Page: https://ratatoskr.run/netdev/2016/08/11025288
- Thread: https://ratatoskr.run/netdev/2016/08/11025287/t.md

```text
Hi Florian,

[auto build test WARNING on net/master]

url:    https://github.com/0day-ci/linux/commits/Florian-Westphal/rhashtable-avoid-large-lock-array-allocations/20160812-101458
config: x86_64-randconfig-x015-201632 (attached as .config)
compiler: gcc-6 (Debian 6.1.1-9) 6.1.1 20160705
reproduce:
        # save the attached .config to linux build tree
        make ARCH=x86_64 

All warnings (new ones prefixed by >>):

   In file included from lib/rhashtable.c:18:0:
   lib/rhashtable.c: In function 'rhashtable_init':
>> lib/rhashtable.c:34:30: warning: division by zero [-Wdiv-by-zero]
              2 * L1_CACHE_BYTES / sizeof(spinlock_t), 1)
                                 ^
   include/linux/kernel.h:787:17: note: in definition of macro 'max_t'
     type __max1 = (x);   \
                    ^
>> lib/rhashtable.c:779:21: note: in expansion of macro 'BUCKET_LOCKS_PER_CPU'
      ht->p.locks_mul = BUCKET_LOCKS_PER_CPU;
                        ^~~~~~~~~~~~~~~~~~~~

vim +34 lib/rhashtable.c

    12	 * This program is free software; you can redistribute it and/or modify
    13	 * it under the terms of the GNU General Public License version 2 as
    14	 * published by the Free Software Foundation.
    15	 */
    16	
    17	#include <linux/atomic.h>
  > 18	#include <linux/kernel.h>
    19	#include <linux/init.h>
    20	#include <linux/log2.h>
    21	#include <linux/sched.h>
    22	#include <linux/slab.h>
    23	#include <linux/vmalloc.h>
    24	#include <linux/mm.h>
    25	#include <linux/jhash.h>
    26	#include <linux/random.h>
    27	#include <linux/rhashtable.h>
    28	#include <linux/err.h>
    29	#include <linux/export.h>
    30	
    31	#define HASH_DEFAULT_SIZE	64UL
    32	#define HASH_MIN_SIZE		4U
    33	#define BUCKET_LOCKS_PER_CPU	max_t(unsigned int, \
  > 34					      2 * L1_CACHE_BYTES / sizeof(spinlock_t), 1)
    35	
    36	static u32 head_hashfn(struct rhashtable *ht,
    37			       const struct bucket_table *tbl,

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation
```

## Attachments

- [.config.gz](https://ratatoskr.run/netdev/2016/08/11025288/attachment/0) (application/octet-stream, 23604 bytes)
