summaryrefslogtreecommitdiff
path: root/drivers/net/wireguard/ratelimiter.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/wireguard/ratelimiter.c')
-rw-r--r--drivers/net/wireguard/ratelimiter.c16
1 files changed, 14 insertions, 2 deletions
diff --git a/drivers/net/wireguard/ratelimiter.c b/drivers/net/wireguard/ratelimiter.c
index 9baa930c8157..e33ec72a9642 100644
--- a/drivers/net/wireguard/ratelimiter.c
+++ b/drivers/net/wireguard/ratelimiter.c
@@ -3,6 +3,18 @@
* Copyright (C) 2015-2019 Jason A. Donenfeld <Jason@zx2c4.com>. All Rights Reserved.
*/
+#ifdef COMPAT_CANNOT_DEPRECIATE_BH_RCU
+/* We normally alias all non-_bh functions to the _bh ones in the compat layer,
+ * but that's not appropriate here, where we actually do want non-_bh ones.
+ */
+#undef synchronize_rcu
+#define synchronize_rcu old_synchronize_rcu
+#undef call_rcu
+#define call_rcu old_call_rcu
+#undef rcu_barrier
+#define rcu_barrier old_rcu_barrier
+#endif
+
#include "ratelimiter.h"
#include <linux/siphash.h>
#include <linux/mm.h>
@@ -170,9 +182,9 @@ int wg_ratelimiter_init(void)
* we borrow their wisdom about good table sizes on different systems
* dependent on RAM. This calculation here comes from there.
*/
- table_size = (totalram_pages > (1U << 30) / PAGE_SIZE) ? 8192 :
+ table_size = (totalram_pages() > (1U << 30) / PAGE_SIZE) ? 8192 :
max_t(unsigned long, 16, roundup_pow_of_two(
- (totalram_pages << PAGE_SHIFT) /
+ (totalram_pages() << PAGE_SHIFT) /
(1U << 14) / sizeof(struct hlist_head)));
max_entries = table_size * 8;