diff options
author | Jason A. Donenfeld <Jason@zx2c4.com> | 2017-01-13 05:25:46 +0100 |
---|---|---|
committer | Jason A. Donenfeld <Jason@zx2c4.com> | 2017-01-13 05:25:46 +0100 |
commit | 4da2ad92155a6f71012c25a47195637e48153446 (patch) | |
tree | 90ad7e5e1cfd99df24503a952fcc3ac435b74b21 | |
parent | 1350390458461897bf26760a908571905d871bcf (diff) |
Use __read_mostly attribute when possible
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
-rw-r--r-- | src/crypto/chacha20poly1305.c | 6 | ||||
-rw-r--r-- | src/data.c | 4 | ||||
-rw-r--r-- | src/noise.c | 4 | ||||
-rw-r--r-- | src/ratelimiter.c | 4 |
4 files changed, 9 insertions, 9 deletions
diff --git a/src/crypto/chacha20poly1305.c b/src/crypto/chacha20poly1305.c index 8f187fc..28e27b6 100644 --- a/src/crypto/chacha20poly1305.c +++ b/src/crypto/chacha20poly1305.c @@ -27,9 +27,9 @@ asmlinkage void poly1305_asm_2block_sse2(u32 *h, const u8 *src, const u32 *r, un #ifdef CONFIG_AS_AVX2 asmlinkage void poly1305_asm_4block_avx2(u32 *h, const u8 *src, const u32 *r, unsigned int blocks, const u32 *u); #endif -static bool chacha20poly1305_use_avx2 = false; -static bool chacha20poly1305_use_ssse3 = false; -static bool chacha20poly1305_use_sse2 = false; +static bool chacha20poly1305_use_avx2 __read_mostly = false; +static bool chacha20poly1305_use_ssse3 __read_mostly = false; +static bool chacha20poly1305_use_sse2 __read_mostly = false; void chacha20poly1305_init(void) { chacha20poly1305_use_sse2 = boot_cpu_has(X86_FEATURE_XMM2); @@ -43,8 +43,8 @@ struct decryption_ctx { }; #ifdef CONFIG_WIREGUARD_PARALLEL -static struct kmem_cache *encryption_ctx_cache; -static struct kmem_cache *decryption_ctx_cache; +static struct kmem_cache *encryption_ctx_cache __read_mostly; +static struct kmem_cache *decryption_ctx_cache __read_mostly; int packet_init_data_caches(void) { diff --git a/src/noise.c b/src/noise.c index 9555e58..0ffffd7 100644 --- a/src/noise.c +++ b/src/noise.c @@ -24,8 +24,8 @@ static const u8 handshake_name[33] = "Noise_IK_25519_ChaChaPoly_BLAKE2s"; static const u8 handshake_psk_name[36] = "NoisePSK_IK_25519_ChaChaPoly_BLAKE2s"; -static u8 handshake_name_hash[NOISE_HASH_LEN]; -static u8 handshake_psk_name_hash[NOISE_HASH_LEN]; +static u8 handshake_name_hash[NOISE_HASH_LEN] __read_mostly; +static u8 handshake_psk_name_hash[NOISE_HASH_LEN] __read_mostly; static const u8 identifier_name[34] = "WireGuard v0 zx2c4 Jason@zx2c4.com"; static atomic64_t keypair_counter = ATOMIC64_INIT(0); diff --git a/src/ratelimiter.c b/src/ratelimiter.c index 30e4175..c45d7ce 100644 --- a/src/ratelimiter.c +++ b/src/ratelimiter.c @@ -8,9 +8,9 @@ #include <linux/netfilter/x_tables.h> #include <net/ip.h> -static struct xt_match *v4_match; +static struct xt_match *v4_match __read_mostly; #if IS_ENABLED(CONFIG_IPV6) -static struct xt_match *v6_match; +static struct xt_match *v6_match __read_mostly; #endif enum { |