[memcg:cleanups/kvmalloc 5/5] lib/rhashtable.c:80:3: note: in expansion of macro 'if'

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



tree:   https://git.kernel.org/pub/scm/linux/kernel/git/mhocko/mm.git cleanups/kvmalloc
head:   351a752d1cd188fbe199f7a42094af72ee90fd63
commit: 351a752d1cd188fbe199f7a42094af72ee90fd63 [5/5] rhashtable: simplify a strange allocation pattern
config: x86_64-randconfig-x012-201701 (attached as .config)
compiler: gcc-6 (Debian 6.2.0-3) 6.2.0 20160901
reproduce:
        git checkout 351a752d1cd188fbe199f7a42094af72ee90fd63
        # save the attached .config to linux build tree
        make ARCH=x86_64 

All warnings (new ones prefixed by >>):

   In file included from arch/x86/include/asm/atomic.h:4:0,
                    from include/linux/atomic.h:4,
                    from lib/rhashtable.c:17:
   lib/rhashtable.c: In function 'alloc_bucket_locks':
   lib/rhashtable.c:80:31: error: 'gfp_' undeclared (first use in this function)
      if (gfpflags_allow_blocking(gfp_))
                                  ^
   include/linux/compiler.h:149:30: note: in definition of macro '__trace_if'
     if (__builtin_constant_p(!!(cond)) ? !!(cond) :   \
                                 ^~~~
>> lib/rhashtable.c:80:3: note: in expansion of macro 'if'
      if (gfpflags_allow_blocking(gfp_))
      ^~
   lib/rhashtable.c:80:31: note: each undeclared identifier is reported only once for each function it appears in
      if (gfpflags_allow_blocking(gfp_))
                                  ^
   include/linux/compiler.h:149:30: note: in definition of macro '__trace_if'
     if (__builtin_constant_p(!!(cond)) ? !!(cond) :   \
                                 ^~~~
>> lib/rhashtable.c:80:3: note: in expansion of macro 'if'
      if (gfpflags_allow_blocking(gfp_))
      ^~

vim +/if +80 lib/rhashtable.c

    11	 *
    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	32UL
    34	
    35	static u32 head_hashfn(struct rhashtable *ht,
    36			       const struct bucket_table *tbl,
    37			       const struct rhash_head *he)
    38	{
    39		return rht_head_hashfn(ht, tbl, he, ht->p);
    40	}
    41	
    42	#ifdef CONFIG_PROVE_LOCKING
    43	#define ASSERT_RHT_MUTEX(HT) BUG_ON(!lockdep_rht_mutex_is_held(HT))
    44	
    45	int lockdep_rht_mutex_is_held(struct rhashtable *ht)
    46	{
    47		return (debug_locks) ? lockdep_is_held(&ht->mutex) : 1;
    48	}
    49	EXPORT_SYMBOL_GPL(lockdep_rht_mutex_is_held);
    50	
    51	int lockdep_rht_bucket_is_held(const struct bucket_table *tbl, u32 hash)
    52	{
    53		spinlock_t *lock = rht_bucket_lock(tbl, hash);
    54	
    55		return (debug_locks) ? lockdep_is_held(lock) : 1;
    56	}
    57	EXPORT_SYMBOL_GPL(lockdep_rht_bucket_is_held);
    58	#else
    59	#define ASSERT_RHT_MUTEX(HT)
    60	#endif
    61	
    62	
    63	static int alloc_bucket_locks(struct rhashtable *ht, struct bucket_table *tbl,
    64				      gfp_t gfp)
    65	{
    66		unsigned int i, size;
    67	#if defined(CONFIG_PROVE_LOCKING)
    68		unsigned int nr_pcpus = 2;
    69	#else
    70		unsigned int nr_pcpus = num_possible_cpus();
    71	#endif
    72	
    73		nr_pcpus = min_t(unsigned int, nr_pcpus, 64UL);
    74		size = roundup_pow_of_two(nr_pcpus * ht->p.locks_mul);
    75	
    76		/* Never allocate more than 0.5 locks per bucket */
    77		size = min_t(unsigned int, size, tbl->size >> 1);
    78	
    79		if (sizeof(spinlock_t) != 0) {
  > 80			if (gfpflags_allow_blocking(gfp_))
    81				tbl->locks = kvmalloc(size * sizeof(spinlock_t), gfp);
    82			else
    83				tbl->locks = kmalloc_array(size, sizeof(spinlock_t),

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

Attachment: .config.gz
Description: application/gzip


[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]