diff -drupN a/include/linux/rhashtable.h b/include/linux/rhashtable.h
--- a/include/linux/rhashtable.h	2018-08-06 17:23:04.000000000 +0300
+++ b/include/linux/rhashtable.h	2022-06-12 05:28:14.000000000 +0300
@@ -338,6 +338,7 @@ static inline spinlock_t *rht_bucket_loc
 	return &tbl->locks[hash & tbl->locks_mask];
 }
 
+#ifdef CONFIG_RHASHTABLE
 #ifdef CONFIG_PROVE_LOCKING
 int lockdep_rht_mutex_is_held(struct rhashtable *ht);
 int lockdep_rht_bucket_is_held(const struct bucket_table *tbl, u32 hash);
@@ -373,6 +374,7 @@ void rhashtable_free_and_destroy(struct
 				 void (*free_fn)(void *ptr, void *arg),
 				 void *arg);
 void rhashtable_destroy(struct rhashtable *ht);
+#endif /* CONFIG_RHASHTABLE */
 
 #define rht_dereference(p, ht) \
 	rcu_dereference_protected(p, lockdep_rht_mutex_is_held(ht))