Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 193909
b: refs/heads/master
c: 5d944c6
h: refs/heads/master
i:
  193907: 2648ac9
v: v3
  • Loading branch information
Eric Dumazet authored and David S. Miller committed Apr 2, 2010
1 parent 68c3dd3 commit 111a974
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 4 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: d4fc6dbb5ae51430e35b2005f6d68938861f8d8b
refs/heads/master: 5d944c640b4ae5f37c537acf491c2f0eb89fa0d6
2 changes: 1 addition & 1 deletion trunk/include/net/pkt_sched.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ struct qdisc_walker {
int (*fn)(struct Qdisc *, unsigned long cl, struct qdisc_walker *);
};

#define QDISC_ALIGNTO 32
#define QDISC_ALIGNTO 64
#define QDISC_ALIGN(len) (((len) + QDISC_ALIGNTO-1) & ~(QDISC_ALIGNTO-1))

static inline void *qdisc_priv(struct Qdisc *q)
Expand Down
1 change: 1 addition & 0 deletions trunk/include/net/sch_generic.h
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ struct Qdisc {
struct sk_buff_head q;
struct gnet_stats_basic_packed bstats;
struct gnet_stats_queue qstats;
struct rcu_head rcu_head;
};

struct Qdisc_class_ops {
Expand Down
15 changes: 13 additions & 2 deletions trunk/net/sched/sch_generic.c
Original file line number Diff line number Diff line change
Expand Up @@ -528,7 +528,7 @@ struct Qdisc *qdisc_alloc(struct netdev_queue *dev_queue,
unsigned int size;
int err = -ENOBUFS;

/* ensure that the Qdisc and the private data are 32-byte aligned */
/* ensure that the Qdisc and the private data are 64-byte aligned */
size = QDISC_ALIGN(sizeof(*sch));
size += ops->priv_size + (QDISC_ALIGNTO - 1);

Expand Down Expand Up @@ -590,6 +590,13 @@ void qdisc_reset(struct Qdisc *qdisc)
}
EXPORT_SYMBOL(qdisc_reset);

static void qdisc_rcu_free(struct rcu_head *head)
{
struct Qdisc *qdisc = container_of(head, struct Qdisc, rcu_head);

kfree((char *) qdisc - qdisc->padded);
}

void qdisc_destroy(struct Qdisc *qdisc)
{
const struct Qdisc_ops *ops = qdisc->ops;
Expand All @@ -613,7 +620,11 @@ void qdisc_destroy(struct Qdisc *qdisc)
dev_put(qdisc_dev(qdisc));

kfree_skb(qdisc->gso_skb);
kfree((char *) qdisc - qdisc->padded);
/*
* gen_estimator est_timer() might access qdisc->q.lock,
* wait a RCU grace period before freeing qdisc.
*/
call_rcu(&qdisc->rcu_head, qdisc_rcu_free);
}
EXPORT_SYMBOL(qdisc_destroy);

Expand Down

0 comments on commit 111a974

Please sign in to comment.