From: ebiederm@xmission.com (Eric W. Biederman)
To: Pekka J Enberg <penberg@cs.Helsinki.FI>
Cc: Andrew Morton <akpm@osdl.org>, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] msi: Only keep one msi_desc in each slab entry.
Date: Tue, 11 Jul 2006 01:16:12 -0600 [thread overview]
Message-ID: <m1psgcharn.fsf@ebiederm.dsl.xmission.com> (raw)
In-Reply-To: <Pine.LNX.4.58.0607110951240.12720@sbz-30.cs.Helsinki.FI> (Pekka J. Enberg's message of "Tue, 11 Jul 2006 09:55:56 +0300 (EEST)")
Pekka J Enberg <penberg@cs.Helsinki.FI> writes:
> On Tue, 11 Jul 2006, Eric W. Biederman wrote:
>> Please look at what the code changes.
>> Please recognize how very bad the current code is behaving.
>
> Yes, there's plenty of slab confusion going on.
>
> On Tue, 11 Jul 2006, Eric W. Biederman wrote:
>> As for the rest sure go ahead and create a patch to address it
>> but that really is a separate issue and thus a separate patch.
>>
>> I'm just trying to keep the kernel from calling BUG_ON the first
>> time a msi irq is allocated on a kernel with a maximum NR_CPUS
>> configuration, and from wasting memory the rest of the time.
>>
>> Or you know how bad the msi code is when every patch to fix a major
>> issue is followed up comments on how to improve the code even further.
>
> Ok.
Looks good to me.
> Signed-off-by: Pekka Enberg <penberg@cs.helsinki.fi>
> ---
>
> diff --git a/drivers/pci/msi.c b/drivers/pci/msi.c
> index 36bc7c4..77b08ee 100644
> --- a/drivers/pci/msi.c
> +++ b/drivers/pci/msi.c
> @@ -45,16 +45,11 @@ msi_register(struct msi_ops *ops)
> return 0;
> }
>
> -static void msi_cache_ctor(void *p, kmem_cache_t *cache, unsigned long flags)
> -{
> - memset(p, 0, NR_IRQS * sizeof(struct msi_desc));
> -}
> -
> static int msi_cache_init(void)
> {
> msi_cachep = kmem_cache_create("msi_cache",
> - NR_IRQS * sizeof(struct msi_desc),
> - 0, SLAB_HWCACHE_ALIGN, msi_cache_ctor, NULL);
> + sizeof(struct msi_desc),
> + 0, SLAB_HWCACHE_ALIGN, NULL, NULL);
> if (!msi_cachep)
> return -ENOMEM;
>
> @@ -402,11 +397,10 @@ static struct msi_desc* alloc_msi_entry(
> {
> struct msi_desc *entry;
>
> - entry = kmem_cache_alloc(msi_cachep, SLAB_KERNEL);
> + entry = kmem_cache_zalloc(msi_cachep, GFP_KERNEL);
> if (!entry)
> return NULL;
>
> - memset(entry, 0, sizeof(struct msi_desc));
> entry->link.tail = entry->link.head = 0; /* single message */
> entry->dev = NULL;
>
prev parent reply other threads:[~2006-07-11 7:16 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-07-10 22:00 Eric W. Biederman
2006-07-11 6:03 ` Pekka Enberg
2006-07-11 6:42 ` Eric W. Biederman
2006-07-11 6:55 ` Pekka J Enberg
2006-07-11 7:16 ` Eric W. Biederman [this message]
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=m1psgcharn.fsf@ebiederm.dsl.xmission.com \
--to=ebiederm@xmission.com \
--cc=akpm@osdl.org \
--cc=linux-kernel@vger.kernel.org \
--cc=penberg@cs.Helsinki.FI \
/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
Powered by JetHome