Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
L
linux
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
linux
Commits
fdfb8047
Commit
fdfb8047
authored
Mar 02, 2003
by
Mala Anand
Committed by
David S. Miller
Mar 02, 2003
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[NET]: Move SKB header init to allocation time for better cache behavior.
parent
19e8c107
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
31 additions
and
43 deletions
+31
-43
net/core/skbuff.c
net/core/skbuff.c
+31
-43
No files found.
net/core/skbuff.c
View file @
fdfb8047
...
@@ -196,40 +196,6 @@ struct sk_buff *alloc_skb(unsigned int size, int gfp_mask)
...
@@ -196,40 +196,6 @@ struct sk_buff *alloc_skb(unsigned int size, int gfp_mask)
goto
nodata
;
goto
nodata
;
/* XXX: does not include slab overhead */
/* XXX: does not include slab overhead */
skb
->
truesize
=
size
+
sizeof
(
struct
sk_buff
);
/* Load the data pointers. */
skb
->
head
=
skb
->
data
=
skb
->
tail
=
data
;
skb
->
end
=
data
+
size
;
/* Set up other state */
skb
->
len
=
0
;
skb
->
cloned
=
0
;
skb
->
data_len
=
0
;
atomic_set
(
&
skb
->
users
,
1
);
atomic_set
(
&
(
skb_shinfo
(
skb
)
->
dataref
),
1
);
skb_shinfo
(
skb
)
->
nr_frags
=
0
;
skb_shinfo
(
skb
)
->
tso_size
=
0
;
skb_shinfo
(
skb
)
->
tso_segs
=
0
;
skb_shinfo
(
skb
)
->
frag_list
=
NULL
;
out:
return
skb
;
nodata:
skb_head_to_pool
(
skb
);
skb
=
NULL
;
goto
out
;
}
/*
* Slab constructor for a skb head.
*/
static
void
skb_headerinit
(
void
*
p
,
kmem_cache_t
*
cache
,
unsigned
long
flags
)
{
struct
sk_buff
*
skb
=
p
;
skb
->
next
=
skb
->
prev
=
NULL
;
skb
->
next
=
skb
->
prev
=
NULL
;
skb
->
list
=
NULL
;
skb
->
list
=
NULL
;
skb
->
sk
=
NULL
;
skb
->
sk
=
NULL
;
...
@@ -238,12 +204,23 @@ static void skb_headerinit(void *p, kmem_cache_t *cache,
...
@@ -238,12 +204,23 @@ static void skb_headerinit(void *p, kmem_cache_t *cache,
skb
->
dst
=
NULL
;
skb
->
dst
=
NULL
;
skb
->
sp
=
NULL
;
skb
->
sp
=
NULL
;
memset
(
skb
->
cb
,
0
,
sizeof
(
skb
->
cb
));
memset
(
skb
->
cb
,
0
,
sizeof
(
skb
->
cb
));
/* Set up other state */
skb
->
len
=
0
;
skb
->
data_len
=
0
;
skb
->
csum
=
0
;
skb
->
cloned
=
0
;
skb
->
pkt_type
=
PACKET_HOST
;
/* Default type */
skb
->
pkt_type
=
PACKET_HOST
;
/* Default type */
skb
->
ip_summed
=
0
;
skb
->
ip_summed
=
0
;
skb
->
priority
=
0
;
skb
->
priority
=
0
;
atomic_set
(
&
skb
->
users
,
1
);
skb
->
security
=
0
;
/* By default packets are insecure */
skb
->
security
=
0
;
/* By default packets are insecure */
skb
->
destructor
=
NULL
;
skb
->
truesize
=
size
+
sizeof
(
struct
sk_buff
);
/* Load the data pointers. */
skb
->
head
=
skb
->
data
=
skb
->
tail
=
data
;
skb
->
end
=
data
+
size
;
skb
->
destructor
=
NULL
;
#ifdef CONFIG_NETFILTER
#ifdef CONFIG_NETFILTER
skb
->
nfmark
=
skb
->
nfcache
=
0
;
skb
->
nfmark
=
skb
->
nfcache
=
0
;
skb
->
nfct
=
NULL
;
skb
->
nfct
=
NULL
;
...
@@ -257,8 +234,20 @@ static void skb_headerinit(void *p, kmem_cache_t *cache,
...
@@ -257,8 +234,20 @@ static void skb_headerinit(void *p, kmem_cache_t *cache,
#ifdef CONFIG_NET_SCHED
#ifdef CONFIG_NET_SCHED
skb
->
tc_index
=
0
;
skb
->
tc_index
=
0
;
#endif
#endif
atomic_set
(
&
(
skb_shinfo
(
skb
)
->
dataref
),
1
);
skb_shinfo
(
skb
)
->
nr_frags
=
0
;
skb_shinfo
(
skb
)
->
tso_size
=
0
;
skb_shinfo
(
skb
)
->
tso_segs
=
0
;
skb_shinfo
(
skb
)
->
frag_list
=
NULL
;
out:
return
skb
;
nodata:
skb_head_to_pool
(
skb
);
skb
=
NULL
;
goto
out
;
}
}
static
void
skb_drop_fraglist
(
struct
sk_buff
*
skb
)
static
void
skb_drop_fraglist
(
struct
sk_buff
*
skb
)
{
{
struct
sk_buff
*
list
=
skb_shinfo
(
skb
)
->
frag_list
;
struct
sk_buff
*
list
=
skb_shinfo
(
skb
)
->
frag_list
;
...
@@ -339,7 +328,6 @@ void __kfree_skb(struct sk_buff *skb)
...
@@ -339,7 +328,6 @@ void __kfree_skb(struct sk_buff *skb)
nf_bridge_put
(
skb
->
nf_bridge
);
nf_bridge_put
(
skb
->
nf_bridge
);
#endif
#endif
#endif
#endif
skb_headerinit
(
skb
,
NULL
,
0
);
/* clean state */
kfree_skbmem
(
skb
);
kfree_skbmem
(
skb
);
}
}
...
@@ -1261,7 +1249,7 @@ void __init skb_init(void)
...
@@ -1261,7 +1249,7 @@ void __init skb_init(void)
sizeof
(
struct
sk_buff
),
sizeof
(
struct
sk_buff
),
0
,
0
,
SLAB_HWCACHE_ALIGN
,
SLAB_HWCACHE_ALIGN
,
skb_headerinit
,
NULL
);
NULL
,
NULL
);
if
(
!
skbuff_head_cache
)
if
(
!
skbuff_head_cache
)
panic
(
"cannot create skbuff cache"
);
panic
(
"cannot create skbuff cache"
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment