]> git.pld-linux.org Git - packages/kernel.git/blame - kernel-2.6.8.1-sch_api.patch
- obsolete
[packages/kernel.git] / kernel-2.6.8.1-sch_api.patch
CommitLineData
9d8fb977 1
2# This is a BitKeeper generated diff -Nru style patch.
3#
4# ChangeSet
5# 2004/08/15 18:08:13+02:00 kaber@xxxxxxxxxxxx
6# [PKT_SCHED]: cacheline-align qdisc data in qdisc_create()
7#
8# Signed-off-by: Patrick McHardy <kaber@xxxxxxxxx>
9#
10# net/sched/sch_api.c
11# 2004/08/15 18:04:27+02:00 kaber@xxxxxxxxxxxx +13 -8
12# [PKT_SCHED]: cacheline-align qdisc data in qdisc_create()
13#
14diff -Nru a/net/sched/sch_api.c b/net/sched/sch_api.c
15--- a/net/sched/sch_api.c 2004-08-15 18:09:36 +02:00
16+++ b/net/sched/sch_api.c 2004-08-15 18:09:36 +02:00
17@@ -389,7 +389,8 @@
18 {
19 int err;
20 struct rtattr *kind = tca[TCA_KIND-1];
21- struct Qdisc *sch = NULL;
22+ void *p = NULL;
23+ struct Qdisc *sch;
24 struct Qdisc_ops *ops;
25 int size;
26
27@@ -407,12 +408,18 @@
28 if (ops == NULL)
29 goto err_out;
30
31- size = sizeof(*sch) + ops->priv_size;
32+ /* ensure that the Qdisc and the private data are 32-byte aligned */
33+ size = ((sizeof(*sch) + QDISC_ALIGN_CONST) & ~QDISC_ALIGN_CONST);
34+ size += ops->priv_size + QDISC_ALIGN_CONST;
35
36- sch = kmalloc(size, GFP_KERNEL);
37+ p = kmalloc(size, GFP_KERNEL);
38 err = -ENOBUFS;
39- if (!sch)
40+ if (!p)
41 goto err_out;
42+ memset(p, 0, size);
43+ sch = (struct Qdisc *)(((unsigned long)p + QDISC_ALIGN_CONST)
44+ & ~QDISC_ALIGN_CONST);
45+ sch->padded = (char *)sch - (char *)p;
46
47 /* Grrr... Resolve race condition with module unload */
48
49@@ -420,8 +427,6 @@
50 if (ops != qdisc_lookup_ops(kind))
51 goto err_out;
52
53- memset(sch, 0, size);
54-
55 INIT_LIST_HEAD(&sch->list);
56 skb_queue_head_init(&sch->q);
57
58@@ -470,8 +475,8 @@
59
60 err_out:
61 *errp = err;
62- if (sch)
63- kfree(sch);
64+ if (p)
65+ kfree(p);
66 return NULL;
67 }
68
This page took 0.141678 seconds and 4 git commands to generate.