lkml.org 
[lkml]   [2006]   [Jul]   [11]   [last100]   RSS Feed
Views: [more markup]  [less markup]  [headers]  [forward] 
 
Messages in this thread
/
DateTue, 11 Jul 2006 09:03:43 +0300
From"Pekka Enberg" <>
SubjectRe: [PATCH] msi: Only keep one msi_desc in each slab entry.
On 7/11/06, Eric W. Biederman <ebiederm@xmission.com> wrote:
>
> It looks like someone confused kmem_cache_create with a different
> allocator and was attempting to give it knowledge of how many cache
> entries there were.
>
> With the unfortunate result that each slab entry was big enough to
> hold every irq.
>
> Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>
> ---
>  drivers/pci/msi.c |    4 ++--
>  1 files changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/pci/msi.c b/drivers/pci/msi.c
> index 0cd4a3e..082e942 100644
> --- a/drivers/pci/msi.c
> +++ b/drivers/pci/msi.c
> @@ -40,13 +40,13 @@ msi_register(struct msi_ops *ops)
>
>  static void msi_cache_ctor(void *p, kmem_cache_t *cache, unsigned long flags)
>  {
> -       memset(p, 0, NR_IRQS * sizeof(struct msi_desc));
> +       memset(p, 0, sizeof(struct msi_desc));

You can use kmem_cache_zalloc() for this.

>  }
>
>  static int msi_cache_init(void)
>  {
>         msi_cachep = kmem_cache_create("msi_cache",
> -                       NR_IRQS * sizeof(struct msi_desc),
> +                       sizeof(struct msi_desc),
>                         0, SLAB_HWCACHE_ALIGN, msi_cache_ctor, NULL);
>         if (!msi_cachep)
>                 return -ENOMEM;
> --
> 1.4.1.gac83a
>
> -
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at  http://www.tux.org/lkml/
>
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2006-07-11 08:07    [from the cache]
©2003-2008