From: Pranith Kumar <bobby.prani@gmail.com>
To: "David S. Miller" <davem@davemloft.net>,
David Howells <dhowells@redhat.com>,
Dan Carpenter <dan.carpenter@oracle.com>,
netdev@vger.kernel.org (open list:NETWORKING [GENERAL]),
linux-kernel@vger.kernel.org (open list)
Cc: paulmck@linux.vnet.ibm.com
Subject: [PATCH 16/16] rxrpc: Replace smp_read_barrier_depends() with lockless_dereference()
Date: Thu, 13 Nov 2014 14:24:22 -0500 [thread overview]
Message-ID: <1415906662-4576-17-git-send-email-bobby.prani@gmail.com> (raw)
In-Reply-To: <1415906662-4576-1-git-send-email-bobby.prani@gmail.com>
Recently lockless_dereference() was added which can be used in place of
hard-coding smp_read_barrier_depends(). The following PATCH makes the change.
Signed-off-by: Pranith Kumar <bobby.prani@gmail.com>
---
net/rxrpc/ar-ack.c | 22 +++++++++-------------
1 file changed, 9 insertions(+), 13 deletions(-)
diff --git a/net/rxrpc/ar-ack.c b/net/rxrpc/ar-ack.c
index c6be17a..9237448 100644
--- a/net/rxrpc/ar-ack.c
+++ b/net/rxrpc/ar-ack.c
@@ -234,8 +234,7 @@ static void rxrpc_resend(struct rxrpc_call *call)
loop != call->acks_head || stop;
loop = (loop + 1) & (call->acks_winsz - 1)
) {
- p_txb = call->acks_window + loop;
- smp_read_barrier_depends();
+ p_txb = lockless_dereference(call)->acks_window + loop;
if (*p_txb & 1)
continue;
@@ -303,8 +302,7 @@ static void rxrpc_resend_timer(struct rxrpc_call *call)
loop != call->acks_head;
loop = (loop + 1) & (call->acks_winsz - 1)
) {
- p_txb = call->acks_window + loop;
- smp_read_barrier_depends();
+ p_txb = lockless_dereference(call)->acks_window + loop;
txb = (struct sk_buff *) (*p_txb & ~1);
sp = rxrpc_skb(txb);
@@ -354,9 +352,10 @@ static int rxrpc_process_soft_ACKs(struct rxrpc_call *call,
resend = 0;
resend_at = 0;
for (loop = 0; loop < ack->nAcks; loop++) {
- p_txb = call->acks_window;
- p_txb += (call->acks_tail + loop) & (call->acks_winsz - 1);
- smp_read_barrier_depends();
+ struct rxrpc_call *callp = lockless_dereference(call);
+
+ p_txb = callp->acks_window;
+ p_txb += (callp->acks_tail + loop) & (callp->acks_winsz - 1);
txb = (struct sk_buff *) (*p_txb & ~1);
sp = rxrpc_skb(txb);
@@ -385,8 +384,7 @@ static int rxrpc_process_soft_ACKs(struct rxrpc_call *call,
loop != call->acks_head;
loop = (loop + 1) & (call->acks_winsz - 1)
) {
- p_txb = call->acks_window + loop;
- smp_read_barrier_depends();
+ p_txb = lockless_dereference(call)->acks_window + loop;
txb = (struct sk_buff *) (*p_txb & ~1);
sp = rxrpc_skb(txb);
@@ -432,8 +430,7 @@ static void rxrpc_rotate_tx_window(struct rxrpc_call *call, u32 hard)
ASSERTCMP(hard - call->acks_hard, <=, win);
while (call->acks_hard < hard) {
- smp_read_barrier_depends();
- _skb = call->acks_window[tail] & ~1;
+ _skb = lockless_dereference(call)->acks_window[tail] & ~1;
rxrpc_free_skb((struct sk_buff *) _skb);
old_tail = tail;
tail = (tail + 1) & (call->acks_winsz - 1);
@@ -577,8 +574,7 @@ static void rxrpc_zap_tx_window(struct rxrpc_call *call)
call->acks_window = NULL;
while (CIRC_CNT(call->acks_head, call->acks_tail, winsz) > 0) {
- tail = call->acks_tail;
- smp_read_barrier_depends();
+ tail = lockless_dereference(call)->acks_tail;
_skb = acks_window[tail] & ~1;
smp_mb();
call->acks_tail = (call->acks_tail + 1) & (winsz - 1);
--
1.9.1
next prev parent reply other threads:[~2014-11-13 19:24 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <1415906662-4576-1-git-send-email-bobby.prani@gmail.com>
2014-11-13 19:24 ` [PATCH 15/16] netfilter: Replace smp_read_barrier_depends() with lockless_dereference() Pranith Kumar
2014-11-13 19:24 ` Pranith Kumar [this message]
2014-11-13 20:17 ` [PATCH 16/16] rxrpc: " David Howells
2014-11-13 20:47 ` David Howells
2014-11-13 21:55 ` Pranith Kumar
2014-11-13 23:07 ` David Howells
2014-11-13 20:07 ` [RFC PATCH 00/16] Replace smp_read_barrier_depends() with lockless_derefrence() Paul E. McKenney
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=1415906662-4576-17-git-send-email-bobby.prani@gmail.com \
--to=bobby.prani@gmail.com \
--cc=dan.carpenter@oracle.com \
--cc=davem@davemloft.net \
--cc=dhowells@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=paulmck@linux.vnet.ibm.com \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).