Subject: Re: [PATCH] rhashtable: Restore insecure_elasticity toggle

From: kernel test robot <[email-masked]>
Date: Mon, 20 Apr 2026 09:46:31 +0800

Hi Herbert,

kernel test robot noticed the following build errors:

[auto build test ERROR on akpm-mm/mm-nonmm-unstable]
[also build test ERROR on net/main net-next/main linus/master horms-ipvs/master v7.0 next-20260417]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Herbert-Xu/rhashtable-Restore-insecure_elasticity-toggle/20260418-233732
base:   https://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm.git mm-nonmm-unstable
patch link:    https://lore.kernel.org/r/aeLgjAeJuidWNy3N%40gondor.apana.org.au
patch subject: [PATCH] rhashtable: Restore insecure_elasticity toggle
config: alpha-allnoconfig
compiler: alpha-linux-gcc (GCC) 15.2.0
reproduce (this is a W=1 build):

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <[email-masked]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email-masked]/

All errors (new ones prefixed by >>):

   In file included from lib/rhashtable.c:25:
   include/linux/rhashtable.h: In function '__rhashtable_insert_fast':
>> include/linux/rhashtable.h:831:39: error: invalid type argument of '->' (have 'struct rhashtable_params')
     831 |         if (elasticity <= 0 && !params->insecure_elasticity)
         |                                       ^~
   include/linux/rhashtable.h:839:20: error: invalid type argument of '->' (have 'struct rhashtable_params')
     839 |             !params->insecure_elasticity)
         |                    ^~
   lib/rhashtable.c: In function 'rhashtable_lookup_one':
>> lib/rhashtable.c:541:38: error: invalid type argument of '->' (have 'struct rhashtable_params')
     541 |         if (elasticity <= 0 && !ht->p->insecure_elasticity)
         |                                      ^~
   lib/rhashtable.c: In function 'rhashtable_insert_one':
   lib/rhashtable.c:572:19: error: invalid type argument of '->' (have 'struct rhashtable_params')
     572 |             !ht->p->insecure_elasticity)
         |                   ^~

vim +831 include/linux/rhashtable.h

   756	
   757	/* Internal function, please use rhashtable_insert_fast() instead. This
   758	 * function returns the existing element already in hashes if there is a clash,
   759	 * otherwise it returns an error via ERR_PTR().
   760	 */
   761	static __always_inline void *__rhashtable_insert_fast(
   762		struct rhashtable *ht, const void *key, struct rhash_head *obj,
   763		const struct rhashtable_params params, bool rhlist)
   764	{
   765		struct rhashtable_compare_arg arg = {
   766			.ht = ht,
   767			.key = key,
   768		};
   769		struct rhash_lock_head __rcu **bkt;
   770		struct rhash_head __rcu **pprev;
   771		struct bucket_table *tbl;
   772		struct rhash_head *head;
   773		unsigned long flags;
   774		unsigned int hash;
   775		int elasticity;
   776		void *data;
   777	
   778		rcu_read_lock();
   779	
   780		tbl = rht_dereference_rcu(ht->tbl, ht);
   781		hash = rht_head_hashfn(ht, tbl, obj, params);
   782		elasticity = RHT_ELASTICITY;
   783		bkt = rht_bucket_insert(ht, tbl, hash);
   784		data = ERR_PTR(-ENOMEM);
   785		if (!bkt)
   786			goto out;
   787		pprev = NULL;
   788		flags = rht_lock(tbl, bkt);
   789	
   790		if (unlikely(rcu_access_pointer(tbl->future_tbl))) {
   791	slow_path:
   792			rht_unlock(tbl, bkt, flags);
   793			rcu_read_unlock();
   794			return rhashtable_insert_slow(ht, key, obj);
   795		}
   796	
   797		rht_for_each_from(head, rht_ptr(bkt, tbl, hash), tbl, hash) {
   798			struct rhlist_head *plist;
   799			struct rhlist_head *list;
   800	
   801			elasticity--;
   802			if (!key ||
   803			    (params.obj_cmpfn ?
   804			     params.obj_cmpfn(&arg, rht_obj(ht, head)) :
   805			     rhashtable_compare(&arg, rht_obj(ht, head)))) {
   806				pprev = &head->next;
   807				continue;
   808			}
   809	
   810			data = rht_obj(ht, head);
   811	
   812			if (!rhlist)
   813				goto out_unlock;
   814	
   815	
   816			list = container_of(obj, struct rhlist_head, rhead);
   817			plist = container_of(head, struct rhlist_head, rhead);
   818	
   819			RCU_INIT_POINTER(list->next, plist);
   820			head = rht_dereference_bucket(head->next, tbl, hash);
   821			RCU_INIT_POINTER(list->rhead.next, head);
   822			if (pprev) {
   823				rcu_assign_pointer(*pprev, obj);
   824				rht_unlock(tbl, bkt, flags);
   825			} else
   826				rht_assign_unlock(tbl, bkt, obj, flags);
   827			data = NULL;
   828			goto out;
   829		}
   830	
 > 831		if (elasticity <= 0 && !params->insecure_elasticity)
   832			goto slow_path;
   833	
   834		data = ERR_PTR(-E2BIG);
   835		if (unlikely(rht_grow_above_max(ht, tbl)))
   836			goto out_unlock;
   837	
   838		if (unlikely(rht_grow_above_100(ht, tbl)) &&
   839		    !params->insecure_elasticity)
   840			goto slow_path;
   841	
   842		/* Inserting at head of list makes unlocking free. */
   843		head = rht_ptr(bkt, tbl, hash);
   844	
   845		RCU_INIT_POINTER(obj->next, head);
   846		if (rhlist) {
   847			struct rhlist_head *list;
   848	
   849			list = container_of(obj, struct rhlist_head, rhead);
   850			RCU_INIT_POINTER(list->next, NULL);
   851		}
   852	
   853		atomic_inc(&ht->nelems);
   854		rht_assign_unlock(tbl, bkt, obj, flags);
   855	
   856		if (rht_grow_above_75(ht, tbl))
   857			schedule_work(&ht->run_work);
   858	
   859		data = NULL;
   860	out:
   861		rcu_read_unlock();
   862	
   863		return data;
   864	
   865	out_unlock:
   866		rht_unlock(tbl, bkt, flags);
   867		goto out;
   868	}
   869	

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki