All of lore.kernel.org
 help / color / mirror / Atom feed
From: Paul Moore <paul.moore-VXdhtT5mjnY@public.gmane.org>
To: Jiri Olsa <jolsa-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
Cc: kvm-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	containers-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	dhowells-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org,
	dipankar-xthvdsQ13ZrQT0dZR+AlfA@public.gmane.org,
	johannes-cdvu00un1VgdHxzADdlk8Q@public.gmane.org
Subject: Re: [PATCH 3/3] net - removing superfluous rcu_read_lock_held check
Date: Mon, 01 Nov 2010 17:47:12 -0400	[thread overview]
Message-ID: <1288648032.5167.0.camel__31286.4342857667$1288648193$gmane$org@sifl> (raw)
In-Reply-To: <1288638909-10541-4-git-send-email-jolsa-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>

On Mon, 2010-11-01 at 20:15 +0100, Jiri Olsa wrote:
> hi,
> the rcu_dereference_check is defined as
> 
> 	#define rcu_dereference_check(p, c) \
> 	   __rcu_dereference_check((p), rcu_read_lock_held() || (c), __rcu)
> 
> so the caller does not need to specify rcu_read_lock_held() condition.
> 
> wbr,
> jirka
> 
> 
> Signed-off-by: Jiri Olsa <jolsa-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>

The NetLabel changes look fine to me; thanks for the cleanup.

> ---
>  include/linux/rtnetlink.h          |    3 +--
>  include/net/sock.h                 |    3 +--
>  net/mac80211/sta_info.c            |    4 ----
>  net/netlabel/netlabel_domainhash.c |    3 +--
>  net/netlabel/netlabel_unlabeled.c  |    3 +--
>  5 files changed, 4 insertions(+), 12 deletions(-)
> 
> diff --git a/include/linux/rtnetlink.h b/include/linux/rtnetlink.h
> index d42f274..dfe5ba1 100644
> --- a/include/linux/rtnetlink.h
> +++ b/include/linux/rtnetlink.h
> @@ -758,8 +758,7 @@ extern int lockdep_rtnl_is_held(void);
>   * or RTNL. Note : Please prefer rtnl_dereference() or rcu_dereference()
>   */
>  #define rcu_dereference_rtnl(p)					\
> -	rcu_dereference_check(p, rcu_read_lock_held() ||	\
> -				 lockdep_rtnl_is_held())
> +	rcu_dereference_check(p, lockdep_rtnl_is_held())
>  
>  /**
>   * rtnl_dereference - fetch RCU pointer when updates are prevented by RTNL
> diff --git a/include/net/sock.h b/include/net/sock.h
> index c7a7362..bee3e9c 100644
> --- a/include/net/sock.h
> +++ b/include/net/sock.h
> @@ -1274,8 +1274,7 @@ extern unsigned long sock_i_ino(struct sock *sk);
>  static inline struct dst_entry *
>  __sk_dst_get(struct sock *sk)
>  {
> -	return rcu_dereference_check(sk->sk_dst_cache, rcu_read_lock_held() ||
> -						       sock_owned_by_user(sk) ||
> +	return rcu_dereference_check(sk->sk_dst_cache, sock_owned_by_user(sk) ||
>  						       lockdep_is_held(&sk->sk_lock.slock));
>  }
>  
> diff --git a/net/mac80211/sta_info.c b/net/mac80211/sta_info.c
> index 6d8f897..c879217 100644
> --- a/net/mac80211/sta_info.c
> +++ b/net/mac80211/sta_info.c
> @@ -94,7 +94,6 @@ struct sta_info *sta_info_get(struct ieee80211_sub_if_data *sdata,
>  	struct sta_info *sta;
>  
>  	sta = rcu_dereference_check(local->sta_hash[STA_HASH(addr)],
> -				    rcu_read_lock_held() ||
>  				    lockdep_is_held(&local->sta_lock) ||
>  				    lockdep_is_held(&local->sta_mtx));
>  	while (sta) {
> @@ -102,7 +101,6 @@ struct sta_info *sta_info_get(struct ieee80211_sub_if_data *sdata,
>  		    memcmp(sta->sta.addr, addr, ETH_ALEN) == 0)
>  			break;
>  		sta = rcu_dereference_check(sta->hnext,
> -					    rcu_read_lock_held() ||
>  					    lockdep_is_held(&local->sta_lock) ||
>  					    lockdep_is_held(&local->sta_mtx));
>  	}
> @@ -120,7 +118,6 @@ struct sta_info *sta_info_get_bss(struct ieee80211_sub_if_data *sdata,
>  	struct sta_info *sta;
>  
>  	sta = rcu_dereference_check(local->sta_hash[STA_HASH(addr)],
> -				    rcu_read_lock_held() ||
>  				    lockdep_is_held(&local->sta_lock) ||
>  				    lockdep_is_held(&local->sta_mtx));
>  	while (sta) {
> @@ -129,7 +126,6 @@ struct sta_info *sta_info_get_bss(struct ieee80211_sub_if_data *sdata,
>  		    memcmp(sta->sta.addr, addr, ETH_ALEN) == 0)
>  			break;
>  		sta = rcu_dereference_check(sta->hnext,
> -					    rcu_read_lock_held() ||
>  					    lockdep_is_held(&local->sta_lock) ||
>  					    lockdep_is_held(&local->sta_mtx));
>  	}
> diff --git a/net/netlabel/netlabel_domainhash.c b/net/netlabel/netlabel_domainhash.c
> index d37b7f8..82795a4 100644
> --- a/net/netlabel/netlabel_domainhash.c
> +++ b/net/netlabel/netlabel_domainhash.c
> @@ -55,8 +55,7 @@ struct netlbl_domhsh_tbl {
>   * should be okay */
>  static DEFINE_SPINLOCK(netlbl_domhsh_lock);
>  #define netlbl_domhsh_rcu_deref(p) \
> -	rcu_dereference_check(p, rcu_read_lock_held() || \
> -				 lockdep_is_held(&netlbl_domhsh_lock))
> +	rcu_dereference_check(p, lockdep_is_held(&netlbl_domhsh_lock))
>  static struct netlbl_domhsh_tbl *netlbl_domhsh = NULL;
>  static struct netlbl_dom_map *netlbl_domhsh_def = NULL;
>  
> diff --git a/net/netlabel/netlabel_unlabeled.c b/net/netlabel/netlabel_unlabeled.c
> index e2b0a68..d2f982f 100644
> --- a/net/netlabel/netlabel_unlabeled.c
> +++ b/net/netlabel/netlabel_unlabeled.c
> @@ -116,8 +116,7 @@ struct netlbl_unlhsh_walk_arg {
>   * hash table should be okay */
>  static DEFINE_SPINLOCK(netlbl_unlhsh_lock);
>  #define netlbl_unlhsh_rcu_deref(p) \
> -	rcu_dereference_check(p, rcu_read_lock_held() || \
> -				 lockdep_is_held(&netlbl_unlhsh_lock))
> +	rcu_dereference_check(p, lockdep_is_held(&netlbl_unlhsh_lock))
>  static struct netlbl_unlhsh_tbl *netlbl_unlhsh = NULL;
>  static struct netlbl_unlhsh_iface *netlbl_unlhsh_def = NULL;
>  

-- 
paul moore
linux @ hp

  parent reply	other threads:[~2010-11-01 21:47 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-11-01 19:15 [PATCH 0/3] rcu - removing superfluous rcu_read_lock_held check Jiri Olsa
2010-11-01 19:15 ` Jiri Olsa
2010-11-01 19:15 ` [PATCH 1/3] cgroup " Jiri Olsa
     [not found]   ` <1288638909-10541-2-git-send-email-jolsa-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2010-11-02 17:54     ` Li Zefan
2010-11-02 17:54   ` Li Zefan
     [not found]     ` <4CD0506F.6080600-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2010-11-03  8:58       ` Jiri Olsa
     [not found]         ` <20101103085804.GB1916-4G3mNVrOt0i3oHxwIazZmlaTQe2KTcn/@public.gmane.org>
2010-11-03 18:40           ` Li Zefan
2010-11-01 19:15 ` [PATCH 2/3] kernel,cred,kvm,security " Jiri Olsa
2010-11-01 22:42   ` Paolo Bonzini
     [not found]     ` <4CCF424F.3050205-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2010-11-02  7:21       ` Jiri Olsa
2010-11-02  7:21         ` Jiri Olsa
     [not found]   ` <1288638909-10541-3-git-send-email-jolsa-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2010-11-01 22:42     ` [PATCH 2/3] kernel, cred, kvm, security " Paolo Bonzini
     [not found] ` <1288638909-10541-1-git-send-email-jolsa-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2010-11-01 19:15   ` [PATCH 1/3] cgroup " Jiri Olsa
2010-11-01 19:15   ` [PATCH 2/3] kernel, cred, kvm, security " Jiri Olsa
2010-11-01 19:15   ` [PATCH 3/3] net " Jiri Olsa
2010-11-01 19:15 ` Jiri Olsa
2010-11-01 20:33   ` David Miller
     [not found]   ` <1288638909-10541-4-git-send-email-jolsa-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2010-11-01 20:33     ` David Miller
2010-11-01 21:47     ` Paul Moore [this message]
2010-11-01 21:47   ` Paul Moore

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='1288648032.5167.0.camel__31286.4342857667$1288648193$gmane$org@sifl' \
    --to=paul.moore-vxdhtt5mjny@public.gmane.org \
    --cc=containers-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org \
    --cc=dhowells-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org \
    --cc=dipankar-xthvdsQ13ZrQT0dZR+AlfA@public.gmane.org \
    --cc=johannes-cdvu00un1VgdHxzADdlk8Q@public.gmane.org \
    --cc=jolsa-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org \
    --cc=kvm-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.