Skip to content

Commit

Permalink
net/sched: add net device refcount tracker to struct Qdisc
Browse files Browse the repository at this point in the history
Signed-off-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
  • Loading branch information
Eric Dumazet authored and Jakub Kicinski committed Dec 7, 2021
1 parent c04438f commit 606509f
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion include/net/sch_generic.h
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ struct Qdisc {
spinlock_t seqlock;

struct rcu_head rcu;

netdevice_tracker dev_tracker;
/* private data */
long privdata[] ____cacheline_aligned;
};
Expand Down
4 changes: 2 additions & 2 deletions net/sched/sch_generic.c
Original file line number Diff line number Diff line change
Expand Up @@ -973,7 +973,7 @@ struct Qdisc *qdisc_alloc(struct netdev_queue *dev_queue,
sch->enqueue = ops->enqueue;
sch->dequeue = ops->dequeue;
sch->dev_queue = dev_queue;
dev_hold(dev);
dev_hold_track(dev, &sch->dev_tracker, GFP_KERNEL);
refcount_set(&sch->refcnt, 1);

return sch;
Expand Down Expand Up @@ -1073,7 +1073,7 @@ static void qdisc_destroy(struct Qdisc *qdisc)
ops->destroy(qdisc);

module_put(ops->owner);
dev_put(qdisc_dev(qdisc));
dev_put_track(qdisc_dev(qdisc), &qdisc->dev_tracker);

trace_qdisc_destroy(qdisc);

Expand Down

0 comments on commit 606509f

Please sign in to comment.