From: Jesper Dangaard Brouer <brouer@redhat.com>
To: Eric Dumazet <eric.dumazet@gmail.com>,
"David S. Miller" <davem@davemloft.net>
Cc: Jesper Dangaard Brouer <brouer@redhat.com>,
netdev@vger.kernel.org, Florian Westphal <fw@strlen.de>,
Daniel Borkmann <dborkman@redhat.com>,
Hannes Frederic Sowa <hannes@stressinduktion.org>
Subject: [net-next PATCH 2/3] net: use the frag lru_lock to protect netns_frags.nqueues update
Date: Wed, 27 Mar 2013 16:55:56 +0100 [thread overview]
Message-ID: <20130327155530.15203.45784.stgit@dragon> (raw)
In-Reply-To: <20130327155238.15203.6688.stgit@dragon>
Move the protection of netns_frags.nqueues updates under the LRU_lock,
instead of the write lock. As they are located on the same cacheline,
and this is also needed when transitioning to use per hash bucket locking.
Signed-off-by: Jesper Dangaard Brouer <brouer@redhat.com>
---
include/net/inet_frag.h | 2 ++
net/ipv4/inet_fragment.c | 2 --
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/include/net/inet_frag.h b/include/net/inet_frag.h
index 64b4e7d..7cac9c5 100644
--- a/include/net/inet_frag.h
+++ b/include/net/inet_frag.h
@@ -143,6 +143,7 @@ static inline void inet_frag_lru_del(struct inet_frag_queue *q)
{
spin_lock(&q->net->lru_lock);
list_del(&q->lru_list);
+ q->net->nqueues--;
spin_unlock(&q->net->lru_lock);
}
@@ -151,6 +152,7 @@ static inline void inet_frag_lru_add(struct netns_frags *nf,
{
spin_lock(&nf->lru_lock);
list_add_tail(&q->lru_list, &nf->lru_list);
+ q->net->nqueues++;
spin_unlock(&nf->lru_lock);
}
diff --git a/net/ipv4/inet_fragment.c b/net/ipv4/inet_fragment.c
index 8ba548a..1206ca6 100644
--- a/net/ipv4/inet_fragment.c
+++ b/net/ipv4/inet_fragment.c
@@ -124,7 +124,6 @@ static inline void fq_unlink(struct inet_frag_queue *fq, struct inet_frags *f)
{
write_lock(&f->lock);
hlist_del(&fq->list);
- fq->net->nqueues--;
write_unlock(&f->lock);
inet_frag_lru_del(fq);
}
@@ -260,7 +259,6 @@ static struct inet_frag_queue *inet_frag_intern(struct netns_frags *nf,
atomic_inc(&qp->refcnt);
hlist_add_head(&qp->list, &f->hash[hash]);
- nf->nqueues++;
write_unlock(&f->lock);
inet_frag_lru_add(nf, qp);
return qp;
next prev parent reply other threads:[~2013-03-27 15:56 UTC|newest]
Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-03-27 15:54 [net-next PATCH 0/3] net: frag performance followup Jesper Dangaard Brouer
2013-03-27 15:55 ` [net-next PATCH 1/3] net: frag, avoid several CPUs grabbing same frag queue during LRU evictor loop Jesper Dangaard Brouer
2013-03-27 16:14 ` Eric Dumazet
2013-03-27 17:10 ` David Miller
2013-03-27 15:55 ` Jesper Dangaard Brouer [this message]
2013-03-27 16:21 ` [net-next PATCH 2/3] net: use the frag lru_lock to protect netns_frags.nqueues update Eric Dumazet
2013-03-27 17:10 ` David Miller
2013-03-27 15:56 ` [net-next PATCH 3/3] net: frag queue per hash bucket locking Jesper Dangaard Brouer
2013-03-27 17:25 ` Eric Dumazet
2013-03-28 18:57 ` Hannes Frederic Sowa
2013-03-28 19:03 ` David Miller
2013-03-28 19:10 ` Hannes Frederic Sowa
2013-03-28 19:19 ` David Miller
2013-03-28 20:22 ` Eric Dumazet
2013-03-28 23:30 ` Hannes Frederic Sowa
2013-03-28 23:39 ` Eric Dumazet
2013-03-29 0:33 ` Hannes Frederic Sowa
2013-03-29 19:01 ` Jesper Dangaard Brouer
2013-03-29 19:05 ` Eric Dumazet
2013-03-29 19:22 ` David Miller
2013-04-02 15:23 ` Jesper Dangaard Brouer
2013-04-03 22:11 ` Jesper Dangaard Brouer
2013-04-04 7:52 ` [net-next PATCH V2] " Jesper Dangaard Brouer
2013-04-04 9:03 ` Hannes Frederic Sowa
2013-04-04 9:27 ` Jesper Dangaard Brouer
2013-04-04 9:38 ` [net-next PATCH V3] " Jesper Dangaard Brouer
2013-04-04 9:58 ` Hannes Frederic Sowa
2013-04-04 16:24 ` Eric Dumazet
2013-04-04 21:38 ` David Miller
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=20130327155530.15203.45784.stgit@dragon \
--to=brouer@redhat.com \
--cc=davem@davemloft.net \
--cc=dborkman@redhat.com \
--cc=eric.dumazet@gmail.com \
--cc=fw@strlen.de \
--cc=hannes@stressinduktion.org \
--cc=netdev@vger.kernel.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 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).