* [PATCH 5/6] net/ipv4: Update ip_tunnel_metadata_cnt static key to modern api
[not found] <20180326210929.5244-1-dave@stgolabs.net>
@ 2018-03-26 21:09 ` Davidlohr Bueso
2018-03-27 15:44 ` David Miller
2018-03-26 21:09 ` [PATCH 6/6] net/sock: Update memalloc_socks " Davidlohr Bueso
1 sibling, 1 reply; 4+ messages in thread
From: Davidlohr Bueso @ 2018-03-26 21:09 UTC (permalink / raw)
To: peterz, mingo, akpm
Cc: linux-kernel, Davidlohr Bueso, David S . Miller, netdev,
Davidlohr Bueso
No changes in refcount semantics -- key init is false; replace
static_key_slow_inc|dec with static_branch_inc|dec
static_key_false with static_branch_unlikely
Added a '_key' suffix to i2c_trace_msg, for better self
documentation.
Cc: David S. Miller <davem@davemloft.net>
Cc: netdev@vger.kernel.org
Signed-off-by: Davidlohr Bueso <dbueso@suse.de>
---
include/net/ip_tunnels.h | 4 ++--
net/ipv4/ip_tunnel_core.c | 6 +++---
2 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/include/net/ip_tunnels.h b/include/net/ip_tunnels.h
index 540a4b4417bf..fc494b48a64a 100644
--- a/include/net/ip_tunnels.h
+++ b/include/net/ip_tunnels.h
@@ -466,12 +466,12 @@ static inline struct ip_tunnel_info *lwt_tun_info(struct lwtunnel_state *lwtstat
return (struct ip_tunnel_info *)lwtstate->data;
}
-extern struct static_key ip_tunnel_metadata_cnt;
+DECLARE_STATIC_KEY_FALSE(ip_tunnel_metadata_cnt);
/* Returns > 0 if metadata should be collected */
static inline int ip_tunnel_collect_metadata(void)
{
- return static_key_false(&ip_tunnel_metadata_cnt);
+ return static_branch_unlikely(&ip_tunnel_metadata_cnt);
}
void __init ip_tunnel_core_init(void);
diff --git a/net/ipv4/ip_tunnel_core.c b/net/ipv4/ip_tunnel_core.c
index 2f39479be92f..dde671e97829 100644
--- a/net/ipv4/ip_tunnel_core.c
+++ b/net/ipv4/ip_tunnel_core.c
@@ -423,17 +423,17 @@ void __init ip_tunnel_core_init(void)
lwtunnel_encap_add_ops(&ip6_tun_lwt_ops, LWTUNNEL_ENCAP_IP6);
}
-struct static_key ip_tunnel_metadata_cnt = STATIC_KEY_INIT_FALSE;
+DEFINE_STATIC_KEY_FALSE(ip_tunnel_metadata_cnt);
EXPORT_SYMBOL(ip_tunnel_metadata_cnt);
void ip_tunnel_need_metadata(void)
{
- static_key_slow_inc(&ip_tunnel_metadata_cnt);
+ static_branch_inc(&ip_tunnel_metadata_cnt);
}
EXPORT_SYMBOL_GPL(ip_tunnel_need_metadata);
void ip_tunnel_unneed_metadata(void)
{
- static_key_slow_dec(&ip_tunnel_metadata_cnt);
+ static_branch_dec(&ip_tunnel_metadata_cnt);
}
EXPORT_SYMBOL_GPL(ip_tunnel_unneed_metadata);
--
2.13.6
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH 6/6] net/sock: Update memalloc_socks static key to modern api
[not found] <20180326210929.5244-1-dave@stgolabs.net>
2018-03-26 21:09 ` [PATCH 5/6] net/ipv4: Update ip_tunnel_metadata_cnt static key to modern api Davidlohr Bueso
@ 2018-03-26 21:09 ` Davidlohr Bueso
1 sibling, 0 replies; 4+ messages in thread
From: Davidlohr Bueso @ 2018-03-26 21:09 UTC (permalink / raw)
To: peterz, mingo, akpm
Cc: linux-kernel, Davidlohr Bueso, David S . Miller, netdev,
Davidlohr Bueso
No changes in refcount semantics -- key init is false; replace
static_key_slow_inc|dec with static_branch_inc|dec
static_key_false with static_branch_unlikely
Added a '_key' suffix to memalloc_socks, for better self
documentation.
Cc: David S. Miller <davem@davemloft.net>
Cc: netdev@vger.kernel.org
Signed-off-by: Davidlohr Bueso <dbueso@suse.de>
---
include/net/sock.h | 4 ++--
net/core/sock.c | 8 ++++----
2 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/include/net/sock.h b/include/net/sock.h
index 8c428c6847af..15d676365743 100644
--- a/include/net/sock.h
+++ b/include/net/sock.h
@@ -803,10 +803,10 @@ static inline bool sock_flag(const struct sock *sk, enum sock_flags flag)
}
#ifdef CONFIG_NET
-extern struct static_key memalloc_socks;
+DECLARE_STATIC_KEY_FALSE(memalloc_socks_key);
static inline int sk_memalloc_socks(void)
{
- return static_key_false(&memalloc_socks);
+ return static_branch_unlikely(&memalloc_socks_key);
}
#else
diff --git a/net/core/sock.c b/net/core/sock.c
index e689496dfd8a..670f35803411 100644
--- a/net/core/sock.c
+++ b/net/core/sock.c
@@ -323,8 +323,8 @@ EXPORT_SYMBOL(sysctl_optmem_max);
int sysctl_tstamp_allow_data __read_mostly = 1;
-struct static_key memalloc_socks = STATIC_KEY_INIT_FALSE;
-EXPORT_SYMBOL_GPL(memalloc_socks);
+DEFINE_STATIC_KEY_FALSE(memalloc_socks_key);
+EXPORT_SYMBOL_GPL(memalloc_socks_key);
/**
* sk_set_memalloc - sets %SOCK_MEMALLOC
@@ -338,7 +338,7 @@ void sk_set_memalloc(struct sock *sk)
{
sock_set_flag(sk, SOCK_MEMALLOC);
sk->sk_allocation |= __GFP_MEMALLOC;
- static_key_slow_inc(&memalloc_socks);
+ static_branch_inc(&memalloc_socks_key);
}
EXPORT_SYMBOL_GPL(sk_set_memalloc);
@@ -346,7 +346,7 @@ void sk_clear_memalloc(struct sock *sk)
{
sock_reset_flag(sk, SOCK_MEMALLOC);
sk->sk_allocation &= ~__GFP_MEMALLOC;
- static_key_slow_dec(&memalloc_socks);
+ static_branch_dec(&memalloc_socks_key);
/*
* SOCK_MEMALLOC is allowed to ignore rmem limits to ensure forward
--
2.13.6
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH 5/6] net/ipv4: Update ip_tunnel_metadata_cnt static key to modern api
2018-03-27 15:44 ` David Miller
@ 2018-03-27 15:37 ` Davidlohr Bueso
0 siblings, 0 replies; 4+ messages in thread
From: Davidlohr Bueso @ 2018-03-27 15:37 UTC (permalink / raw)
To: David Miller; +Cc: peterz, mingo, akpm, linux-kernel, netdev, dbueso
On Tue, 27 Mar 2018, David Miller wrote:
>From: Davidlohr Bueso <dave@stgolabs.net>
>Date: Mon, 26 Mar 2018 14:09:28 -0700
>
>> No changes in refcount semantics -- key init is false; replace
>>
>> static_key_slow_inc|dec with static_branch_inc|dec
>> static_key_false with static_branch_unlikely
>>
>> Added a '_key' suffix to i2c_trace_msg, for better self
>> documentation.
>
>I see no reference to i2c_trace_msg in this patch.
Sorry, that was from a previous changelog. The reason why it was not updated was
because I chose not to rename to ip_tunnel_metadata_cnt_key, so the whole sentence
needed removal. Do you want a v3 or can you pick up as is?
Thanks,
Davidlohr
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH 5/6] net/ipv4: Update ip_tunnel_metadata_cnt static key to modern api
2018-03-26 21:09 ` [PATCH 5/6] net/ipv4: Update ip_tunnel_metadata_cnt static key to modern api Davidlohr Bueso
@ 2018-03-27 15:44 ` David Miller
2018-03-27 15:37 ` Davidlohr Bueso
0 siblings, 1 reply; 4+ messages in thread
From: David Miller @ 2018-03-27 15:44 UTC (permalink / raw)
To: dave; +Cc: peterz, mingo, akpm, linux-kernel, netdev, dbueso
From: Davidlohr Bueso <dave@stgolabs.net>
Date: Mon, 26 Mar 2018 14:09:28 -0700
> No changes in refcount semantics -- key init is false; replace
>
> static_key_slow_inc|dec with static_branch_inc|dec
> static_key_false with static_branch_unlikely
>
> Added a '_key' suffix to i2c_trace_msg, for better self
> documentation.
I see no reference to i2c_trace_msg in this patch.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2018-03-27 15:44 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <20180326210929.5244-1-dave@stgolabs.net>
2018-03-26 21:09 ` [PATCH 5/6] net/ipv4: Update ip_tunnel_metadata_cnt static key to modern api Davidlohr Bueso
2018-03-27 15:44 ` David Miller
2018-03-27 15:37 ` Davidlohr Bueso
2018-03-26 21:09 ` [PATCH 6/6] net/sock: Update memalloc_socks " Davidlohr Bueso
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).