Subject: Re: [net-next PATCH 2/3] net: fix enforcing of fragment queue hash list depth

From: Jesper Dangaard Brouer <[email-masked]>
Date: Mon, 22 Apr 2013 18:30:17 +0200

On Mon, 2013-04-22 at 16:54 +0200, Hannes Frederic Sowa wrote:
> On Mon, Apr 22, 2013 at 11:10:34AM +0200, Jesper Dangaard Brouer wrote:
[...]
> > Besides, after we have implemented per hash bucket locking (in my change
> > commit 19952cc4 "net: frag queue per hash bucket locking").
> > Then, I don't think it is a big problem that a single hash bucket is
> > being "attacked".
> 
> I don't know, I wouldn't say so. The contention point is now the per
> hash bucket lock but it should show the same symptoms as before.

No, the contention point is the LRU list lock, not the hash bucket lock.
If you perf record/profile the code, you can easily miss that its the
LRU lock, because its inlined.  Try to rerun your tests with noinline
e.g.:

diff --git a/include/net/inet_frag.h b/include/net/inet_frag.h
index 6f41b45..9963b87 100644
--- a/include/net/inet_frag.h
+++ b/include/net/inet_frag.h
@@ -138,14 +138,14 @@ static inline int sum_frag_mem_limit(struct
netns_frags *n
        return res;
 }
 
-static inline void inet_frag_lru_move(struct inet_frag_queue *q)
+static noinline void inet_frag_lru_move(struct inet_frag_queue *q)
 {
        spin_lock(&q->net->lru_lock);
        list_move_tail(&q->lru_list, &q->net->lru_list);
        spin_unlock(&q->net->lru_lock);
 }
 
-static inline void inet_frag_lru_del(struct inet_frag_queue *q)
+static noinline void inet_frag_lru_del(struct inet_frag_queue *q)
 {
        spin_lock(&q->net->lru_lock);
        list_del(&q->lru_list);
@@ -153,7 +153,7 @@ static inline void inet_frag_lru_del(struct
inet_frag_queue 
        spin_unlock(&q->net->lru_lock);
 }
 
-static inline void inet_frag_lru_add(struct netns_frags *nf,
+static noinline void inet_frag_lru_add(struct netns_frags *nf,
                                     struct inet_frag_queue *q)
 {
        spin_lock(&nf->lru_lock);