Skip to content

Commit 434d305

Browse files
Florian Westphaldavem330
authored andcommitted
inet: frag: don't account number of fragment queues
The 'nqueues' counter is protected by the lru list lock, once thats removed this needs to be converted to atomic counter. Given this isn't used for anything except for reporting it to userspace via /proc, just remove it. We still report the memory currently used by fragment reassembly queues. Signed-off-by: Florian Westphal <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent b13d3cb commit 434d305

File tree

7 files changed

+5
-19
lines changed

7 files changed

+5
-19
lines changed

include/net/inet_frag.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
#include <linux/percpu_counter.h>
55

66
struct netns_frags {
7-
int nqueues;
87
struct list_head lru_list;
98
spinlock_t lru_lock;
109

@@ -158,7 +157,6 @@ static inline void inet_frag_lru_del(struct inet_frag_queue *q)
158157
{
159158
spin_lock(&q->net->lru_lock);
160159
list_del_init(&q->lru_list);
161-
q->net->nqueues--;
162160
spin_unlock(&q->net->lru_lock);
163161
}
164162

@@ -167,7 +165,6 @@ static inline void inet_frag_lru_add(struct netns_frags *nf,
167165
{
168166
spin_lock(&nf->lru_lock);
169167
list_add_tail(&q->lru_list, &nf->lru_list);
170-
q->net->nqueues++;
171168
spin_unlock(&nf->lru_lock);
172169
}
173170

include/net/ip.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -495,7 +495,6 @@ static inline struct sk_buff *ip_check_defrag(struct sk_buff *skb, u32 user)
495495
}
496496
#endif
497497
int ip_frag_mem(struct net *net);
498-
int ip_frag_nqueues(struct net *net);
499498

500499
/*
501500
* Functions provided by ip_forward.c

include/net/ipv6.h

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -299,11 +299,6 @@ static inline bool ipv6_accept_ra(struct inet6_dev *idev)
299299
}
300300

301301
#if IS_ENABLED(CONFIG_IPV6)
302-
static inline int ip6_frag_nqueues(struct net *net)
303-
{
304-
return net->ipv6.frags.nqueues;
305-
}
306-
307302
static inline int ip6_frag_mem(struct net *net)
308303
{
309304
return sum_frag_mem_limit(&net->ipv6.frags);

net/ipv4/inet_fragment.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,6 @@ EXPORT_SYMBOL(inet_frags_init);
193193

194194
void inet_frags_init_net(struct netns_frags *nf)
195195
{
196-
nf->nqueues = 0;
197196
init_frag_mem_limit(nf);
198197
INIT_LIST_HEAD(&nf->lru_list);
199198
spin_lock_init(&nf->lru_lock);

net/ipv4/ip_fragment.c

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -86,11 +86,6 @@ static inline u8 ip4_frag_ecn(u8 tos)
8686

8787
static struct inet_frags ip4_frags;
8888

89-
int ip_frag_nqueues(struct net *net)
90-
{
91-
return net->ipv4.frags.nqueues;
92-
}
93-
9489
int ip_frag_mem(struct net *net)
9590
{
9691
return sum_frag_mem_limit(&net->ipv4.frags);

net/ipv4/proc.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@
5252
static int sockstat_seq_show(struct seq_file *seq, void *v)
5353
{
5454
struct net *net = seq->private;
55+
unsigned int frag_mem;
5556
int orphans, sockets;
5657

5758
local_bh_disable();
@@ -71,8 +72,8 @@ static int sockstat_seq_show(struct seq_file *seq, void *v)
7172
sock_prot_inuse_get(net, &udplite_prot));
7273
seq_printf(seq, "RAW: inuse %d\n",
7374
sock_prot_inuse_get(net, &raw_prot));
74-
seq_printf(seq, "FRAG: inuse %d memory %d\n",
75-
ip_frag_nqueues(net), ip_frag_mem(net));
75+
frag_mem = ip_frag_mem(net);
76+
seq_printf(seq, "FRAG: inuse %u memory %u\n", !!frag_mem, frag_mem);
7677
return 0;
7778
}
7879

net/ipv6/proc.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
static int sockstat6_seq_show(struct seq_file *seq, void *v)
3434
{
3535
struct net *net = seq->private;
36+
unsigned int frag_mem = ip6_frag_mem(net);
3637

3738
seq_printf(seq, "TCP6: inuse %d\n",
3839
sock_prot_inuse_get(net, &tcpv6_prot));
@@ -42,8 +43,7 @@ static int sockstat6_seq_show(struct seq_file *seq, void *v)
4243
sock_prot_inuse_get(net, &udplitev6_prot));
4344
seq_printf(seq, "RAW6: inuse %d\n",
4445
sock_prot_inuse_get(net, &rawv6_prot));
45-
seq_printf(seq, "FRAG6: inuse %d memory %d\n",
46-
ip6_frag_nqueues(net), ip6_frag_mem(net));
46+
seq_printf(seq, "FRAG6: inuse %u memory %u\n", !!frag_mem, frag_mem);
4747
return 0;
4848
}
4949

0 commit comments

Comments
 (0)