diff mbox

net: sched: fix missing free per cpu on qstats

Message ID 20160105171136.9063.98710.stgit@john-Precision-Tower-5810
State Accepted, archived
Delegated to: David Miller
Headers show

Commit Message

John Fastabend Jan. 5, 2016, 5:11 p.m. UTC
When a qdisc is using per cpu stats (currently just the ingress
qdisc) only the bstats are being freed. This also free's the qstats.

Signed-off-by: John Fastabend <john.r.fastabend@intel.com>
---
 net/sched/sch_generic.c |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)


--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Comments

Eric Dumazet Jan. 5, 2016, 5:44 p.m. UTC | #1
On Tue, 2016-01-05 at 09:11 -0800, John Fastabend wrote:
> When a qdisc is using per cpu stats (currently just the ingress
> qdisc) only the bstats are being freed. This also free's the qstats.
> 
> Signed-off-by: John Fastabend <john.r.fastabend@intel.com>
> ---

Acked-by: Eric Dumazet <edumazet@google.com>

David, please add the following tag to ease backports to stable kernels:

Fixes: 22e0f8b9322cb ("net: sched: make bstats per cpu and estimator RCU safe")

Thanks !


--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Daniel Borkmann Jan. 5, 2016, 6 p.m. UTC | #2
On 01/05/2016 06:11 PM, John Fastabend wrote:
> When a qdisc is using per cpu stats (currently just the ingress
> qdisc) only the bstats are being freed. This also free's the qstats.
>
> Signed-off-by: John Fastabend <john.r.fastabend@intel.com>

Acked-by: Daniel Borkmann <daniel@iogearbox.net>
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
David Miller Jan. 5, 2016, 7:14 p.m. UTC | #3
From: Eric Dumazet <eric.dumazet@gmail.com>
Date: Tue, 05 Jan 2016 09:44:11 -0800

> David, please add the following tag to ease backports to stable kernels:
> 
> Fixes: 22e0f8b9322cb ("net: sched: make bstats per cpu and estimator RCU safe")

Ok, will do, thanks!
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Cong Wang Jan. 6, 2016, 2:49 a.m. UTC | #4
On Tue, Jan 5, 2016 at 9:44 AM, Eric Dumazet <eric.dumazet@gmail.com> wrote:
> On Tue, 2016-01-05 at 09:11 -0800, John Fastabend wrote:
>> When a qdisc is using per cpu stats (currently just the ingress
>> qdisc) only the bstats are being freed. This also free's the qstats.
>>
>> Signed-off-by: John Fastabend <john.r.fastabend@intel.com>
>> ---
>
> Acked-by: Eric Dumazet <edumazet@google.com>
>
> David, please add the following tag to ease backports to stable kernels:
>
> Fixes: 22e0f8b9322cb ("net: sched: make bstats per cpu and estimator RCU safe")
>

Not a big deal at all but... doesn't that fix commit b0ab6f92752b9f9d8
instead of 22e0f8b9322cb?
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Eric Dumazet Jan. 6, 2016, 3:07 a.m. UTC | #5
On Tue, 2016-01-05 at 18:49 -0800, Cong Wang wrote:
> On Tue, Jan 5, 2016 at 9:44 AM, Eric Dumazet <eric.dumazet@gmail.com> wrote:
> > On Tue, 2016-01-05 at 09:11 -0800, John Fastabend wrote:
> >> When a qdisc is using per cpu stats (currently just the ingress
> >> qdisc) only the bstats are being freed. This also free's the qstats.
> >>
> >> Signed-off-by: John Fastabend <john.r.fastabend@intel.com>
> >> ---
> >
> > Acked-by: Eric Dumazet <edumazet@google.com>
> >
> > David, please add the following tag to ease backports to stable kernels:
> >
> > Fixes: 22e0f8b9322cb ("net: sched: make bstats per cpu and estimator RCU safe")
> >
> 
> Not a big deal at all but... doesn't that fix commit b0ab6f92752b9f9d8
> instead of 22e0f8b9322cb?

Hmmm... you may be right. Both were added in 3.18.

My search was based on commit adding qdisc_is_percpu_stats()



--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
David Miller Jan. 6, 2016, 6:41 a.m. UTC | #6
From: Eric Dumazet <eric.dumazet@gmail.com>
Date: Tue, 05 Jan 2016 19:07:49 -0800

> On Tue, 2016-01-05 at 18:49 -0800, Cong Wang wrote:
>> On Tue, Jan 5, 2016 at 9:44 AM, Eric Dumazet <eric.dumazet@gmail.com> wrote:
>> > On Tue, 2016-01-05 at 09:11 -0800, John Fastabend wrote:
>> >> When a qdisc is using per cpu stats (currently just the ingress
>> >> qdisc) only the bstats are being freed. This also free's the qstats.
>> >>
>> >> Signed-off-by: John Fastabend <john.r.fastabend@intel.com>
>> >> ---
>> >
>> > Acked-by: Eric Dumazet <edumazet@google.com>
>> >
>> > David, please add the following tag to ease backports to stable kernels:
>> >
>> > Fixes: 22e0f8b9322cb ("net: sched: make bstats per cpu and estimator RCU safe")
>> >
>> 
>> Not a big deal at all but... doesn't that fix commit b0ab6f92752b9f9d8
>> instead of 22e0f8b9322cb?
> 
> Hmmm... you may be right. Both were added in 3.18.
> 
> My search was based on commit adding qdisc_is_percpu_stats()

The right commit looks to be b0ab6f92752b9f9d8, so that's what I've
used in the Fixes: tag.

Applied and queued up for -stable, thanks!
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/net/sched/sch_generic.c b/net/sched/sch_generic.c
index e82a1ad..16bc83b 100644
--- a/net/sched/sch_generic.c
+++ b/net/sched/sch_generic.c
@@ -658,8 +658,10 @@  static void qdisc_rcu_free(struct rcu_head *head)
 {
 	struct Qdisc *qdisc = container_of(head, struct Qdisc, rcu_head);
 
-	if (qdisc_is_percpu_stats(qdisc))
+	if (qdisc_is_percpu_stats(qdisc)) {
 		free_percpu(qdisc->cpu_bstats);
+		free_percpu(qdisc->cpu_qstats);
+	}
 
 	kfree((char *) qdisc - qdisc->padded);
 }