From: Christoph Hellwig <hch@lst.de>
To: "David S. Miller" <davem@redhat.com>
Cc: Robert.Olsson@data.slu.se, ak@suse.de, netdev@oss.sgi.com
Subject: Re: purpose of the skb head pool
Date: Tue, 29 Apr 2003 16:21:02 +0200 [thread overview]
Message-ID: <20030429162102.A23898@lst.de> (raw)
In-Reply-To: <20030429.061249.123996896.davem@redhat.com>; from davem@redhat.com on Tue, Apr 29, 2003 at 06:12:49AM -0700
On Tue, Apr 29, 2003 at 06:12:49AM -0700, David S. Miller wrote:
> Robert's first reply on this subject had it attached..
>
> I deleted it, can someone resend me a copy?
>
> When I ask for a patch, it usually means that I've
> /dev/null'd the entire thread already.
Lazy bastard.. ;)
--- linux/net/core/skbuff.c.030428 2003-04-01 13:24:14.000000000 +0200
+++ linux/net/core/skbuff.c 2003-04-28 16:53:54.000000000 +0200
@@ -20,7 +20,7 @@
* Ray VanTassle : Fixed --skb->lock in free
* Alan Cox : skb_copy copy arp field
* Andi Kleen : slabified it.
+ * Robert Olsson : Removed skb_head_pool
*
* NOTE:
* The __skb_ routines should be called with interrupts
@@ -64,15 +64,8 @@
#include <asm/uaccess.h>
#include <asm/system.h>
-int sysctl_hot_list_len = 128;
-
static kmem_cache_t *skbuff_head_cache;
-static union {
- struct sk_buff_head list;
- char pad[SMP_CACHE_BYTES];
-} skb_head_pool[NR_CPUS];
-
/*
* Keep out-of-line to prevent kernel bloat.
* __builtin_return_address is not used because it is not always
@@ -110,44 +103,6 @@
BUG();
}
-static __inline__ struct sk_buff *skb_head_from_pool(void)
-{
- struct sk_buff_head *list;
- struct sk_buff *skb = NULL;
- unsigned long flags;
-
- local_irq_save(flags);
-
- list = &skb_head_pool[smp_processor_id()].list;
-
- if (skb_queue_len(list))
- skb = __skb_dequeue(list);
-
- local_irq_restore(flags);
- return skb;
-}
-
-static __inline__ void skb_head_to_pool(struct sk_buff *skb)
-{
- struct sk_buff_head *list;
- unsigned long flags;
-
- local_irq_save(flags);
-
- list = &skb_head_pool[smp_processor_id()].list;
-
- if (skb_queue_len(list) < sysctl_hot_list_len) {
- __skb_queue_head(list, skb);
- local_irq_restore(flags);
-
- return;
- }
-
- local_irq_restore(flags);
- kmem_cache_free(skbuff_head_cache, skb);
-}
-
-
/* Allocate a new skbuff. We do this ourselves so we can fill in a few
* 'private' fields and also do memory statistics to find all the
* [BEEP] leaks.
@@ -182,13 +137,10 @@
}
/* Get the HEAD */
- skb = skb_head_from_pool();
- if (!skb) {
- skb = kmem_cache_alloc(skbuff_head_cache,
+ skb = kmem_cache_alloc(skbuff_head_cache,
gfp_mask & ~__GFP_DMA);
if (!skb)
goto out;
- }
/* Get the DATA. Size must match skb_add_mtu(). */
size = SKB_DATA_ALIGN(size);
@@ -207,7 +159,7 @@
out:
return skb;
nodata:
- skb_head_to_pool(skb);
+ kmem_cache_free(skbuff_head_cache, skb);
skb = NULL;
goto out;
}
@@ -257,7 +209,7 @@
void kfree_skbmem(struct sk_buff *skb)
{
skb_release_data(skb);
- skb_head_to_pool(skb);
+ kmem_cache_free(skbuff_head_cache, skb);
}
/**
@@ -327,13 +279,10 @@
struct sk_buff *skb_clone(struct sk_buff *skb, int gfp_mask)
{
- struct sk_buff *n = skb_head_from_pool();
+ struct sk_buff *n = kmem_cache_alloc(skbuff_head_cache, gfp_mask);
- if (!n) {
- n = kmem_cache_alloc(skbuff_head_cache, gfp_mask);
- if (!n)
- return NULL;
- }
+ if (!n)
+ return NULL;
#define C(x) n->x = skb->x
@@ -1240,7 +1189,4 @@
NULL, NULL);
if (!skbuff_head_cache)
panic("cannot create skbuff cache");
-
- for (i = 0; i < NR_CPUS; i++)
- skb_queue_head_init(&skb_head_pool[i].list);
}
--- linux/net/core/sysctl_net_core.c.030428 2003-03-24 23:00:18.000000000 +0100
+++ linux/net/core/sysctl_net_core.c 2003-04-28 16:59:05.000000000 +0200
@@ -28,7 +28,6 @@
extern int sysctl_core_destroy_delay;
extern int sysctl_optmem_max;
-extern int sysctl_hot_list_len;
#ifdef CONFIG_NET_DIVERT
extern char sysctl_divert_version[];
@@ -150,14 +149,6 @@
.mode = 0644,
.proc_handler = &proc_dointvec
},
- {
- .ctl_name = NET_CORE_HOT_LIST_LENGTH,
- .procname = "hot_list_length",
- .data = &sysctl_hot_list_len,
- .maxlen = sizeof(int),
- .mode = 0644,
- .proc_handler = &proc_dointvec
- },
#ifdef CONFIG_NET_DIVERT
{
.ctl_name = NET_CORE_DIVERT_VERSION,
next prev parent reply other threads:[~2003-04-29 14:21 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-04-29 11:55 purpose of the skb head pool Christoph Hellwig
2003-04-29 13:03 ` Andi Kleen
2003-04-29 13:11 ` Robert Olsson
2003-04-29 13:08 ` David S. Miller
2003-04-29 14:16 ` Christoph Hellwig
2003-04-29 13:12 ` David S. Miller
2003-04-29 14:21 ` Christoph Hellwig [this message]
2003-04-30 5:39 ` David S. Miller
2003-04-29 13:05 ` Robert Olsson
2003-05-01 10:38 ` Florian Weimer
2003-05-01 9:35 ` David S. Miller
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20030429162102.A23898@lst.de \
--to=hch@lst.de \
--cc=Robert.Olsson@data.slu.se \
--cc=ak@suse.de \
--cc=davem@redhat.com \
--cc=netdev@oss.sgi.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).