|
Message-Id: <1450364270-12687-7-git-send-email-dave@progbits.org> Date: Thu, 17 Dec 2015 09:57:44 -0500 From: David Windsor <dave@...gbits.org> To: kernel-hardening@...ts.openwall.com Cc: David Windsor <dave@...gbits.org> Subject: [RFC PATCH v2 06/12] net: opt out of PAX_REFCOUNT protection Signed-off-by: David Windsor <dave@...gbits.org> --- include/linux/atmdev.h | 2 +- include/linux/netdevice.h | 6 ++--- include/linux/sonet.h | 2 +- include/linux/sunrpc/svc_rdma.h | 18 +++++++-------- include/net/bonding.h | 2 +- include/net/caif/cfctrl.h | 4 ++-- include/net/flow.h | 2 +- include/net/gro_cells.h | 2 +- include/net/inetpeer.h | 2 +- include/net/ip_fib.h | 2 +- include/net/ip_vs.h | 4 ++-- include/net/iucv/af_iucv.h | 2 +- include/net/net_namespace.h | 12 +++++----- include/net/netns/ipv4.h | 4 ++-- include/net/netns/ipv6.h | 4 ++-- include/net/netns/xfrm.h | 2 +- include/net/sock.h | 6 ++--- include/net/xfrm.h | 2 +- net/atm/atm_misc.c | 8 +++---- net/atm/proc.c | 6 ++--- net/atm/resources.c | 4 ++-- net/batman-adv/bat_iv_ogm.c | 8 +++---- net/batman-adv/fragmentation.c | 2 +- net/batman-adv/soft-interface.c | 6 ++--- net/batman-adv/types.h | 6 ++--- net/caif/cfctrl.c | 10 ++++----- net/ceph/messenger.c | 4 ++-- net/core/datagram.c | 2 +- net/core/dev.c | 12 +++++----- net/core/flow.c | 6 ++--- net/core/net-sysfs.c | 2 +- net/core/netpoll.c | 4 ++-- net/core/rtnetlink.c | 2 +- net/core/sock.c | 12 +++++----- net/core/sock_diag.c | 6 ++--- net/ipv4/devinet.c | 4 ++-- net/ipv4/fib_frontend.c | 6 ++--- net/ipv4/fib_semantics.c | 2 +- net/ipv4/inet_connection_sock.c | 4 ++-- net/ipv4/inet_timewait_sock.c | 2 +- net/ipv4/inetpeer.c | 2 +- net/ipv4/ip_fragment.c | 2 +- net/ipv4/ping.c | 2 +- net/ipv4/raw.c | 4 ++-- net/ipv4/route.c | 10 ++++----- net/ipv4/tcp_input.c | 2 +- net/ipv4/udp.c | 10 ++++----- net/ipv6/addrconf.c | 6 ++--- net/ipv6/af_inet6.c | 2 +- net/ipv6/datagram.c | 2 +- net/ipv6/ip6_fib.c | 4 ++-- net/ipv6/raw.c | 6 ++--- net/ipv6/udp.c | 6 ++--- net/iucv/af_iucv.c | 4 ++-- net/key/af_key.c | 4 ++-- net/l2tp/l2tp_eth.c | 38 ++++++++++++++++---------------- net/netfilter/ipvs/ip_vs_conn.c | 6 ++--- net/netfilter/ipvs/ip_vs_core.c | 4 ++-- net/netfilter/ipvs/ip_vs_ctl.c | 10 ++++----- net/netfilter/ipvs/ip_vs_sync.c | 6 ++--- net/netfilter/ipvs/ip_vs_xmit.c | 4 ++-- net/netfilter/nfnetlink_log.c | 4 ++-- net/netfilter/xt_statistic.c | 8 +++---- net/netlink/af_netlink.c | 4 ++-- net/openvswitch/vport.c | 16 +++++++------- net/openvswitch/vport.h | 8 +++---- net/packet/af_packet.c | 4 ++-- net/phonet/pep.c | 6 ++--- net/phonet/socket.c | 2 +- net/rds/cong.c | 6 ++--- net/rds/ib.h | 2 +- net/rds/ib_cm.c | 2 +- net/rds/ib_recv.c | 4 ++-- net/rds/iw.h | 2 +- net/rds/iw_cm.c | 2 +- net/rds/iw_recv.c | 4 ++-- net/rxrpc/af_rxrpc.c | 2 +- net/rxrpc/ar-ack.c | 14 ++++++------ net/rxrpc/ar-call.c | 2 +- net/rxrpc/ar-connection.c | 2 +- net/rxrpc/ar-connevent.c | 2 +- net/rxrpc/ar-input.c | 4 ++-- net/rxrpc/ar-internal.h | 8 +++---- net/rxrpc/ar-local.c | 2 +- net/rxrpc/ar-output.c | 4 ++-- net/rxrpc/ar-peer.c | 2 +- net/rxrpc/ar-proc.c | 4 ++-- net/rxrpc/ar-transport.c | 2 +- net/rxrpc/rxkad.c | 4 ++-- net/sched/sch_generic.c | 4 ++-- net/sunrpc/auth_gss/svcauth_gss.c | 4 ++-- net/sunrpc/sched.c | 4 ++-- net/sunrpc/xprtrdma/svc_rdma.c | 36 +++++++++++++++--------------- net/sunrpc/xprtrdma/svc_rdma_recvfrom.c | 8 +++---- net/sunrpc/xprtrdma/svc_rdma_sendto.c | 2 +- net/sunrpc/xprtrdma/svc_rdma_transport.c | 10 ++++----- net/xfrm/xfrm_policy.c | 10 ++++----- net/xfrm/xfrm_state.c | 4 ++-- 98 files changed, 269 insertions(+), 269 deletions(-) diff --git a/include/linux/atmdev.h b/include/linux/atmdev.h index c1da539..4db35ec 100644 --- a/include/linux/atmdev.h +++ b/include/linux/atmdev.h @@ -28,7 +28,7 @@ struct compat_atm_iobuf { #endif struct k_atm_aal_stats { -#define __HANDLE_ITEM(i) atomic_t i +#define __HANDLE_ITEM(i) atomic_unchecked_t i __AAL_STAT_ITEMS #undef __HANDLE_ITEM }; diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h index e20979d..d57cabd 100644 --- a/include/linux/netdevice.h +++ b/include/linux/netdevice.h @@ -1519,7 +1519,7 @@ struct net_device { unsigned long base_addr; int irq; - atomic_t carrier_changes; + atomic_unchecked_t carrier_changes; /* * Some hardware also needs these fields (state,dev_list, @@ -1558,8 +1558,8 @@ struct net_device { struct net_device_stats stats; - atomic_long_t rx_dropped; - atomic_long_t tx_dropped; + atomic_long_unchecked_t rx_dropped; + atomic_long_unchecked_t tx_dropped; #ifdef CONFIG_WIRELESS_EXT const struct iw_handler_def * wireless_handlers; diff --git a/include/linux/sonet.h b/include/linux/sonet.h index 680f9a3..f13aeb0 100644 --- a/include/linux/sonet.h +++ b/include/linux/sonet.h @@ -7,7 +7,7 @@ #include <uapi/linux/sonet.h> struct k_sonet_stats { -#define __HANDLE_ITEM(i) atomic_t i +#define __HANDLE_ITEM(i) atomic_unchecked_t i __SONET_ITEMS #undef __HANDLE_ITEM }; diff --git a/include/linux/sunrpc/svc_rdma.h b/include/linux/sunrpc/svc_rdma.h index 4929a8a..b8f29e9 100644 --- a/include/linux/sunrpc/svc_rdma.h +++ b/include/linux/sunrpc/svc_rdma.h @@ -53,15 +53,15 @@ extern unsigned int svcrdma_ord; extern unsigned int svcrdma_max_requests; extern unsigned int svcrdma_max_req_size; -extern atomic_t rdma_stat_recv; -extern atomic_t rdma_stat_read; -extern atomic_t rdma_stat_write; -extern atomic_t rdma_stat_sq_starve; -extern atomic_t rdma_stat_rq_starve; -extern atomic_t rdma_stat_rq_poll; -extern atomic_t rdma_stat_rq_prod; -extern atomic_t rdma_stat_sq_poll; -extern atomic_t rdma_stat_sq_prod; +extern atomic_unchecked_t rdma_stat_recv; +extern atomic_unchecked_t rdma_stat_read; +extern atomic_unchecked_t rdma_stat_write; +extern atomic_unchecked_t rdma_stat_sq_starve; +extern atomic_unchecked_t rdma_stat_rq_starve; +extern atomic_unchecked_t rdma_stat_rq_poll; +extern atomic_unchecked_t rdma_stat_rq_prod; +extern atomic_unchecked_t rdma_stat_sq_poll; +extern atomic_unchecked_t rdma_stat_sq_prod; /* * Contexts are built when an RDMA request is created and are a diff --git a/include/net/bonding.h b/include/net/bonding.h index 20defc0..3072903 100644 --- a/include/net/bonding.h +++ b/include/net/bonding.h @@ -661,7 +661,7 @@ extern struct rtnl_link_ops bond_link_ops; static inline void bond_tx_drop(struct net_device *dev, struct sk_buff *skb) { - atomic_long_inc(&dev->tx_dropped); + atomic_long_inc_unchecked(&dev->tx_dropped); dev_kfree_skb_any(skb); } diff --git a/include/net/caif/cfctrl.h b/include/net/caif/cfctrl.h index f2ae33d..57fcd31 100644 --- a/include/net/caif/cfctrl.h +++ b/include/net/caif/cfctrl.h @@ -101,8 +101,8 @@ struct cfctrl_request_info { struct cfctrl { struct cfsrvl serv; struct cfctrl_rsp res; - atomic_t req_seq_no; - atomic_t rsp_seq_no; + atomic_unchecked_t req_seq_no; + atomic_unchecked_t rsp_seq_no; struct list_head list; /* Protects from simultaneous access to first_req list */ spinlock_t info_list_lock; diff --git a/include/net/flow.h b/include/net/flow.h index 8109a15..504466d 100644 --- a/include/net/flow.h +++ b/include/net/flow.h @@ -231,6 +231,6 @@ void flow_cache_fini(struct net *net); void flow_cache_flush(struct net *net); void flow_cache_flush_deferred(struct net *net); -extern atomic_t flow_cache_genid; +extern atomic_unchecked_t flow_cache_genid; #endif diff --git a/include/net/gro_cells.h b/include/net/gro_cells.h index 0f712c0..cd762c4 100644 --- a/include/net/gro_cells.h +++ b/include/net/gro_cells.h @@ -27,7 +27,7 @@ static inline void gro_cells_receive(struct gro_cells *gcells, struct sk_buff *s cell = this_cpu_ptr(gcells->cells); if (skb_queue_len(&cell->napi_skbs) > netdev_max_backlog) { - atomic_long_inc(&dev->rx_dropped); + atomic_long_inc_unchecked(&dev->rx_dropped); kfree_skb(skb); return; } diff --git a/include/net/inetpeer.h b/include/net/inetpeer.h index d5332dd..10a5c3c 100644 --- a/include/net/inetpeer.h +++ b/include/net/inetpeer.h @@ -48,7 +48,7 @@ struct inet_peer { */ union { struct { - atomic_t rid; /* Frag reception counter */ + atomic_unchecked_t rid; /* Frag reception counter */ }; struct rcu_head rcu; struct inet_peer *gc_next; diff --git a/include/net/ip_fib.h b/include/net/ip_fib.h index 5fa643b..d871e20 100644 --- a/include/net/ip_fib.h +++ b/include/net/ip_fib.h @@ -170,7 +170,7 @@ __be32 fib_info_update_nh_saddr(struct net *net, struct fib_nh *nh); #define FIB_RES_SADDR(net, res) \ ((FIB_RES_NH(res).nh_saddr_genid == \ - atomic_read(&(net)->ipv4.dev_addr_genid)) ? \ + atomic_read_unchecked(&(net)->ipv4.dev_addr_genid)) ? \ FIB_RES_NH(res).nh_saddr : \ fib_info_update_nh_saddr((net), &FIB_RES_NH(res))) #define FIB_RES_GW(res) (FIB_RES_NH(res).nh_gw) diff --git a/include/net/ip_vs.h b/include/net/ip_vs.h index 4e3731e..9a0a688 100644 --- a/include/net/ip_vs.h +++ b/include/net/ip_vs.h @@ -551,7 +551,7 @@ struct ip_vs_conn { struct ip_vs_conn *control; /* Master control connection */ atomic_t n_control; /* Number of controlled ones */ struct ip_vs_dest *dest; /* real server */ - atomic_t in_pkts; /* incoming packet counter */ + atomic_unchecked_t in_pkts; /* incoming packet counter */ /* Packet transmitter for different forwarding methods. If it * mangles the packet, it must return NF_DROP or better NF_STOLEN, @@ -699,7 +699,7 @@ struct ip_vs_dest { __be16 port; /* port number of the server */ union nf_inet_addr addr; /* IP address of the server */ volatile unsigned int flags; /* dest status flags */ - atomic_t conn_flags; /* flags to copy to conn */ + atomic_unchecked_t conn_flags; /* flags to copy to conn */ atomic_t weight; /* server weight */ atomic_t refcnt; /* reference counter */ diff --git a/include/net/iucv/af_iucv.h b/include/net/iucv/af_iucv.h index 714cc9a..ea05f3e 100644 --- a/include/net/iucv/af_iucv.h +++ b/include/net/iucv/af_iucv.h @@ -149,7 +149,7 @@ struct iucv_skb_cb { struct iucv_sock_list { struct hlist_head head; rwlock_t lock; - atomic_t autobind_name; + atomic_unchecked_t autobind_name; }; unsigned int iucv_sock_poll(struct file *file, struct socket *sock, diff --git a/include/net/net_namespace.h b/include/net/net_namespace.h index e951453..8a28d2c 100644 --- a/include/net/net_namespace.h +++ b/include/net/net_namespace.h @@ -53,7 +53,7 @@ struct net { */ spinlock_t rules_mod_lock; - atomic64_t cookie_gen; + atomic64_unchecked_t cookie_gen; struct list_head list; /* list of network namespaces */ struct list_head cleanup_list; /* namespaces on death row */ @@ -135,7 +135,7 @@ struct net { struct netns_mpls mpls; #endif struct sock *diag_nlsk; - atomic_t fnhe_genid; + atomic_unchecked_t fnhe_genid; }; #include <linux/seq_file_net.h> @@ -334,12 +334,12 @@ static inline void unregister_net_sysctl_table(struct ctl_table_header *header) static inline int rt_genid_ipv4(struct net *net) { - return atomic_read(&net->ipv4.rt_genid); + return atomic_read_unchecked(&net->ipv4.rt_genid); } static inline void rt_genid_bump_ipv4(struct net *net) { - atomic_inc(&net->ipv4.rt_genid); + atomic_inc_unchecked(&net->ipv4.rt_genid); } extern void (*__fib6_flush_trees)(struct net *net); @@ -366,12 +366,12 @@ static inline void rt_genid_bump_all(struct net *net) static inline int fnhe_genid(struct net *net) { - return atomic_read(&net->fnhe_genid); + return atomic_read_unchecked(&net->fnhe_genid); } static inline void fnhe_genid_bump(struct net *net) { - atomic_inc(&net->fnhe_genid); + atomic_inc_unchecked(&net->fnhe_genid); } #endif /* __NET_NET_NAMESPACE_H */ diff --git a/include/net/netns/ipv4.h b/include/net/netns/ipv4.h index c68926b..106c147 100644 --- a/include/net/netns/ipv4.h +++ b/include/net/netns/ipv4.h @@ -93,7 +93,7 @@ struct netns_ipv4 { struct ping_group_range ping_group_range; - atomic_t dev_addr_genid; + atomic_unchecked_t dev_addr_genid; #ifdef CONFIG_SYSCTL unsigned long *sysctl_local_reserved_ports; @@ -107,6 +107,6 @@ struct netns_ipv4 { struct fib_rules_ops *mr_rules_ops; #endif #endif - atomic_t rt_genid; + atomic_unchecked_t rt_genid; }; #endif diff --git a/include/net/netns/ipv6.h b/include/net/netns/ipv6.h index 8d93544..05c3e89 100644 --- a/include/net/netns/ipv6.h +++ b/include/net/netns/ipv6.h @@ -79,8 +79,8 @@ struct netns_ipv6 { struct fib_rules_ops *mr6_rules_ops; #endif #endif - atomic_t dev_addr_genid; - atomic_t fib6_sernum; + atomic_unchecked_t dev_addr_genid; + atomic_unchecked_t fib6_sernum; }; #if IS_ENABLED(CONFIG_NF_DEFRAG_IPV6) diff --git a/include/net/netns/xfrm.h b/include/net/netns/xfrm.h index 730d82a..045f2c4 100644 --- a/include/net/netns/xfrm.h +++ b/include/net/netns/xfrm.h @@ -78,7 +78,7 @@ struct netns_xfrm { /* flow cache part */ struct flow_cache flow_cache_global; - atomic_t flow_cache_genid; + atomic_unchecked_t flow_cache_genid; struct list_head flow_cache_gc_list; spinlock_t flow_cache_gc_lock; struct work_struct flow_cache_gc_work; diff --git a/include/net/sock.h b/include/net/sock.h index 4ca4c3f..010c67c 100644 --- a/include/net/sock.h +++ b/include/net/sock.h @@ -198,7 +198,7 @@ struct sock_common { struct in6_addr skc_v6_rcv_saddr; #endif - atomic64_t skc_cookie; + atomic64_unchecked_t skc_cookie; /* * fields between dontcopy_begin/dontcopy_end @@ -364,7 +364,7 @@ struct sock { unsigned int sk_napi_id; unsigned int sk_ll_usec; #endif - atomic_t sk_drops; + atomic_unchecked_t sk_drops; int sk_rcvbuf; struct sk_filter __rcu *sk_filter; @@ -2107,7 +2107,7 @@ struct sock_skb_cb { static inline void sock_skb_set_dropcount(const struct sock *sk, struct sk_buff *skb) { - SOCK_SKB_CB(skb)->dropcount = atomic_read(&sk->sk_drops); + SOCK_SKB_CB(skb)->dropcount = atomic_read_unchecked(&sk->sk_drops); } void __sock_recv_timestamp(struct msghdr *msg, struct sock *sk, diff --git a/include/net/xfrm.h b/include/net/xfrm.h index f0ee97e..c82ef16 100644 --- a/include/net/xfrm.h +++ b/include/net/xfrm.h @@ -531,7 +531,7 @@ struct xfrm_policy { struct timer_list timer; struct flow_cache_object flo; - atomic_t genid; + atomic_unchecked_t genid; u32 priority; u32 index; struct xfrm_mark mark; diff --git a/net/atm/atm_misc.c b/net/atm/atm_misc.c index 876fbe8..8bbea9f 100644 --- a/net/atm/atm_misc.c +++ b/net/atm/atm_misc.c @@ -17,7 +17,7 @@ int atm_charge(struct atm_vcc *vcc, int truesize) if (atomic_read(&sk_atm(vcc)->sk_rmem_alloc) <= sk_atm(vcc)->sk_rcvbuf) return 1; atm_return(vcc, truesize); - atomic_inc(&vcc->stats->rx_drop); + atomic_inc_unchecked(&vcc->stats->rx_drop); return 0; } EXPORT_SYMBOL(atm_charge); @@ -39,7 +39,7 @@ struct sk_buff *atm_alloc_charge(struct atm_vcc *vcc, int pdu_size, } } atm_return(vcc, guess); - atomic_inc(&vcc->stats->rx_drop); + atomic_inc_unchecked(&vcc->stats->rx_drop); return NULL; } EXPORT_SYMBOL(atm_alloc_charge); @@ -86,7 +86,7 @@ EXPORT_SYMBOL(atm_pcr_goal); void sonet_copy_stats(struct k_sonet_stats *from, struct sonet_stats *to) { -#define __HANDLE_ITEM(i) to->i = atomic_read(&from->i) +#define __HANDLE_ITEM(i) to->i = atomic_read_unchecked(&from->i) __SONET_ITEMS #undef __HANDLE_ITEM } @@ -94,7 +94,7 @@ EXPORT_SYMBOL(sonet_copy_stats); void sonet_subtract_stats(struct k_sonet_stats *from, struct sonet_stats *to) { -#define __HANDLE_ITEM(i) atomic_sub(to->i, &from->i) +#define __HANDLE_ITEM(i) atomic_sub_unchecked(to->i,&from->i) __SONET_ITEMS #undef __HANDLE_ITEM } diff --git a/net/atm/proc.c b/net/atm/proc.c index bbb6461..cf04016 100644 --- a/net/atm/proc.c +++ b/net/atm/proc.c @@ -45,9 +45,9 @@ static void add_stats(struct seq_file *seq, const char *aal, const struct k_atm_aal_stats *stats) { seq_printf(seq, "%s ( %d %d %d %d %d )", aal, - atomic_read(&stats->tx), atomic_read(&stats->tx_err), - atomic_read(&stats->rx), atomic_read(&stats->rx_err), - atomic_read(&stats->rx_drop)); + atomic_read_unchecked(&stats->tx),atomic_read_unchecked(&stats->tx_err), + atomic_read_unchecked(&stats->rx),atomic_read_unchecked(&stats->rx_err), + atomic_read_unchecked(&stats->rx_drop)); } static void atm_dev_info(struct seq_file *seq, const struct atm_dev *dev) diff --git a/net/atm/resources.c b/net/atm/resources.c index 0447d5d..3cf4728 100644 --- a/net/atm/resources.c +++ b/net/atm/resources.c @@ -160,7 +160,7 @@ EXPORT_SYMBOL(atm_dev_deregister); static void copy_aal_stats(struct k_atm_aal_stats *from, struct atm_aal_stats *to) { -#define __HANDLE_ITEM(i) to->i = atomic_read(&from->i) +#define __HANDLE_ITEM(i) to->i = atomic_read_unchecked(&from->i) __AAL_STAT_ITEMS #undef __HANDLE_ITEM } @@ -168,7 +168,7 @@ static void copy_aal_stats(struct k_atm_aal_stats *from, static void subtract_aal_stats(struct k_atm_aal_stats *from, struct atm_aal_stats *to) { -#define __HANDLE_ITEM(i) atomic_sub(to->i, &from->i) +#define __HANDLE_ITEM(i) atomic_sub_unchecked(to->i, &from->i) __AAL_STAT_ITEMS #undef __HANDLE_ITEM } diff --git a/net/batman-adv/bat_iv_ogm.c b/net/batman-adv/bat_iv_ogm.c index 753383c..32d12d9 100644 --- a/net/batman-adv/bat_iv_ogm.c +++ b/net/batman-adv/bat_iv_ogm.c @@ -343,7 +343,7 @@ static int batadv_iv_ogm_iface_enable(struct batadv_hard_iface *hard_iface) /* randomize initial seqno to avoid collision */ get_random_bytes(&random_seqno, sizeof(random_seqno)); - atomic_set(&hard_iface->bat_iv.ogm_seqno, random_seqno); + atomic_set_unchecked(&hard_iface->bat_iv.ogm_seqno, random_seqno); hard_iface->bat_iv.ogm_buff_len = BATADV_OGM_HLEN; ogm_buff = kmalloc(hard_iface->bat_iv.ogm_buff_len, GFP_ATOMIC); @@ -947,9 +947,9 @@ static void batadv_iv_ogm_schedule(struct batadv_hard_iface *hard_iface) batadv_ogm_packet->tvlv_len = htons(tvlv_len); /* change sequence number to network order */ - seqno = (uint32_t)atomic_read(&hard_iface->bat_iv.ogm_seqno); + seqno = (uint32_t)atomic_read_unchecked(&hard_iface->bat_iv.ogm_seqno); batadv_ogm_packet->seqno = htonl(seqno); - atomic_inc(&hard_iface->bat_iv.ogm_seqno); + atomic_inc_unchecked(&hard_iface->bat_iv.ogm_seqno); batadv_iv_ogm_slide_own_bcast_window(hard_iface); @@ -1626,7 +1626,7 @@ static void batadv_iv_ogm_process(const struct sk_buff *skb, int ogm_offset, return; /* could be changed by schedule_own_packet() */ - if_incoming_seqno = atomic_read(&if_incoming->bat_iv.ogm_seqno); + if_incoming_seqno = atomic_read_unchecked(&if_incoming->bat_iv.ogm_seqno); if (ogm_packet->flags & BATADV_DIRECTLINK) has_directlink_flag = true; diff --git a/net/batman-adv/fragmentation.c b/net/batman-adv/fragmentation.c index c0f0d01..725928a 100644 --- a/net/batman-adv/fragmentation.c +++ b/net/batman-adv/fragmentation.c @@ -465,7 +465,7 @@ bool batadv_frag_send_packet(struct sk_buff *skb, frag_header.packet_type = BATADV_UNICAST_FRAG; frag_header.version = BATADV_COMPAT_VERSION; frag_header.ttl = BATADV_TTL; - frag_header.seqno = htons(atomic_inc_return(&bat_priv->frag_seqno)); + frag_header.seqno = htons(atomic_inc_return_unchecked(&bat_priv->frag_seqno)); frag_header.reserved = 0; frag_header.no = 0; frag_header.total_size = htons(skb->len); diff --git a/net/batman-adv/soft-interface.c b/net/batman-adv/soft-interface.c index 51cda3a..f5cbc7e 100644 --- a/net/batman-adv/soft-interface.c +++ b/net/batman-adv/soft-interface.c @@ -330,7 +330,7 @@ send: primary_if->net_dev->dev_addr); /* set broadcast sequence number */ - seqno = atomic_inc_return(&bat_priv->bcast_seqno); + seqno = atomic_inc_return_unchecked(&bat_priv->bcast_seqno); bcast_packet->seqno = htonl(seqno); batadv_add_bcast_packet_to_list(bat_priv, skb, brd_delay); @@ -798,7 +798,7 @@ static int batadv_softif_init_late(struct net_device *dev) atomic_set(&bat_priv->batman_queue_left, BATADV_BATMAN_QUEUE_LEN); atomic_set(&bat_priv->mesh_state, BATADV_MESH_INACTIVE); - atomic_set(&bat_priv->bcast_seqno, 1); + atomic_set_unchecked(&bat_priv->bcast_seqno, 1); atomic_set(&bat_priv->tt.vn, 0); atomic_set(&bat_priv->tt.local_changes, 0); atomic_set(&bat_priv->tt.ogm_append_cnt, 0); @@ -812,7 +812,7 @@ static int batadv_softif_init_late(struct net_device *dev) /* randomize initial seqno to avoid collision */ get_random_bytes(&random_seqno, sizeof(random_seqno)); - atomic_set(&bat_priv->frag_seqno, random_seqno); + atomic_set_unchecked(&bat_priv->frag_seqno, random_seqno); bat_priv->primary_if = NULL; bat_priv->num_ifaces = 0; diff --git a/net/batman-adv/types.h b/net/batman-adv/types.h index 55610a8..aba2ae8 100644 --- a/net/batman-adv/types.h +++ b/net/batman-adv/types.h @@ -81,7 +81,7 @@ enum batadv_dhcp_recipient { struct batadv_hard_iface_bat_iv { unsigned char *ogm_buff; int ogm_buff_len; - atomic_t ogm_seqno; + atomic_unchecked_t ogm_seqno; }; /** @@ -786,7 +786,7 @@ struct batadv_priv { atomic_t bonding; atomic_t fragmentation; atomic_t packet_size_max; - atomic_t frag_seqno; + atomic_unchecked_t frag_seqno; #ifdef CONFIG_BATMAN_ADV_BLA atomic_t bridge_loop_avoidance; #endif @@ -805,7 +805,7 @@ struct batadv_priv { #endif uint32_t isolation_mark; uint32_t isolation_mark_mask; - atomic_t bcast_seqno; + atomic_unchecked_t bcast_seqno; atomic_t bcast_queue_left; atomic_t batman_queue_left; char num_ifaces; diff --git a/net/caif/cfctrl.c b/net/caif/cfctrl.c index f5afda1..74e77ce 100644 --- a/net/caif/cfctrl.c +++ b/net/caif/cfctrl.c @@ -43,8 +43,8 @@ struct cflayer *cfctrl_create(void) memset(&dev_info, 0, sizeof(dev_info)); dev_info.id = 0xff; cfsrvl_init(&this->serv, 0, &dev_info, false); - atomic_set(&this->req_seq_no, 1); - atomic_set(&this->rsp_seq_no, 1); + atomic_set_unchecked(&this->req_seq_no, 1); + atomic_set_unchecked(&this->rsp_seq_no, 1); this->serv.layer.receive = cfctrl_recv; sprintf(this->serv.layer.name, "ctrl"); this->serv.layer.ctrlcmd = cfctrl_ctrlcmd; @@ -130,8 +130,8 @@ static void cfctrl_insert_req(struct cfctrl *ctrl, struct cfctrl_request_info *req) { spin_lock_bh(&ctrl->info_list_lock); - atomic_inc(&ctrl->req_seq_no); - req->sequence_no = atomic_read(&ctrl->req_seq_no); + atomic_inc_unchecked(&ctrl->req_seq_no); + req->sequence_no = atomic_read_unchecked(&ctrl->req_seq_no); list_add_tail(&req->list, &ctrl->list); spin_unlock_bh(&ctrl->info_list_lock); } @@ -149,7 +149,7 @@ static struct cfctrl_request_info *cfctrl_remove_req(struct cfctrl *ctrl, if (p != first) pr_warn("Requests are not received in order\n"); - atomic_set(&ctrl->rsp_seq_no, + atomic_set_unchecked(&ctrl->rsp_seq_no, p->sequence_no); list_del(&p->list); goto out; diff --git a/net/ceph/messenger.c b/net/ceph/messenger.c index e3be1d2..254c555 100644 --- a/net/ceph/messenger.c +++ b/net/ceph/messenger.c @@ -189,7 +189,7 @@ static void con_fault(struct ceph_connection *con); #define MAX_ADDR_STR_LEN 64 /* 54 is enough */ static char addr_str[ADDR_STR_COUNT][MAX_ADDR_STR_LEN]; -static atomic_t addr_str_seq = ATOMIC_INIT(0); +static atomic_unchecked_t addr_str_seq = ATOMIC_INIT(0); static struct page *zero_page; /* used in certain error cases */ @@ -200,7 +200,7 @@ const char *ceph_pr_addr(const struct sockaddr_storage *ss) struct sockaddr_in *in4 = (struct sockaddr_in *) ss; struct sockaddr_in6 *in6 = (struct sockaddr_in6 *) ss; - i = atomic_inc_return(&addr_str_seq) & ADDR_STR_COUNT_MASK; + i = atomic_inc_return_unchecked(&addr_str_seq) & ADDR_STR_COUNT_MASK; s = addr_str[i]; switch (ss->ss_family) { diff --git a/net/core/datagram.c b/net/core/datagram.c index 617088a..0364f4f 100644 --- a/net/core/datagram.c +++ b/net/core/datagram.c @@ -338,7 +338,7 @@ int skb_kill_datagram(struct sock *sk, struct sk_buff *skb, unsigned int flags) } kfree_skb(skb); - atomic_inc(&sk->sk_drops); + atomic_inc_unchecked(&sk->sk_drops); sk_mem_reclaim_partial(sk); return err; diff --git a/net/core/dev.c b/net/core/dev.c index a8e4dd4..8419b44 100644 --- a/net/core/dev.c +++ b/net/core/dev.c @@ -1721,7 +1721,7 @@ int __dev_forward_skb(struct net_device *dev, struct sk_buff *skb) { if (skb_orphan_frags(skb, GFP_ATOMIC) || unlikely(!is_skb_forwardable(dev, skb))) { - atomic_long_inc(&dev->rx_dropped); + atomic_long_inc_unchecked(&dev->rx_dropped); kfree_skb(skb); return NET_RX_DROP; } @@ -3125,7 +3125,7 @@ recursion_alert: drop: rcu_read_unlock_bh(); - atomic_long_inc(&dev->tx_dropped); + atomic_long_inc_unchecked(&dev->tx_dropped); kfree_skb_list(skb); return rc; out: @@ -3477,7 +3477,7 @@ drop: local_irq_restore(flags); - atomic_long_inc(&skb->dev->rx_dropped); + atomic_long_inc_unchecked(&skb->dev->rx_dropped); kfree_skb(skb); return NET_RX_DROP; } @@ -3892,7 +3892,7 @@ ncls: ret = pt_prev->func(skb, skb->dev, pt_prev, orig_dev); } else { drop: - atomic_long_inc(&skb->dev->rx_dropped); + atomic_long_inc_unchecked(&skb->dev->rx_dropped); kfree_skb(skb); /* Jamal, now you will not able to escape explaining * me how you were going to use this. :-) @@ -6843,8 +6843,8 @@ struct rtnl_link_stats64 *dev_get_stats(struct net_device *dev, } else { netdev_stats_to_stats64(storage, &dev->stats); } - storage->rx_dropped += atomic_long_read(&dev->rx_dropped); - storage->tx_dropped += atomic_long_read(&dev->tx_dropped); + storage->rx_dropped += atomic_long_read_unchecked(&dev->rx_dropped); + storage->tx_dropped += atomic_long_read_unchecked(&dev->tx_dropped); return storage; } EXPORT_SYMBOL(dev_get_stats); diff --git a/net/core/flow.c b/net/core/flow.c index 1033725..340f65d 100644 --- a/net/core/flow.c +++ b/net/core/flow.c @@ -65,7 +65,7 @@ static void flow_cache_new_hashrnd(unsigned long arg) static int flow_entry_valid(struct flow_cache_entry *fle, struct netns_xfrm *xfrm) { - if (atomic_read(&xfrm->flow_cache_genid) != fle->genid) + if (atomic_read_unchecked(&xfrm->flow_cache_genid) != fle->genid) return 0; if (fle->object && !fle->object->ops->check(fle->object)) return 0; @@ -242,7 +242,7 @@ flow_cache_lookup(struct net *net, const struct flowi *key, u16 family, u8 dir, hlist_add_head(&fle->u.hlist, &fcp->hash_table[hash]); fcp->hash_count++; } - } else if (likely(fle->genid == atomic_read(&net->xfrm.flow_cache_genid))) { + } else if (likely(fle->genid == atomic_read_unchecked(&net->xfrm.flow_cache_genid))) { flo = fle->object; if (!flo) goto ret_object; @@ -263,7 +263,7 @@ nocache: } flo = resolver(net, key, family, dir, flo, ctx); if (fle) { - fle->genid = atomic_read(&net->xfrm.flow_cache_genid); + fle->genid = atomic_read_unchecked(&net->xfrm.flow_cache_genid); if (!IS_ERR(flo)) fle->object = flo; else diff --git a/net/core/net-sysfs.c b/net/core/net-sysfs.c index 18b34d7..faecc1d 100644 --- a/net/core/net-sysfs.c +++ b/net/core/net-sysfs.c @@ -288,7 +288,7 @@ static ssize_t carrier_changes_show(struct device *dev, { struct net_device *netdev = to_net_dev(dev); return sprintf(buf, fmt_dec, - atomic_read(&netdev->carrier_changes)); + atomic_read_unchecked(&netdev->carrier_changes)); } static DEVICE_ATTR_RO(carrier_changes); diff --git a/net/core/netpoll.c b/net/core/netpoll.c index c126a87..10ad89d 100644 --- a/net/core/netpoll.c +++ b/net/core/netpoll.c @@ -377,7 +377,7 @@ void netpoll_send_udp(struct netpoll *np, const char *msg, int len) struct udphdr *udph; struct iphdr *iph; struct ethhdr *eth; - static atomic_t ip_ident; + static atomic_unchecked_t ip_ident; struct ipv6hdr *ip6h; udp_len = len + sizeof(*udph); @@ -448,7 +448,7 @@ void netpoll_send_udp(struct netpoll *np, const char *msg, int len) put_unaligned(0x45, (unsigned char *)iph); iph->tos = 0; put_unaligned(htons(ip_len), &(iph->tot_len)); - iph->id = htons(atomic_inc_return(&ip_ident)); + iph->id = htons(atomic_inc_return_unchecked(&ip_ident)); iph->frag_off = 0; iph->ttl = 64; iph->protocol = IPPROTO_UDP; diff --git a/net/core/rtnetlink.c b/net/core/rtnetlink.c index 0861018..4a60a1e 100644 --- a/net/core/rtnetlink.c +++ b/net/core/rtnetlink.c @@ -1082,7 +1082,7 @@ static int rtnl_fill_ifinfo(struct sk_buff *skb, struct net_device *dev, (dev->ifalias && nla_put_string(skb, IFLA_IFALIAS, dev->ifalias)) || nla_put_u32(skb, IFLA_CARRIER_CHANGES, - atomic_read(&dev->carrier_changes))) + atomic_read_unchecked(&dev->carrier_changes))) goto nla_put_failure; if (1) { diff --git a/net/core/sock.c b/net/core/sock.c index 193901d..a5b2488 100644 --- a/net/core/sock.c +++ b/net/core/sock.c @@ -441,7 +441,7 @@ int sock_queue_rcv_skb(struct sock *sk, struct sk_buff *skb) struct sk_buff_head *list = &sk->sk_receive_queue; if (atomic_read(&sk->sk_rmem_alloc) >= sk->sk_rcvbuf) { - atomic_inc(&sk->sk_drops); + atomic_inc_unchecked(&sk->sk_drops); trace_sock_rcvqueue_full(sk, skb); return -ENOMEM; } @@ -451,7 +451,7 @@ int sock_queue_rcv_skb(struct sock *sk, struct sk_buff *skb) return err; if (!sk_rmem_schedule(sk, skb, skb->truesize)) { - atomic_inc(&sk->sk_drops); + atomic_inc_unchecked(&sk->sk_drops); return -ENOBUFS; } @@ -484,7 +484,7 @@ int sk_receive_skb(struct sock *sk, struct sk_buff *skb, const int nested) skb->dev = NULL; if (sk_rcvqueues_full(sk, sk->sk_rcvbuf)) { - atomic_inc(&sk->sk_drops); + atomic_inc_unchecked(&sk->sk_drops); goto discard_and_relse; } if (nested) @@ -502,7 +502,7 @@ int sk_receive_skb(struct sock *sk, struct sk_buff *skb, const int nested) mutex_release(&sk->sk_lock.dep_map, 1, _RET_IP_); } else if (sk_add_backlog(sk, skb, sk->sk_rcvbuf)) { bh_unlock_sock(sk); - atomic_inc(&sk->sk_drops); + atomic_inc_unchecked(&sk->sk_drops); goto discard_and_relse; } @@ -1550,7 +1550,7 @@ struct sock *sk_clone_lock(const struct sock *sk, const gfp_t priority) newsk->sk_err = 0; newsk->sk_priority = 0; newsk->sk_incoming_cpu = raw_smp_processor_id(); - atomic64_set(&newsk->sk_cookie, 0); + atomic64_set_unchecked(&newsk->sk_cookie, 0); /* * Before updating sk_refcnt, we must commit prior changes to memory * (Documentation/RCU/rculist_nulls.txt for details) @@ -2359,7 +2359,7 @@ void sock_init_data(struct socket *sock, struct sock *sk) */ smp_wmb(); atomic_set(&sk->sk_refcnt, 1); - atomic_set(&sk->sk_drops, 0); + atomic_set_unchecked(&sk->sk_drops, 0); } EXPORT_SYMBOL(sock_init_data); diff --git a/net/core/sock_diag.c b/net/core/sock_diag.c index 817622f..8846e2b 100644 --- a/net/core/sock_diag.c +++ b/net/core/sock_diag.c @@ -20,12 +20,12 @@ static struct workqueue_struct *broadcast_wq; static u64 sock_gen_cookie(struct sock *sk) { while (1) { - u64 res = atomic64_read(&sk->sk_cookie); + u64 res = atomic64_read_unchecked(&sk->sk_cookie); if (res) return res; - res = atomic64_inc_return(&sock_net(sk)->cookie_gen); - atomic64_cmpxchg(&sk->sk_cookie, 0, res); + res = atomic64_inc_return_unchecked(&sock_net(sk)->cookie_gen); + atomic64_cmpxchg_unchecked(&sk->sk_cookie, 0, res); } } diff --git a/net/ipv4/devinet.c b/net/ipv4/devinet.c index 2d9cb17..fa6f6f8 100644 --- a/net/ipv4/devinet.c +++ b/net/ipv4/devinet.c @@ -1579,7 +1579,7 @@ static int inet_dump_ifaddr(struct sk_buff *skb, struct netlink_callback *cb) idx = 0; head = &net->dev_index_head[h]; rcu_read_lock(); - cb->seq = atomic_read(&net->ipv4.dev_addr_genid) ^ + cb->seq = atomic_read_unchecked(&net->ipv4.dev_addr_genid) ^ net->dev_base_seq; hlist_for_each_entry_rcu(dev, head, index_hlist) { if (idx < s_idx) @@ -1905,7 +1905,7 @@ static int inet_netconf_dump_devconf(struct sk_buff *skb, idx = 0; head = &net->dev_index_head[h]; rcu_read_lock(); - cb->seq = atomic_read(&net->ipv4.dev_addr_genid) ^ + cb->seq = atomic_read_unchecked(&net->ipv4.dev_addr_genid) ^ net->dev_base_seq; hlist_for_each_entry_rcu(dev, head, index_hlist) { if (idx < s_idx) diff --git a/net/ipv4/fib_frontend.c b/net/ipv4/fib_frontend.c index 6bbc549..28d7495 100644 --- a/net/ipv4/fib_frontend.c +++ b/net/ipv4/fib_frontend.c @@ -1083,12 +1083,12 @@ static int fib_inetaddr_event(struct notifier_block *this, unsigned long event, #ifdef CONFIG_IP_ROUTE_MULTIPATH fib_sync_up(dev, RTNH_F_DEAD); #endif - atomic_inc(&net->ipv4.dev_addr_genid); + atomic_inc_unchecked(&net->ipv4.dev_addr_genid); rt_cache_flush(dev_net(dev)); break; case NETDEV_DOWN: fib_del_ifaddr(ifa, NULL); - atomic_inc(&net->ipv4.dev_addr_genid); + atomic_inc_unchecked(&net->ipv4.dev_addr_genid); if (!ifa->ifa_dev->ifa_list) { /* Last address was deleted from this interface. * Disable IP. @@ -1127,7 +1127,7 @@ static int fib_netdev_event(struct notifier_block *this, unsigned long event, vo #ifdef CONFIG_IP_ROUTE_MULTIPATH fib_sync_up(dev, RTNH_F_DEAD); #endif - atomic_inc(&net->ipv4.dev_addr_genid); + atomic_inc_unchecked(&net->ipv4.dev_addr_genid); rt_cache_flush(net); break; case NETDEV_DOWN: diff --git a/net/ipv4/fib_semantics.c b/net/ipv4/fib_semantics.c index 3a06586..1020c5b 100644 --- a/net/ipv4/fib_semantics.c +++ b/net/ipv4/fib_semantics.c @@ -755,7 +755,7 @@ __be32 fib_info_update_nh_saddr(struct net *net, struct fib_nh *nh) nh->nh_saddr = inet_select_addr(nh->nh_dev, nh->nh_gw, nh->nh_parent->fib_scope); - nh->nh_saddr_genid = atomic_read(&net->ipv4.dev_addr_genid); + nh->nh_saddr_genid = atomic_read_unchecked(&net->ipv4.dev_addr_genid); return nh->nh_saddr; } diff --git a/net/ipv4/inet_connection_sock.c b/net/ipv4/inet_connection_sock.c index 61b45a1..2970363 100644 --- a/net/ipv4/inet_connection_sock.c +++ b/net/ipv4/inet_connection_sock.c @@ -729,8 +729,8 @@ struct sock *inet_csk_clone_lock(const struct sock *sk, newsk->sk_write_space = sk_stream_write_space; newsk->sk_mark = inet_rsk(req)->ir_mark; - atomic64_set(&newsk->sk_cookie, - atomic64_read(&inet_rsk(req)->ir_cookie)); + atomic64_set_unchecked(&newsk->sk_cookie, + atomic64_read_unchecked(&inet_rsk(req)->ir_cookie)); newicsk->icsk_retransmits = 0; newicsk->icsk_backoff = 0; diff --git a/net/ipv4/inet_timewait_sock.c b/net/ipv4/inet_timewait_sock.c index 2ffbd16..6e94995 100644 --- a/net/ipv4/inet_timewait_sock.c +++ b/net/ipv4/inet_timewait_sock.c @@ -214,7 +214,7 @@ struct inet_timewait_sock *inet_twsk_alloc(const struct sock *sk, tw->tw_ipv6only = 0; tw->tw_transparent = inet->transparent; tw->tw_prot = sk->sk_prot_creator; - atomic64_set(&tw->tw_cookie, atomic64_read(&sk->sk_cookie)); + atomic64_set_unchecked(&tw->tw_cookie, atomic64_read_unchecked(&sk->sk_cookie)); twsk_net_set(tw, sock_net(sk)); setup_timer(&tw->tw_timer, tw_timer_handler, (unsigned long)tw); /* diff --git a/net/ipv4/inetpeer.c b/net/ipv4/inetpeer.c index 241afd7..31b95d5 100644 --- a/net/ipv4/inetpeer.c +++ b/net/ipv4/inetpeer.c @@ -461,7 +461,7 @@ relookup: if (p) { p->daddr = *daddr; atomic_set(&p->refcnt, 1); - atomic_set(&p->rid, 0); + atomic_set_unchecked(&p->rid, 0); p->metrics[RTAX_LOCK-1] = INETPEER_METRICS_NEW; p->rate_tokens = 0; /* 60*HZ is arbitrary, but chosen enough high so that the first diff --git a/net/ipv4/ip_fragment.c b/net/ipv4/ip_fragment.c index 921138f..327173b 100644 --- a/net/ipv4/ip_fragment.c +++ b/net/ipv4/ip_fragment.c @@ -276,7 +276,7 @@ static int ip_frag_too_far(struct ipq *qp) return 0; start = qp->rid; - end = atomic_inc_return(&peer->rid); + end = atomic_inc_return_unchecked(&peer->rid); qp->rid = end; rc = qp->q.fragments && (end - start) > max; diff --git a/net/ipv4/ping.c b/net/ipv4/ping.c index 05ff44b..8e685ea 100644 --- a/net/ipv4/ping.c +++ b/net/ipv4/ping.c @@ -1116,7 +1116,7 @@ static void ping_v4_format_sock(struct sock *sp, struct seq_file *f, from_kuid_munged(seq_user_ns(f), sock_i_uid(sp)), 0, sock_i_ino(sp), atomic_read(&sp->sk_refcnt), sp, - atomic_read(&sp->sk_drops)); + atomic_read_unchecked(&sp->sk_drops)); } static int ping_v4_seq_show(struct seq_file *seq, void *v) diff --git a/net/ipv4/raw.c b/net/ipv4/raw.c index 561cd4b..7e7104d 100644 --- a/net/ipv4/raw.c +++ b/net/ipv4/raw.c @@ -323,7 +323,7 @@ static int raw_rcv_skb(struct sock *sk, struct sk_buff *skb) int raw_rcv(struct sock *sk, struct sk_buff *skb) { if (!xfrm4_policy_check(sk, XFRM_POLICY_IN, skb)) { - atomic_inc(&sk->sk_drops); + atomic_inc_unchecked(&sk->sk_drops); kfree_skb(skb); return NET_RX_DROP; } @@ -1020,7 +1020,7 @@ static void raw_sock_seq_show(struct seq_file *seq, struct sock *sp, int i) 0, 0L, 0, from_kuid_munged(seq_user_ns(seq), sock_i_uid(sp)), 0, sock_i_ino(sp), - atomic_read(&sp->sk_refcnt), sp, atomic_read(&sp->sk_drops)); + atomic_read(&sp->sk_refcnt), sp, atomic_read_unchecked(&sp->sk_drops)); } static int raw_seq_show(struct seq_file *seq, void *v) diff --git a/net/ipv4/route.c b/net/ipv4/route.c index e681b85..ef2796f 100644 --- a/net/ipv4/route.c +++ b/net/ipv4/route.c @@ -458,7 +458,7 @@ static struct neighbour *ipv4_neigh_lookup(const struct dst_entry *dst, #define IP_IDENTS_SZ 2048u -static atomic_t *ip_idents __read_mostly; +static atomic_unchecked_t *ip_idents __read_mostly; static u32 *ip_tstamps __read_mostly; /* In order to protect privacy, we add a perturbation to identifiers @@ -468,7 +468,7 @@ static u32 *ip_tstamps __read_mostly; u32 ip_idents_reserve(u32 hash, int segs) { u32 *p_tstamp = ip_tstamps + hash % IP_IDENTS_SZ; - atomic_t *p_id = ip_idents + hash % IP_IDENTS_SZ; + atomic_unchecked_t *p_id = ip_idents + hash % IP_IDENTS_SZ; u32 old = ACCESS_ONCE(*p_tstamp); u32 now = (u32)jiffies; u32 delta = 0; @@ -476,7 +476,7 @@ u32 ip_idents_reserve(u32 hash, int segs) if (old != now && cmpxchg(p_tstamp, old, now) == old) delta = prandom_u32_max(now - old); - return atomic_add_return(segs + delta, p_id) - segs; + return atomic_add_return_unchecked(segs + delta, p_id) - segs; } EXPORT_SYMBOL(ip_idents_reserve); @@ -2690,8 +2690,8 @@ static __net_initdata struct pernet_operations sysctl_route_ops = { static __net_init int rt_genid_init(struct net *net) { - atomic_set(&net->ipv4.rt_genid, 0); - atomic_set(&net->fnhe_genid, 0); + atomic_set_unchecked(&net->ipv4.rt_genid, 0); + atomic_set_unchecked(&net->fnhe_genid, 0); get_random_bytes(&net->ipv4.dev_addr_genid, sizeof(net->ipv4.dev_addr_genid)); return 0; diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c index 728f5b3..a95e744 100644 --- a/net/ipv4/tcp_input.c +++ b/net/ipv4/tcp_input.c @@ -6026,7 +6026,7 @@ struct request_sock *inet_reqsk_alloc(const struct request_sock_ops *ops, kmemcheck_annotate_bitfield(ireq, flags); ireq->opt = NULL; - atomic64_set(&ireq->ir_cookie, 0); + atomic64_set_unchecked(&ireq->ir_cookie, 0); ireq->ireq_state = TCP_NEW_SYN_RECV; write_pnet(&ireq->ireq_net, sock_net(sk_listener)); ireq->ireq_family = sk_listener->sk_family; diff --git a/net/ipv4/udp.c b/net/ipv4/udp.c index 1b8c5ba..b7b9745 100644 --- a/net/ipv4/udp.c +++ b/net/ipv4/udp.c @@ -1193,7 +1193,7 @@ static unsigned int first_packet_length(struct sock *sk) IS_UDPLITE(sk)); UDP_INC_STATS_BH(sock_net(sk), UDP_MIB_INERRORS, IS_UDPLITE(sk)); - atomic_inc(&sk->sk_drops); + atomic_inc_unchecked(&sk->sk_drops); __skb_unlink(skb, rcvq); __skb_queue_tail(&list_kill, skb); } @@ -1305,7 +1305,7 @@ try_again: if (unlikely(err)) { trace_kfree_skb(skb, udp_recvmsg); if (!peeked) { - atomic_inc(&sk->sk_drops); + atomic_inc_unchecked(&sk->sk_drops); UDP_INC_STATS_USER(sock_net(sk), UDP_MIB_INERRORS, is_udplite); } @@ -1599,7 +1599,7 @@ csum_error: UDP_INC_STATS_BH(sock_net(sk), UDP_MIB_CSUMERRORS, is_udplite); drop: UDP_INC_STATS_BH(sock_net(sk), UDP_MIB_INERRORS, is_udplite); - atomic_inc(&sk->sk_drops); + atomic_inc_unchecked(&sk->sk_drops); kfree_skb(skb); return -1; } @@ -1617,7 +1617,7 @@ static void flush_stack(struct sock **stack, unsigned int count, skb1 = (i == final) ? skb : skb_clone(skb, GFP_ATOMIC); if (!skb1) { - atomic_inc(&sk->sk_drops); + atomic_inc_unchecked(&sk->sk_drops); UDP_INC_STATS_BH(sock_net(sk), UDP_MIB_RCVBUFERRORS, IS_UDPLITE(sk)); UDP_INC_STATS_BH(sock_net(sk), UDP_MIB_INERRORS, @@ -2427,7 +2427,7 @@ static void udp4_format_sock(struct sock *sp, struct seq_file *f, from_kuid_munged(seq_user_ns(f), sock_i_uid(sp)), 0, sock_i_ino(sp), atomic_read(&sp->sk_refcnt), sp, - atomic_read(&sp->sk_drops)); + atomic_read_unchecked(&sp->sk_drops)); } int udp4_seq_show(struct seq_file *seq, void *v) diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c index 21c2c81..80267dd 100644 --- a/net/ipv6/addrconf.c +++ b/net/ipv6/addrconf.c @@ -620,7 +620,7 @@ static int inet6_netconf_dump_devconf(struct sk_buff *skb, idx = 0; head = &net->dev_index_head[h]; rcu_read_lock(); - cb->seq = atomic_read(&net->ipv6.dev_addr_genid) ^ + cb->seq = atomic_read_unchecked(&net->ipv6.dev_addr_genid) ^ net->dev_base_seq; hlist_for_each_entry_rcu(dev, head, index_hlist) { if (idx < s_idx) @@ -4402,7 +4402,7 @@ static int inet6_dump_addr(struct sk_buff *skb, struct netlink_callback *cb, s_ip_idx = ip_idx = cb->args[2]; rcu_read_lock(); - cb->seq = atomic_read(&net->ipv6.dev_addr_genid) ^ net->dev_base_seq; + cb->seq = atomic_read_unchecked(&net->ipv6.dev_addr_genid) ^ net->dev_base_seq; for (h = s_h; h < NETDEV_HASHENTRIES; h++, s_idx = 0) { idx = 0; head = &net->dev_index_head[h]; @@ -5059,7 +5059,7 @@ static void __ipv6_ifa_notify(int event, struct inet6_ifaddr *ifp) rt_genid_bump_ipv6(net); break; } - atomic_inc(&net->ipv6.dev_addr_genid); + atomic_inc_unchecked(&net->ipv6.dev_addr_genid); } static void ipv6_ifa_notify(int event, struct inet6_ifaddr *ifp) diff --git a/net/ipv6/af_inet6.c b/net/ipv6/af_inet6.c index 7de52b6..ce7fb94 100644 --- a/net/ipv6/af_inet6.c +++ b/net/ipv6/af_inet6.c @@ -770,7 +770,7 @@ static int __net_init inet6_net_init(struct net *net) net->ipv6.sysctl.idgen_retries = 3; net->ipv6.sysctl.idgen_delay = 1 * HZ; net->ipv6.sysctl.flowlabel_state_ranges = 1; - atomic_set(&net->ipv6.fib6_sernum, 1); + atomic_set_unchecked(&net->ipv6.fib6_sernum, 1); err = ipv6_init_mibs(net); if (err) diff --git a/net/ipv6/datagram.c b/net/ipv6/datagram.c index b10a889..e881e1f 100644 --- a/net/ipv6/datagram.c +++ b/net/ipv6/datagram.c @@ -977,5 +977,5 @@ void ip6_dgram_sock_seq_show(struct seq_file *seq, struct sock *sp, 0, sock_i_ino(sp), atomic_read(&sp->sk_refcnt), sp, - atomic_read(&sp->sk_drops)); + atomic_read_unchecked(&sp->sk_drops)); } diff --git a/net/ipv6/ip6_fib.c b/net/ipv6/ip6_fib.c index 548c623..bc8ec4f 100644 --- a/net/ipv6/ip6_fib.c +++ b/net/ipv6/ip6_fib.c @@ -99,9 +99,9 @@ static int fib6_new_sernum(struct net *net) int new, old; do { - old = atomic_read(&net->ipv6.fib6_sernum); + old = atomic_read_unchecked(&net->ipv6.fib6_sernum); new = old < INT_MAX ? old + 1 : 1; - } while (atomic_cmpxchg(&net->ipv6.fib6_sernum, + } while (atomic_cmpxchg_unchecked(&net->ipv6.fib6_sernum, old, new) != old); return new; } diff --git a/net/ipv6/raw.c b/net/ipv6/raw.c index ca4700c..f20fe21 100644 --- a/net/ipv6/raw.c +++ b/net/ipv6/raw.c @@ -388,7 +388,7 @@ static inline int rawv6_rcv_skb(struct sock *sk, struct sk_buff *skb) { if ((raw6_sk(sk)->checksum || rcu_access_pointer(sk->sk_filter)) && skb_checksum_complete(skb)) { - atomic_inc(&sk->sk_drops); + atomic_inc_unchecked(&sk->sk_drops); kfree_skb(skb); return NET_RX_DROP; } @@ -416,7 +416,7 @@ int rawv6_rcv(struct sock *sk, struct sk_buff *skb) struct raw6_sock *rp = raw6_sk(sk); if (!xfrm6_policy_check(sk, XFRM_POLICY_IN, skb)) { - atomic_inc(&sk->sk_drops); + atomic_inc_unchecked(&sk->sk_drops); kfree_skb(skb); return NET_RX_DROP; } @@ -440,7 +440,7 @@ int rawv6_rcv(struct sock *sk, struct sk_buff *skb) if (inet->hdrincl) { if (skb_checksum_complete(skb)) { - atomic_inc(&sk->sk_drops); + atomic_inc_unchecked(&sk->sk_drops); kfree_skb(skb); return NET_RX_DROP; } diff --git a/net/ipv6/udp.c b/net/ipv6/udp.c index e51fc3e..5b274f6 100644 --- a/net/ipv6/udp.c +++ b/net/ipv6/udp.c @@ -445,7 +445,7 @@ try_again: if (unlikely(err)) { trace_kfree_skb(skb, udpv6_recvmsg); if (!peeked) { - atomic_inc(&sk->sk_drops); + atomic_inc_unchecked(&sk->sk_drops); if (is_udp4) UDP_INC_STATS_USER(sock_net(sk), UDP_MIB_INERRORS, @@ -709,7 +709,7 @@ csum_error: UDP6_INC_STATS_BH(sock_net(sk), UDP_MIB_CSUMERRORS, is_udplite); drop: UDP6_INC_STATS_BH(sock_net(sk), UDP_MIB_INERRORS, is_udplite); - atomic_inc(&sk->sk_drops); + atomic_inc_unchecked(&sk->sk_drops); kfree_skb(skb); return -1; } @@ -750,7 +750,7 @@ static void flush_stack(struct sock **stack, unsigned int count, if (likely(!skb1)) skb1 = (i == final) ? skb : skb_clone(skb, GFP_ATOMIC); if (!skb1) { - atomic_inc(&sk->sk_drops); + atomic_inc_unchecked(&sk->sk_drops); UDP6_INC_STATS_BH(sock_net(sk), UDP_MIB_RCVBUFERRORS, IS_UDPLITE(sk)); UDP6_INC_STATS_BH(sock_net(sk), UDP_MIB_INERRORS, diff --git a/net/iucv/af_iucv.c b/net/iucv/af_iucv.c index 918151c..5bbe95a 100644 --- a/net/iucv/af_iucv.c +++ b/net/iucv/af_iucv.c @@ -686,10 +686,10 @@ static void __iucv_auto_name(struct iucv_sock *iucv) { char name[12]; - sprintf(name, "%08x", atomic_inc_return(&iucv_sk_list.autobind_name)); + sprintf(name, "%08x", atomic_inc_return_unchecked(&iucv_sk_list.autobind_name)); while (__iucv_get_sock_by_name(name)) { sprintf(name, "%08x", - atomic_inc_return(&iucv_sk_list.autobind_name)); + atomic_inc_return_unchecked(&iucv_sk_list.autobind_name)); } memcpy(iucv->src_name, name, 8); } diff --git a/net/key/af_key.c b/net/key/af_key.c index 83a7068..facf2f0 100644 --- a/net/key/af_key.c +++ b/net/key/af_key.c @@ -3050,10 +3050,10 @@ static int pfkey_send_policy_notify(struct xfrm_policy *xp, int dir, const struc static u32 get_acqseq(void) { u32 res; - static atomic_t acqseq; + static atomic_unchecked_t acqseq; do { - res = atomic_inc_return(&acqseq); + res = atomic_inc_return_unchecked(&acqseq); } while (!res); return res; } diff --git a/net/l2tp/l2tp_eth.c b/net/l2tp/l2tp_eth.c index 4b55287..bd247f7 100644 --- a/net/l2tp/l2tp_eth.c +++ b/net/l2tp/l2tp_eth.c @@ -42,12 +42,12 @@ struct l2tp_eth { struct sock *tunnel_sock; struct l2tp_session *session; struct list_head list; - atomic_long_t tx_bytes; - atomic_long_t tx_packets; - atomic_long_t tx_dropped; - atomic_long_t rx_bytes; - atomic_long_t rx_packets; - atomic_long_t rx_errors; + atomic_long_unchecked_t tx_bytes; + atomic_long_unchecked_t tx_packets; + atomic_long_unchecked_t tx_dropped; + atomic_long_unchecked_t rx_bytes; + atomic_long_unchecked_t rx_packets; + atomic_long_unchecked_t rx_errors; }; /* via l2tp_session_priv() */ @@ -98,10 +98,10 @@ static int l2tp_eth_dev_xmit(struct sk_buff *skb, struct net_device *dev) int ret = l2tp_xmit_skb(session, skb, session->hdr_len); if (likely(ret == NET_XMIT_SUCCESS)) { - atomic_long_add(len, &priv->tx_bytes); - atomic_long_inc(&priv->tx_packets); + atomic_long_add_unchecked(len, &priv->tx_bytes); + atomic_long_inc_unchecked(&priv->tx_packets); } else { - atomic_long_inc(&priv->tx_dropped); + atomic_long_inc_unchecked(&priv->tx_dropped); } return NETDEV_TX_OK; } @@ -111,12 +111,12 @@ static struct rtnl_link_stats64 *l2tp_eth_get_stats64(struct net_device *dev, { struct l2tp_eth *priv = netdev_priv(dev); - stats->tx_bytes = atomic_long_read(&priv->tx_bytes); - stats->tx_packets = atomic_long_read(&priv->tx_packets); - stats->tx_dropped = atomic_long_read(&priv->tx_dropped); - stats->rx_bytes = atomic_long_read(&priv->rx_bytes); - stats->rx_packets = atomic_long_read(&priv->rx_packets); - stats->rx_errors = atomic_long_read(&priv->rx_errors); + stats->tx_bytes = atomic_long_read_unchecked(&priv->tx_bytes); + stats->tx_packets = atomic_long_read_unchecked(&priv->tx_packets); + stats->tx_dropped = atomic_long_read_unchecked(&priv->tx_dropped); + stats->rx_bytes = atomic_long_read_unchecked(&priv->rx_bytes); + stats->rx_packets = atomic_long_read_unchecked(&priv->rx_packets); + stats->rx_errors = atomic_long_read_unchecked(&priv->rx_errors); return stats; } @@ -167,15 +167,15 @@ static void l2tp_eth_dev_recv(struct l2tp_session *session, struct sk_buff *skb, nf_reset(skb); if (dev_forward_skb(dev, skb) == NET_RX_SUCCESS) { - atomic_long_inc(&priv->rx_packets); - atomic_long_add(data_len, &priv->rx_bytes); + atomic_long_inc_unchecked(&priv->rx_packets); + atomic_long_add_unchecked(data_len, &priv->rx_bytes); } else { - atomic_long_inc(&priv->rx_errors); + atomic_long_inc_unchecked(&priv->rx_errors); } return; error: - atomic_long_inc(&priv->rx_errors); + atomic_long_inc_unchecked(&priv->rx_errors); kfree_skb(skb); } diff --git a/net/netfilter/ipvs/ip_vs_conn.c b/net/netfilter/ipvs/ip_vs_conn.c index b0f7b62..0541842 100644 --- a/net/netfilter/ipvs/ip_vs_conn.c +++ b/net/netfilter/ipvs/ip_vs_conn.c @@ -572,7 +572,7 @@ ip_vs_bind_dest(struct ip_vs_conn *cp, struct ip_vs_dest *dest) /* Increase the refcnt counter of the dest */ ip_vs_dest_hold(dest); - conn_flags = atomic_read(&dest->conn_flags); + conn_flags = atomic_read_unchecked(&dest->conn_flags); if (cp->protocol != IPPROTO_UDP) conn_flags &= ~IP_VS_CONN_F_ONE_PACKET; flags = cp->flags; @@ -922,7 +922,7 @@ ip_vs_conn_new(const struct ip_vs_conn_param *p, int dest_af, cp->control = NULL; atomic_set(&cp->n_control, 0); - atomic_set(&cp->in_pkts, 0); + atomic_set_unchecked(&cp->in_pkts, 0); cp->packet_xmit = NULL; cp->app = NULL; @@ -1229,7 +1229,7 @@ static inline int todrop_entry(struct ip_vs_conn *cp) /* Don't drop the entry if its number of incoming packets is not located in [0, 8] */ - i = atomic_read(&cp->in_pkts); + i = atomic_read_unchecked(&cp->in_pkts); if (i > 8 || i < 0) return 0; if (!todrop_rate[i]) return 0; diff --git a/net/netfilter/ipvs/ip_vs_core.c b/net/netfilter/ipvs/ip_vs_core.c index 38fbc19..4272cb4 100644 --- a/net/netfilter/ipvs/ip_vs_core.c +++ b/net/netfilter/ipvs/ip_vs_core.c @@ -586,7 +586,7 @@ int ip_vs_leave(struct ip_vs_service *svc, struct sk_buff *skb, ret = cp->packet_xmit(skb, cp, pd->pp, iph); /* do not touch skb anymore */ - atomic_inc(&cp->in_pkts); + atomic_inc_unchecked(&cp->in_pkts); ip_vs_conn_put(cp); return ret; } @@ -1762,7 +1762,7 @@ ip_vs_in(unsigned int hooknum, struct sk_buff *skb, int af) if (cp->flags & IP_VS_CONN_F_ONE_PACKET) pkts = sysctl_sync_threshold(ipvs); else - pkts = atomic_add_return(1, &cp->in_pkts); + pkts = atomic_add_return_unchecked(1, &cp->in_pkts); if (ipvs->sync_state & IP_VS_STATE_MASTER) ip_vs_sync_conn(net, cp, pkts); diff --git a/net/netfilter/ipvs/ip_vs_ctl.c b/net/netfilter/ipvs/ip_vs_ctl.c index 24c5542..d4c95f9 100644 --- a/net/netfilter/ipvs/ip_vs_ctl.c +++ b/net/netfilter/ipvs/ip_vs_ctl.c @@ -814,7 +814,7 @@ __ip_vs_update_dest(struct ip_vs_service *svc, struct ip_vs_dest *dest, */ ip_vs_rs_hash(ipvs, dest); } - atomic_set(&dest->conn_flags, conn_flags); + atomic_set_unchecked(&dest->conn_flags, conn_flags); /* bind the service */ old_svc = rcu_dereference_protected(dest->svc, 1); @@ -2036,7 +2036,7 @@ static int ip_vs_info_seq_show(struct seq_file *seq, void *v) " %-7s %-6d %-10d %-10d\n", &dest->addr.in6, ntohs(dest->port), - ip_vs_fwd_name(atomic_read(&dest->conn_flags)), + ip_vs_fwd_name(atomic_read_unchecked(&dest->conn_flags)), atomic_read(&dest->weight), atomic_read(&dest->activeconns), atomic_read(&dest->inactconns)); @@ -2047,7 +2047,7 @@ static int ip_vs_info_seq_show(struct seq_file *seq, void *v) "%-7s %-6d %-10d %-10d\n", ntohl(dest->addr.ip), ntohs(dest->port), - ip_vs_fwd_name(atomic_read(&dest->conn_flags)), + ip_vs_fwd_name(atomic_read_unchecked(&dest->conn_flags)), atomic_read(&dest->weight), atomic_read(&dest->activeconns), atomic_read(&dest->inactconns)); @@ -2546,7 +2546,7 @@ __ip_vs_get_dest_entries(struct net *net, const struct ip_vs_get_dests *get, entry.addr = dest->addr.ip; entry.port = dest->port; - entry.conn_flags = atomic_read(&dest->conn_flags); + entry.conn_flags = atomic_read_unchecked(&dest->conn_flags); entry.weight = atomic_read(&dest->weight); entry.u_threshold = dest->u_threshold; entry.l_threshold = dest->l_threshold; @@ -3121,7 +3121,7 @@ static int ip_vs_genl_fill_dest(struct sk_buff *skb, struct ip_vs_dest *dest) if (nla_put(skb, IPVS_DEST_ATTR_ADDR, sizeof(dest->addr), &dest->addr) || nla_put_be16(skb, IPVS_DEST_ATTR_PORT, dest->port) || nla_put_u32(skb, IPVS_DEST_ATTR_FWD_METHOD, - (atomic_read(&dest->conn_flags) & + (atomic_read_unchecked(&dest->conn_flags) & IP_VS_CONN_F_FWD_MASK)) || nla_put_u32(skb, IPVS_DEST_ATTR_WEIGHT, atomic_read(&dest->weight)) || diff --git a/net/netfilter/ipvs/ip_vs_sync.c b/net/netfilter/ipvs/ip_vs_sync.c index d99ad93..09bd6dc 100644 --- a/net/netfilter/ipvs/ip_vs_sync.c +++ b/net/netfilter/ipvs/ip_vs_sync.c @@ -609,7 +609,7 @@ static void ip_vs_sync_conn_v0(struct net *net, struct ip_vs_conn *cp, cp = cp->control; if (cp) { if (cp->flags & IP_VS_CONN_F_TEMPLATE) - pkts = atomic_add_return(1, &cp->in_pkts); + pkts = atomic_add_return_unchecked(1, &cp->in_pkts); else pkts = sysctl_sync_threshold(ipvs); ip_vs_sync_conn(net, cp, pkts); @@ -771,7 +771,7 @@ control: if (!cp) return; if (cp->flags & IP_VS_CONN_F_TEMPLATE) - pkts = atomic_add_return(1, &cp->in_pkts); + pkts = atomic_add_return_unchecked(1, &cp->in_pkts); else pkts = sysctl_sync_threshold(ipvs); goto sloop; @@ -919,7 +919,7 @@ static void ip_vs_proc_conn(struct net *net, struct ip_vs_conn_param *param, if (opt) memcpy(&cp->in_seq, opt, sizeof(*opt)); - atomic_set(&cp->in_pkts, sysctl_sync_threshold(ipvs)); + atomic_set_unchecked(&cp->in_pkts, sysctl_sync_threshold(ipvs)); cp->state = state; cp->old_state = cp->state; /* diff --git a/net/netfilter/ipvs/ip_vs_xmit.c b/net/netfilter/ipvs/ip_vs_xmit.c index 258a0b0..2082f50 100644 --- a/net/netfilter/ipvs/ip_vs_xmit.c +++ b/net/netfilter/ipvs/ip_vs_xmit.c @@ -1259,7 +1259,7 @@ ip_vs_icmp_xmit(struct sk_buff *skb, struct ip_vs_conn *cp, else rc = NF_ACCEPT; /* do not touch skb anymore */ - atomic_inc(&cp->in_pkts); + atomic_inc_unchecked(&cp->in_pkts); goto out; } @@ -1352,7 +1352,7 @@ ip_vs_icmp_xmit_v6(struct sk_buff *skb, struct ip_vs_conn *cp, else rc = NF_ACCEPT; /* do not touch skb anymore */ - atomic_inc(&cp->in_pkts); + atomic_inc_unchecked(&cp->in_pkts); goto out; } diff --git a/net/netfilter/nfnetlink_log.c b/net/netfilter/nfnetlink_log.c index 4670821..a6c3c47d 100644 --- a/net/netfilter/nfnetlink_log.c +++ b/net/netfilter/nfnetlink_log.c @@ -84,7 +84,7 @@ static int nfnl_log_net_id __read_mostly; struct nfnl_log_net { spinlock_t instances_lock; struct hlist_head instance_table[INSTANCE_BUCKETS]; - atomic_t global_seq; + atomic_unchecked_t global_seq; }; static struct nfnl_log_net *nfnl_log_pernet(struct net *net) @@ -572,7 +572,7 @@ __build_packet_message(struct nfnl_log_net *log, /* global sequence number */ if ((inst->flags & NFULNL_CFG_F_SEQ_GLOBAL) && nla_put_be32(inst->skb, NFULA_SEQ_GLOBAL, - htonl(atomic_inc_return(&log->global_seq)))) + htonl(atomic_inc_return_unchecked(&log->global_seq)))) goto nla_put_failure; if (data_len) { diff --git a/net/netfilter/xt_statistic.c b/net/netfilter/xt_statistic.c index 11de55e..f25e448 100644 --- a/net/netfilter/xt_statistic.c +++ b/net/netfilter/xt_statistic.c @@ -19,7 +19,7 @@ #include <linux/module.h> struct xt_statistic_priv { - atomic_t count; + atomic_unchecked_t count; } ____cacheline_aligned_in_smp; MODULE_LICENSE("GPL"); @@ -42,9 +42,9 @@ statistic_mt(const struct sk_buff *skb, struct xt_action_param *par) break; case XT_STATISTIC_MODE_NTH: do { - oval = atomic_read(&info->master->count); + oval = atomic_read_unchecked(&info->master->count); nval = (oval == info->u.nth.every) ? 0 : oval + 1; - } while (atomic_cmpxchg(&info->master->count, oval, nval) != oval); + } while (atomic_cmpxchg_unchecked(&info->master->count, oval, nval) != oval); if (nval == 0) ret = !ret; break; @@ -64,7 +64,7 @@ static int statistic_mt_check(const struct xt_mtchk_param *par) info->master = kzalloc(sizeof(*info->master), GFP_KERNEL); if (info->master == NULL) return -ENOMEM; - atomic_set(&info->master->count, info->u.nth.count); + atomic_set_unchecked(&info->master->count, info->u.nth.count); return 0; } diff --git a/net/netlink/af_netlink.c b/net/netlink/af_netlink.c index a133d16..fafee70 100644 --- a/net/netlink/af_netlink.c +++ b/net/netlink/af_netlink.c @@ -286,7 +286,7 @@ static void netlink_overrun(struct sock *sk) sk->sk_error_report(sk); } } - atomic_inc(&sk->sk_drops); + atomic_inc_unchecked(&sk->sk_drops); } static void netlink_rcv_wake(struct sock *sk) @@ -3145,7 +3145,7 @@ static int netlink_seq_show(struct seq_file *seq, void *v) sk_wmem_alloc_get(s), nlk->cb_running, atomic_read(&s->sk_refcnt), - atomic_read(&s->sk_drops), + atomic_read_unchecked(&s->sk_drops), sock_i_ino(s) ); diff --git a/net/openvswitch/vport.c b/net/openvswitch/vport.c index 067a3ff..9ecc05c 100644 --- a/net/openvswitch/vport.c +++ b/net/openvswitch/vport.c @@ -303,10 +303,10 @@ void ovs_vport_get_stats(struct vport *vport, struct ovs_vport_stats *stats) * netdev-stats can be directly read over netlink-ioctl. */ - stats->rx_errors = atomic_long_read(&vport->err_stats.rx_errors); - stats->tx_errors = atomic_long_read(&vport->err_stats.tx_errors); - stats->tx_dropped = atomic_long_read(&vport->err_stats.tx_dropped); - stats->rx_dropped = atomic_long_read(&vport->err_stats.rx_dropped); + stats->rx_errors = atomic_long_read_unchecked(&vport->err_stats.rx_errors); + stats->tx_errors = atomic_long_read_unchecked(&vport->err_stats.tx_errors); + stats->tx_dropped = atomic_long_read_unchecked(&vport->err_stats.tx_dropped); + stats->rx_dropped = atomic_long_read_unchecked(&vport->err_stats.rx_dropped); for_each_possible_cpu(i) { const struct pcpu_sw_netstats *percpu_stats; @@ -538,19 +538,19 @@ static void ovs_vport_record_error(struct vport *vport, { switch (err_type) { case VPORT_E_RX_DROPPED: - atomic_long_inc(&vport->err_stats.rx_dropped); + atomic_long_inc_unchecked(&vport->err_stats.rx_dropped); break; case VPORT_E_RX_ERROR: - atomic_long_inc(&vport->err_stats.rx_errors); + atomic_long_inc_unchecked(&vport->err_stats.rx_errors); break; case VPORT_E_TX_DROPPED: - atomic_long_inc(&vport->err_stats.tx_dropped); + atomic_long_inc_unchecked(&vport->err_stats.tx_dropped); break; case VPORT_E_TX_ERROR: - atomic_long_inc(&vport->err_stats.tx_errors); + atomic_long_inc_unchecked(&vport->err_stats.tx_errors); break; } diff --git a/net/openvswitch/vport.h b/net/openvswitch/vport.h index bc85331..0d3dce0 100644 --- a/net/openvswitch/vport.h +++ b/net/openvswitch/vport.h @@ -71,10 +71,10 @@ int ovs_vport_get_egress_tun_info(struct vport *vport, struct sk_buff *skb, /* The following definitions are for implementers of vport devices: */ struct vport_err_stats { - atomic_long_t rx_dropped; - atomic_long_t rx_errors; - atomic_long_t tx_dropped; - atomic_long_t tx_errors; + atomic_long_unchecked_t rx_dropped; + atomic_long_unchecked_t rx_errors; + atomic_long_unchecked_t tx_dropped; + atomic_long_unchecked_t tx_errors; }; /** * struct vport_portids - array of netlink portids of a vport. diff --git a/net/packet/af_packet.c b/net/packet/af_packet.c index 7851b12..67ecf51 100644 --- a/net/packet/af_packet.c +++ b/net/packet/af_packet.c @@ -277,7 +277,7 @@ static int packet_direct_xmit(struct sk_buff *skb) return ret; drop: - atomic_long_inc(&dev->tx_dropped); + atomic_long_inc_unchecked(&dev->tx_dropped); kfree_skb(skb); return NET_XMIT_DROP; } @@ -1946,7 +1946,7 @@ static int packet_rcv(struct sk_buff *skb, struct net_device *dev, drop_n_acct: spin_lock(&sk->sk_receive_queue.lock); po->stats.stats1.tp_drops++; - atomic_inc(&sk->sk_drops); + atomic_inc_unchecked(&sk->sk_drops); spin_unlock(&sk->sk_receive_queue.lock); drop_n_restore: diff --git a/net/phonet/pep.c b/net/phonet/pep.c index 850a86c..8884a37 100644 --- a/net/phonet/pep.c +++ b/net/phonet/pep.c @@ -388,7 +388,7 @@ static int pipe_do_rcv(struct sock *sk, struct sk_buff *skb) case PNS_PEP_CTRL_REQ: if (skb_queue_len(&pn->ctrlreq_queue) >= PNPIPE_CTRLREQ_MAX) { - atomic_inc(&sk->sk_drops); + atomic_inc_unchecked(&sk->sk_drops); break; } __skb_pull(skb, 4); @@ -409,7 +409,7 @@ static int pipe_do_rcv(struct sock *sk, struct sk_buff *skb) } if (pn->rx_credits == 0) { - atomic_inc(&sk->sk_drops); + atomic_inc_unchecked(&sk->sk_drops); err = -ENOBUFS; break; } @@ -579,7 +579,7 @@ static int pipe_handler_do_rcv(struct sock *sk, struct sk_buff *skb) } if (pn->rx_credits == 0) { - atomic_inc(&sk->sk_drops); + atomic_inc_unchecked(&sk->sk_drops); err = NET_RX_DROP; break; } diff --git a/net/phonet/socket.c b/net/phonet/socket.c index d575ef4..1dedc31 100644 --- a/net/phonet/socket.c +++ b/net/phonet/socket.c @@ -611,7 +611,7 @@ static int pn_sock_seq_show(struct seq_file *seq, void *v) from_kuid_munged(seq_user_ns(seq), sock_i_uid(sk)), sock_i_ino(sk), atomic_read(&sk->sk_refcnt), sk, - atomic_read(&sk->sk_drops)); + atomic_read_unchecked(&sk->sk_drops)); } seq_pad(seq, '\n'); return 0; diff --git a/net/rds/cong.c b/net/rds/cong.c index e6144b8..4f9fda6 100644 --- a/net/rds/cong.c +++ b/net/rds/cong.c @@ -78,7 +78,7 @@ * finds that the saved generation number is smaller than the global generation * number, it wakes up the process. */ -static atomic_t rds_cong_generation = ATOMIC_INIT(0); +static atomic_unchecked_t rds_cong_generation = ATOMIC_INIT(0); /* * Congestion monitoring @@ -247,7 +247,7 @@ void rds_cong_map_updated(struct rds_cong_map *map, uint64_t portmask) rdsdebug("waking map %p for %pI4\n", map, &map->m_addr); rds_stats_inc(s_cong_update_received); - atomic_inc(&rds_cong_generation); + atomic_inc_unchecked(&rds_cong_generation); if (waitqueue_active(&map->m_waitq)) wake_up(&map->m_waitq); if (waitqueue_active(&rds_poll_waitq)) @@ -273,7 +273,7 @@ EXPORT_SYMBOL_GPL(rds_cong_map_updated); int rds_cong_updated_since(unsigned long *recent) { - unsigned long gen = atomic_read(&rds_cong_generation); + unsigned long gen = atomic_read_unchecked(&rds_cong_generation); if (likely(*recent == gen)) return 0; diff --git a/net/rds/ib.h b/net/rds/ib.h index 86d88ec..b5461c2 100644 --- a/net/rds/ib.h +++ b/net/rds/ib.h @@ -128,7 +128,7 @@ struct rds_ib_connection { /* sending acks */ unsigned long i_ack_flags; #ifdef KERNEL_HAS_ATOMIC64 - atomic64_t i_ack_next; /* next ACK to send */ + atomic64_unchecked_t i_ack_next; /* next ACK to send */ #else spinlock_t i_ack_lock; /* protect i_ack_next */ u64 i_ack_next; /* next ACK to send */ diff --git a/net/rds/ib_cm.c b/net/rds/ib_cm.c index 0da2a45..388ae0b 100644 --- a/net/rds/ib_cm.c +++ b/net/rds/ib_cm.c @@ -699,7 +699,7 @@ void rds_ib_conn_shutdown(struct rds_connection *conn) /* Clear the ACK state */ clear_bit(IB_ACK_IN_FLIGHT, &ic->i_ack_flags); #ifdef KERNEL_HAS_ATOMIC64 - atomic64_set(&ic->i_ack_next, 0); + atomic64_set_unchecked(&ic->i_ack_next, 0); #else ic->i_ack_next = 0; #endif diff --git a/net/rds/ib_recv.c b/net/rds/ib_recv.c index cac5b45..9a6f263 100644 --- a/net/rds/ib_recv.c +++ b/net/rds/ib_recv.c @@ -581,7 +581,7 @@ static u64 rds_ib_get_ack(struct rds_ib_connection *ic) static void rds_ib_set_ack(struct rds_ib_connection *ic, u64 seq, int ack_required) { - atomic64_set(&ic->i_ack_next, seq); + atomic64_set_unchecked(&ic->i_ack_next, seq); if (ack_required) { smp_mb__before_atomic(); set_bit(IB_ACK_REQUESTED, &ic->i_ack_flags); @@ -593,7 +593,7 @@ static u64 rds_ib_get_ack(struct rds_ib_connection *ic) clear_bit(IB_ACK_REQUESTED, &ic->i_ack_flags); smp_mb__after_atomic(); - return atomic64_read(&ic->i_ack_next); + return atomic64_read_unchecked(&ic->i_ack_next); } #endif diff --git a/net/rds/iw.h b/net/rds/iw.h index cbe6674..dc9eb89 100644 --- a/net/rds/iw.h +++ b/net/rds/iw.h @@ -134,7 +134,7 @@ struct rds_iw_connection { /* sending acks */ unsigned long i_ack_flags; #ifdef KERNEL_HAS_ATOMIC64 - atomic64_t i_ack_next; /* next ACK to send */ + atomic64_unchecked_t i_ack_next; /* next ACK to send */ #else spinlock_t i_ack_lock; /* protect i_ack_next */ u64 i_ack_next; /* next ACK to send */ diff --git a/net/rds/iw_cm.c b/net/rds/iw_cm.c index 8f486fa..7849d8c 100644 --- a/net/rds/iw_cm.c +++ b/net/rds/iw_cm.c @@ -666,7 +666,7 @@ void rds_iw_conn_shutdown(struct rds_connection *conn) /* Clear the ACK state */ clear_bit(IB_ACK_IN_FLIGHT, &ic->i_ack_flags); #ifdef KERNEL_HAS_ATOMIC64 - atomic64_set(&ic->i_ack_next, 0); + atomic64_set_unchecked(&ic->i_ack_next, 0); #else ic->i_ack_next = 0; #endif diff --git a/net/rds/iw_recv.c b/net/rds/iw_recv.c index a66d179..cf1e258 100644 --- a/net/rds/iw_recv.c +++ b/net/rds/iw_recv.c @@ -412,7 +412,7 @@ static u64 rds_iw_get_ack(struct rds_iw_connection *ic) static void rds_iw_set_ack(struct rds_iw_connection *ic, u64 seq, int ack_required) { - atomic64_set(&ic->i_ack_next, seq); + atomic64_set_unchecked(&ic->i_ack_next, seq); if (ack_required) { smp_mb__before_atomic(); set_bit(IB_ACK_REQUESTED, &ic->i_ack_flags); @@ -424,7 +424,7 @@ static u64 rds_iw_get_ack(struct rds_iw_connection *ic) clear_bit(IB_ACK_REQUESTED, &ic->i_ack_flags); smp_mb__after_atomic(); - return atomic64_read(&ic->i_ack_next); + return atomic64_read_unchecked(&ic->i_ack_next); } #endif diff --git a/net/rxrpc/af_rxrpc.c b/net/rxrpc/af_rxrpc.c index 25d60ed..ec9ae2c 100644 --- a/net/rxrpc/af_rxrpc.c +++ b/net/rxrpc/af_rxrpc.c @@ -40,7 +40,7 @@ static const struct proto_ops rxrpc_rpc_ops; __be32 rxrpc_epoch; /* current debugging ID */ -atomic_t rxrpc_debug_id; +atomic_unchecked_t rxrpc_debug_id; /* count of skbs currently in use */ atomic_t rxrpc_n_skbs; diff --git a/net/rxrpc/ar-ack.c b/net/rxrpc/ar-ack.c index e0547f5..a171f7a 100644 --- a/net/rxrpc/ar-ack.c +++ b/net/rxrpc/ar-ack.c @@ -224,7 +224,7 @@ static void rxrpc_resend(struct rxrpc_call *call) _enter("{%d,%d,%d,%d},", call->acks_hard, call->acks_unacked, - atomic_read(&call->sequence), + atomic_read_unchecked(&call->sequence), CIRC_CNT(call->acks_head, call->acks_tail, call->acks_winsz)); stop = false; @@ -248,7 +248,7 @@ static void rxrpc_resend(struct rxrpc_call *call) /* each Tx packet has a new serial number */ sp->hdr.serial = - htonl(atomic_inc_return(&call->conn->serial)); + htonl(atomic_inc_return_unchecked(&call->conn->serial)); hdr = (struct rxrpc_header *) txb->head; hdr->serial = sp->hdr.serial; @@ -452,7 +452,7 @@ static void rxrpc_rotate_tx_window(struct rxrpc_call *call, u32 hard) */ static void rxrpc_clear_tx_window(struct rxrpc_call *call) { - rxrpc_rotate_tx_window(call, atomic_read(&call->sequence)); + rxrpc_rotate_tx_window(call, atomic_read_unchecked(&call->sequence)); } /* @@ -678,7 +678,7 @@ process_further: latest = ntohl(sp->hdr.serial); hard = ntohl(ack.firstPacket); - tx = atomic_read(&call->sequence); + tx = atomic_read_unchecked(&call->sequence); _proto("Rx ACK %%%u { m=%hu f=#%u p=#%u s=%%%u r=%s n=%u }", latest, @@ -1210,7 +1210,7 @@ void rxrpc_process_call(struct work_struct *work) goto maybe_reschedule; send_ACK_with_skew: - ack.maxSkew = htons(atomic_read(&call->conn->hi_serial) - + ack.maxSkew = htons(atomic_read_unchecked(&call->conn->hi_serial) - ntohl(ack.serial)); send_ACK: mtu = call->conn->trans->peer->if_mtu; @@ -1222,7 +1222,7 @@ send_ACK: ackinfo.rxMTU = htonl(rxrpc_rx_mtu); ackinfo.jumbo_max = htonl(rxrpc_rx_jumbo_max); - hdr.serial = htonl(atomic_inc_return(&call->conn->serial)); + hdr.serial = htonl(atomic_inc_return_unchecked(&call->conn->serial)); _proto("Tx ACK %%%u { m=%hu f=#%u p=#%u s=%%%u r=%s n=%u }", ntohl(hdr.serial), ntohs(ack.maxSkew), @@ -1240,7 +1240,7 @@ send_ACK: send_message: _debug("send message"); - hdr.serial = htonl(atomic_inc_return(&call->conn->serial)); + hdr.serial = htonl(atomic_inc_return_unchecked(&call->conn->serial)); _proto("Tx %s %%%u", rxrpc_pkts[hdr.type], ntohl(hdr.serial)); send_message_2: diff --git a/net/rxrpc/ar-call.c b/net/rxrpc/ar-call.c index a9e05db..194e793 100644 --- a/net/rxrpc/ar-call.c +++ b/net/rxrpc/ar-call.c @@ -232,7 +232,7 @@ static struct rxrpc_call *rxrpc_alloc_call(gfp_t gfp) spin_lock_init(&call->lock); rwlock_init(&call->state_lock); atomic_set(&call->usage, 1); - call->debug_id = atomic_inc_return(&rxrpc_debug_id); + call->debug_id = atomic_inc_return_unchecked(&rxrpc_debug_id); call->state = RXRPC_CALL_CLIENT_SEND_REQUEST; memset(&call->sock_node, 0xed, sizeof(call->sock_node)); diff --git a/net/rxrpc/ar-connection.c b/net/rxrpc/ar-connection.c index 6631f4f..bfdf056 100644 --- a/net/rxrpc/ar-connection.c +++ b/net/rxrpc/ar-connection.c @@ -210,7 +210,7 @@ static struct rxrpc_connection *rxrpc_alloc_connection(gfp_t gfp) rwlock_init(&conn->lock); spin_lock_init(&conn->state_lock); atomic_set(&conn->usage, 1); - conn->debug_id = atomic_inc_return(&rxrpc_debug_id); + conn->debug_id = atomic_inc_return_unchecked(&rxrpc_debug_id); conn->avail_calls = RXRPC_MAXCALLS; conn->size_align = 4; conn->header_size = sizeof(struct rxrpc_header); diff --git a/net/rxrpc/ar-connevent.c b/net/rxrpc/ar-connevent.c index e7ed43a..6afa140 100644 --- a/net/rxrpc/ar-connevent.c +++ b/net/rxrpc/ar-connevent.c @@ -109,7 +109,7 @@ static int rxrpc_abort_connection(struct rxrpc_connection *conn, len = iov[0].iov_len + iov[1].iov_len; - hdr.serial = htonl(atomic_inc_return(&conn->serial)); + hdr.serial = htonl(atomic_inc_return_unchecked(&conn->serial)); _proto("Tx CONN ABORT %%%u { %d }", ntohl(hdr.serial), abort_code); ret = kernel_sendmsg(conn->trans->local->socket, &msg, iov, 2, len); diff --git a/net/rxrpc/ar-input.c b/net/rxrpc/ar-input.c index 4505a69..fe73096 100644 --- a/net/rxrpc/ar-input.c +++ b/net/rxrpc/ar-input.c @@ -331,9 +331,9 @@ void rxrpc_fast_process_packet(struct rxrpc_call *call, struct sk_buff *skb) /* track the latest serial number on this connection for ACK packet * information */ serial = ntohl(sp->hdr.serial); - hi_serial = atomic_read(&call->conn->hi_serial); + hi_serial = atomic_read_unchecked(&call->conn->hi_serial); while (serial > hi_serial) - hi_serial = atomic_cmpxchg(&call->conn->hi_serial, hi_serial, + hi_serial = atomic_cmpxchg_unchecked(&call->conn->hi_serial, hi_serial, serial); /* request ACK generation for any ACK or DATA packet that requests diff --git a/net/rxrpc/ar-internal.h b/net/rxrpc/ar-internal.h index aef1bd2..97736c3 100644 --- a/net/rxrpc/ar-internal.h +++ b/net/rxrpc/ar-internal.h @@ -274,8 +274,8 @@ struct rxrpc_connection { int error; /* error code for local abort */ int debug_id; /* debug ID for printks */ unsigned int call_counter; /* call ID counter */ - atomic_t serial; /* packet serial number counter */ - atomic_t hi_serial; /* highest serial number received */ + atomic_unchecked_t serial; /* packet serial number counter */ + atomic_unchecked_t hi_serial; /* highest serial number received */ u8 avail_calls; /* number of calls available */ u8 size_align; /* data size alignment (for security) */ u8 header_size; /* rxrpc + security header size */ @@ -348,7 +348,7 @@ struct rxrpc_call { spinlock_t lock; rwlock_t state_lock; /* lock for state transition */ atomic_t usage; - atomic_t sequence; /* Tx data packet sequence counter */ + atomic_unchecked_t sequence; /* Tx data packet sequence counter */ u32 abort_code; /* local/remote abort code */ enum { /* current state of call */ RXRPC_CALL_CLIENT_SEND_REQUEST, /* - client sending request phase */ @@ -433,7 +433,7 @@ static inline void rxrpc_abort_call(struct rxrpc_call *call, u32 abort_code) */ extern atomic_t rxrpc_n_skbs; extern __be32 rxrpc_epoch; -extern atomic_t rxrpc_debug_id; +extern atomic_unchecked_t rxrpc_debug_id; extern struct workqueue_struct *rxrpc_workqueue; /* diff --git a/net/rxrpc/ar-local.c b/net/rxrpc/ar-local.c index 78483b4..b1c0e1e 100644 --- a/net/rxrpc/ar-local.c +++ b/net/rxrpc/ar-local.c @@ -53,7 +53,7 @@ struct rxrpc_local *rxrpc_alloc_local(struct sockaddr_rxrpc *srx) spin_lock_init(&local->lock); rwlock_init(&local->services_lock); atomic_set(&local->usage, 1); - local->debug_id = atomic_inc_return(&rxrpc_debug_id); + local->debug_id = atomic_inc_return_unchecked(&rxrpc_debug_id); memcpy(&local->srx, srx, sizeof(*srx)); } diff --git a/net/rxrpc/ar-output.c b/net/rxrpc/ar-output.c index c004280..ab1ed5a 100644 --- a/net/rxrpc/ar-output.c +++ b/net/rxrpc/ar-output.c @@ -648,14 +648,14 @@ static int rxrpc_send_data(struct rxrpc_sock *rx, memset(skb_put(skb, pad), 0, pad); } - seq = atomic_inc_return(&call->sequence); + seq = atomic_inc_return_unchecked(&call->sequence); sp->hdr.epoch = conn->epoch; sp->hdr.cid = call->cid; sp->hdr.callNumber = call->call_id; sp->hdr.seq = htonl(seq); sp->hdr.serial = - htonl(atomic_inc_return(&conn->serial)); + htonl(atomic_inc_return_unchecked(&conn->serial)); sp->hdr.type = RXRPC_PACKET_TYPE_DATA; sp->hdr.userStatus = 0; sp->hdr.securityIndex = conn->security_ix; diff --git a/net/rxrpc/ar-peer.c b/net/rxrpc/ar-peer.c index bebaa43..2644591 100644 --- a/net/rxrpc/ar-peer.c +++ b/net/rxrpc/ar-peer.c @@ -72,7 +72,7 @@ static struct rxrpc_peer *rxrpc_alloc_peer(struct sockaddr_rxrpc *srx, INIT_LIST_HEAD(&peer->error_targets); spin_lock_init(&peer->lock); atomic_set(&peer->usage, 1); - peer->debug_id = atomic_inc_return(&rxrpc_debug_id); + peer->debug_id = atomic_inc_return_unchecked(&rxrpc_debug_id); memcpy(&peer->srx, srx, sizeof(*srx)); rxrpc_assess_MTU_size(peer); diff --git a/net/rxrpc/ar-proc.c b/net/rxrpc/ar-proc.c index 38047f7..9f48511 100644 --- a/net/rxrpc/ar-proc.c +++ b/net/rxrpc/ar-proc.c @@ -164,8 +164,8 @@ static int rxrpc_connection_seq_show(struct seq_file *seq, void *v) atomic_read(&conn->usage), rxrpc_conn_states[conn->state], key_serial(conn->key), - atomic_read(&conn->serial), - atomic_read(&conn->hi_serial)); + atomic_read_unchecked(&conn->serial), + atomic_read_unchecked(&conn->hi_serial)); return 0; } diff --git a/net/rxrpc/ar-transport.c b/net/rxrpc/ar-transport.c index 1976dec..aa70be5 100644 --- a/net/rxrpc/ar-transport.c +++ b/net/rxrpc/ar-transport.c @@ -51,7 +51,7 @@ static struct rxrpc_transport *rxrpc_alloc_transport(struct rxrpc_local *local, spin_lock_init(&trans->client_lock); rwlock_init(&trans->conn_lock); atomic_set(&trans->usage, 1); - trans->debug_id = atomic_inc_return(&rxrpc_debug_id); + trans->debug_id = atomic_inc_return_unchecked(&rxrpc_debug_id); if (peer->srx.transport.family == AF_INET) { switch (peer->srx.transport_type) { diff --git a/net/rxrpc/rxkad.c b/net/rxrpc/rxkad.c index f226709..0e735a8 100644 --- a/net/rxrpc/rxkad.c +++ b/net/rxrpc/rxkad.c @@ -610,7 +610,7 @@ static int rxkad_issue_challenge(struct rxrpc_connection *conn) len = iov[0].iov_len + iov[1].iov_len; - hdr.serial = htonl(atomic_inc_return(&conn->serial)); + hdr.serial = htonl(atomic_inc_return_unchecked(&conn->serial)); _proto("Tx CHALLENGE %%%u", ntohl(hdr.serial)); ret = kernel_sendmsg(conn->trans->local->socket, &msg, iov, 2, len); @@ -660,7 +660,7 @@ static int rxkad_send_response(struct rxrpc_connection *conn, len = iov[0].iov_len + iov[1].iov_len + iov[2].iov_len; - hdr->serial = htonl(atomic_inc_return(&conn->serial)); + hdr->serial = htonl(atomic_inc_return_unchecked(&conn->serial)); _proto("Tx RESPONSE %%%u", ntohl(hdr->serial)); ret = kernel_sendmsg(conn->trans->local->socket, &msg, iov, 3, len); diff --git a/net/sched/sch_generic.c b/net/sched/sch_generic.c index 6efca30..1259f82 100644 --- a/net/sched/sch_generic.c +++ b/net/sched/sch_generic.c @@ -349,7 +349,7 @@ void netif_carrier_on(struct net_device *dev) if (test_and_clear_bit(__LINK_STATE_NOCARRIER, &dev->state)) { if (dev->reg_state == NETREG_UNINITIALIZED) return; - atomic_inc(&dev->carrier_changes); + atomic_inc_unchecked(&dev->carrier_changes); linkwatch_fire_event(dev); if (netif_running(dev)) __netdev_watchdog_up(dev); @@ -368,7 +368,7 @@ void netif_carrier_off(struct net_device *dev) if (!test_and_set_bit(__LINK_STATE_NOCARRIER, &dev->state)) { if (dev->reg_state == NETREG_UNINITIALIZED) return; - atomic_inc(&dev->carrier_changes); + atomic_inc_unchecked(&dev->carrier_changes); linkwatch_fire_event(dev); } } diff --git a/net/sunrpc/auth_gss/svcauth_gss.c b/net/sunrpc/auth_gss/svcauth_gss.c index 1095be9..815d777 100644 --- a/net/sunrpc/auth_gss/svcauth_gss.c +++ b/net/sunrpc/auth_gss/svcauth_gss.c @@ -1142,7 +1142,7 @@ static int gss_proxy_save_rsc(struct cache_detail *cd, uint64_t *handle) { struct rsc rsci, *rscp = NULL; - static atomic64_t ctxhctr; + static atomic64_unchecked_t ctxhctr = ATOMIC64_INIT(0); long long ctxh; struct gss_api_mech *gm = NULL; time_t expiry; @@ -1153,7 +1153,7 @@ static int gss_proxy_save_rsc(struct cache_detail *cd, status = -ENOMEM; /* the handle needs to be just a unique id, * use a static counter */ - ctxh = atomic64_inc_return(&ctxhctr); + ctxh = atomic64_inc_return_unchecked(&ctxhctr); /* make a copy for the caller */ *handle = ctxh; diff --git a/net/sunrpc/sched.c b/net/sunrpc/sched.c index 337ca85..42feae8 100644 --- a/net/sunrpc/sched.c +++ b/net/sunrpc/sched.c @@ -261,9 +261,9 @@ static int rpc_wait_bit_killable(struct wait_bit_key *key) #if IS_ENABLED(CONFIG_SUNRPC_DEBUG) || IS_ENABLED(CONFIG_TRACEPOINTS) static void rpc_task_set_debuginfo(struct rpc_task *task) { - static atomic_t rpc_pid; + static atomic_unchecked_t rpc_pid; - task->tk_pid = atomic_inc_return(&rpc_pid); + task->tk_pid = atomic_inc_return_unchecked(&rpc_pid); } #else static inline void rpc_task_set_debuginfo(struct rpc_task *task) diff --git a/net/sunrpc/xprtrdma/svc_rdma.c b/net/sunrpc/xprtrdma/svc_rdma.c index 2cd252f..f606982 100644 --- a/net/sunrpc/xprtrdma/svc_rdma.c +++ b/net/sunrpc/xprtrdma/svc_rdma.c @@ -61,15 +61,15 @@ unsigned int svcrdma_max_req_size = RPCRDMA_MAX_REQ_SIZE; static unsigned int min_max_inline = 4096; static unsigned int max_max_inline = 65536; -atomic_t rdma_stat_recv; -atomic_t rdma_stat_read; -atomic_t rdma_stat_write; -atomic_t rdma_stat_sq_starve; -atomic_t rdma_stat_rq_starve; -atomic_t rdma_stat_rq_poll; -atomic_t rdma_stat_rq_prod; -atomic_t rdma_stat_sq_poll; -atomic_t rdma_stat_sq_prod; +atomic_unchecked_t rdma_stat_recv; +atomic_unchecked_t rdma_stat_read; +atomic_unchecked_t rdma_stat_write; +atomic_unchecked_t rdma_stat_sq_starve; +atomic_unchecked_t rdma_stat_rq_starve; +atomic_unchecked_t rdma_stat_rq_poll; +atomic_unchecked_t rdma_stat_rq_prod; +atomic_unchecked_t rdma_stat_sq_poll; +atomic_unchecked_t rdma_stat_sq_prod; /* Temporary NFS request map and context caches */ struct kmem_cache *svc_rdma_map_cachep; @@ -150,63 +150,63 @@ static struct ctl_table svcrdma_parm_table[] = { { .procname = "rdma_stat_read", .data = &rdma_stat_read, - .maxlen = sizeof(atomic_t), + .maxlen = sizeof(atomic_unchecked_t), .mode = 0644, .proc_handler = read_reset_stat, }, { .procname = "rdma_stat_recv", .data = &rdma_stat_recv, - .maxlen = sizeof(atomic_t), + .maxlen = sizeof(atomic_unchecked_t), .mode = 0644, .proc_handler = read_reset_stat, }, { .procname = "rdma_stat_write", .data = &rdma_stat_write, - .maxlen = sizeof(atomic_t), + .maxlen = sizeof(atomic_unchecked_t), .mode = 0644, .proc_handler = read_reset_stat, }, { .procname = "rdma_stat_sq_starve", .data = &rdma_stat_sq_starve, - .maxlen = sizeof(atomic_t), + .maxlen = sizeof(atomic_unchecked_t), .mode = 0644, .proc_handler = read_reset_stat, }, { .procname = "rdma_stat_rq_starve", .data = &rdma_stat_rq_starve, - .maxlen = sizeof(atomic_t), + .maxlen = sizeof(atomic_unchecked_t), .mode = 0644, .proc_handler = read_reset_stat, }, { .procname = "rdma_stat_rq_poll", .data = &rdma_stat_rq_poll, - .maxlen = sizeof(atomic_t), + .maxlen = sizeof(atomic_unchecked_t), .mode = 0644, .proc_handler = read_reset_stat, }, { .procname = "rdma_stat_rq_prod", .data = &rdma_stat_rq_prod, - .maxlen = sizeof(atomic_t), + .maxlen = sizeof(atomic_unchecked_t), .mode = 0644, .proc_handler = read_reset_stat, }, { .procname = "rdma_stat_sq_poll", .data = &rdma_stat_sq_poll, - .maxlen = sizeof(atomic_t), + .maxlen = sizeof(atomic_unchecked_t), .mode = 0644, .proc_handler = read_reset_stat, }, { .procname = "rdma_stat_sq_prod", .data = &rdma_stat_sq_prod, - .maxlen = sizeof(atomic_t), + .maxlen = sizeof(atomic_unchecked_t), .mode = 0644, .proc_handler = read_reset_stat, }, diff --git a/net/sunrpc/xprtrdma/svc_rdma_recvfrom.c b/net/sunrpc/xprtrdma/svc_rdma_recvfrom.c index 96d886a..35a2137 100644 --- a/net/sunrpc/xprtrdma/svc_rdma_recvfrom.c +++ b/net/sunrpc/xprtrdma/svc_rdma_recvfrom.c @@ -210,7 +210,7 @@ int rdma_read_chunk_lcl(struct svcxprt_rdma *xprt, *page_no = pg_no; *page_offset = pg_off; ret = read; - atomic_inc(&rdma_stat_read); + atomic_inc_unchecked(&rdma_stat_read); return ret; err: svc_rdma_unmap_dma(ctxt); @@ -347,7 +347,7 @@ int rdma_read_chunk_frmr(struct svcxprt_rdma *xprt, *page_no = pg_no; *page_offset = pg_off; ret = read; - atomic_inc(&rdma_stat_read); + atomic_inc_unchecked(&rdma_stat_read); return ret; err: svc_rdma_unmap_dma(ctxt); @@ -601,7 +601,7 @@ int svc_rdma_recvfrom(struct svc_rqst *rqstp) dto_q); list_del_init(&ctxt->dto_q); } else { - atomic_inc(&rdma_stat_rq_starve); + atomic_inc_unchecked(&rdma_stat_rq_starve); clear_bit(XPT_DATA, &xprt->xpt_flags); ctxt = NULL; } @@ -619,7 +619,7 @@ int svc_rdma_recvfrom(struct svc_rqst *rqstp) } dprintk("svcrdma: processing ctxt=%p on xprt=%p, rqstp=%p, status=%d\n", ctxt, rdma_xprt, rqstp, ctxt->wc_status); - atomic_inc(&rdma_stat_recv); + atomic_inc_unchecked(&rdma_stat_recv); /* Build up the XDR from the receive buffers. */ rdma_build_arg_xdr(rqstp, ctxt, ctxt->byte_len); diff --git a/net/sunrpc/xprtrdma/svc_rdma_sendto.c b/net/sunrpc/xprtrdma/svc_rdma_sendto.c index 95412ab..29e8f37 100644 --- a/net/sunrpc/xprtrdma/svc_rdma_sendto.c +++ b/net/sunrpc/xprtrdma/svc_rdma_sendto.c @@ -218,7 +218,7 @@ static int send_write(struct svcxprt_rdma *xprt, struct svc_rqst *rqstp, write_wr.wr.rdma.remote_addr = to; /* Post It */ - atomic_inc(&rdma_stat_write); + atomic_inc_unchecked(&rdma_stat_write); if (svc_rdma_send(xprt, &write_wr)) goto err; return write_len - bc; diff --git a/net/sunrpc/xprtrdma/svc_rdma_transport.c b/net/sunrpc/xprtrdma/svc_rdma_transport.c index 48f6de9..e89176b 100644 --- a/net/sunrpc/xprtrdma/svc_rdma_transport.c +++ b/net/sunrpc/xprtrdma/svc_rdma_transport.c @@ -288,7 +288,7 @@ static void rq_cq_reap(struct svcxprt_rdma *xprt) return; ib_req_notify_cq(xprt->sc_rq_cq, IB_CQ_NEXT_COMP); - atomic_inc(&rdma_stat_rq_poll); + atomic_inc_unchecked(&rdma_stat_rq_poll); while ((ret = ib_poll_cq(xprt->sc_rq_cq, 1, &wc)) > 0) { ctxt = (struct svc_rdma_op_ctxt *)(unsigned long)wc.wr_id; @@ -310,7 +310,7 @@ static void rq_cq_reap(struct svcxprt_rdma *xprt) } if (ctxt) - atomic_inc(&rdma_stat_rq_prod); + atomic_inc_unchecked(&rdma_stat_rq_prod); set_bit(XPT_DATA, &xprt->sc_xprt.xpt_flags); /* @@ -389,7 +389,7 @@ static void sq_cq_reap(struct svcxprt_rdma *xprt) return; ib_req_notify_cq(xprt->sc_sq_cq, IB_CQ_NEXT_COMP); - atomic_inc(&rdma_stat_sq_poll); + atomic_inc_unchecked(&rdma_stat_sq_poll); while ((ret = ib_poll_cq(cq, ARRAY_SIZE(wc_a), wc_a)) > 0) { int i; @@ -418,7 +418,7 @@ static void sq_cq_reap(struct svcxprt_rdma *xprt) } if (ctxt) - atomic_inc(&rdma_stat_sq_prod); + atomic_inc_unchecked(&rdma_stat_sq_prod); } static void sq_comp_handler(struct ib_cq *cq, void *cq_context) @@ -1254,7 +1254,7 @@ int svc_rdma_send(struct svcxprt_rdma *xprt, struct ib_send_wr *wr) spin_lock_bh(&xprt->sc_lock); if (xprt->sc_sq_depth < atomic_read(&xprt->sc_sq_count) + wr_count) { spin_unlock_bh(&xprt->sc_lock); - atomic_inc(&rdma_stat_sq_starve); + atomic_inc_unchecked(&rdma_stat_sq_starve); /* See if we can opportunistically reap SQ WR to make room */ sq_cq_reap(xprt); diff --git a/net/xfrm/xfrm_policy.c b/net/xfrm/xfrm_policy.c index 18cead7..3ecb199 100644 --- a/net/xfrm/xfrm_policy.c +++ b/net/xfrm/xfrm_policy.c @@ -323,7 +323,7 @@ static void xfrm_policy_kill(struct xfrm_policy *policy) { policy->walk.dead = 1; - atomic_inc(&policy->genid); + atomic_inc_unchecked(&policy->genid); if (del_timer(&policy->polq.hold_timer)) xfrm_pol_put(policy); @@ -773,7 +773,7 @@ int xfrm_policy_insert(int dir, struct xfrm_policy *policy, int excl) else hlist_add_head(&policy->bydst, chain); __xfrm_policy_link(policy, dir); - atomic_inc(&net->xfrm.flow_cache_genid); + atomic_inc_unchecked(&net->xfrm.flow_cache_genid); /* After previous checking, family can either be AF_INET or AF_INET6 */ if (policy->family == AF_INET) @@ -1874,7 +1874,7 @@ xfrm_resolve_and_create_bundle(struct xfrm_policy **pols, int num_pols, xdst->num_pols = num_pols; memcpy(xdst->pols, pols, sizeof(struct xfrm_policy *) * num_pols); - xdst->policy_genid = atomic_read(&pols[0]->genid); + xdst->policy_genid = atomic_read_unchecked(&pols[0]->genid); return xdst; } @@ -2740,7 +2740,7 @@ static int xfrm_bundle_ok(struct xfrm_dst *first) if (xdst->xfrm_genid != dst->xfrm->genid) return 0; if (xdst->num_pols > 0 && - xdst->policy_genid != atomic_read(&xdst->pols[0]->genid)) + xdst->policy_genid != atomic_read_unchecked(&xdst->pols[0]->genid)) return 0; mtu = dst_mtu(dst->child); @@ -3281,7 +3281,7 @@ static int xfrm_policy_migrate(struct xfrm_policy *pol, sizeof(pol->xfrm_vec[i].saddr)); pol->xfrm_vec[i].encap_family = mp->new_family; /* flush bundles */ - atomic_inc(&pol->genid); + atomic_inc_unchecked(&pol->genid); } } diff --git a/net/xfrm/xfrm_state.c b/net/xfrm/xfrm_state.c index 9895a8c..2908c63 100644 --- a/net/xfrm/xfrm_state.c +++ b/net/xfrm/xfrm_state.c @@ -1505,10 +1505,10 @@ EXPORT_SYMBOL(xfrm_find_acq_byseq); u32 xfrm_get_acqseq(void) { u32 res; - static atomic_t acqseq; + static atomic_unchecked_t acqseq; do { - res = atomic_inc_return(&acqseq); + res = atomic_inc_return_unchecked(&acqseq); } while (!res); return res; -- 2.5.0
Powered by blists - more mailing lists
Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.