[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <200608301143.35320.arnd.bergmann@de.ibm.com>
Date: Wed, 30 Aug 2006 11:43:34 +0200
From: Arnd Bergmann <arnd.bergmann@...ibm.com>
To: linuxppc-dev@...abs.org
Cc: Hoang-Nam Nguyen <HNGUYEN@...ibm.com>, abergman@...ibm.com,
linux-kernel@...r.kernel.org, openib-general@...nib.org,
Christoph Raisch <RAISCH@...ibm.com>,
Marcus Eder <MEDER@...ibm.com>
Subject: Re: [PATCH 02/13] IB/ehca: includes
On Wednesday 30 August 2006 11:13, Hoang-Nam Nguyen wrote:
> Further comments/suggestions are appreciated!
There are a few places in the driver where you declare
external variables (mostly ehca_module and ehca_debug_level)
from C files instead of a header. This sometimes leads
to bugs when a type changes and is therefore considered
bad style.
ehca_debug_level is already declared in a header so you
should not need any other declaration.
For ehca_module, the usage pattern is very uncommon.
Declaring the structure in a header helps a bit, but I
don't really see the need for this structure at all.
Each member of the struct seems to be used mostly in a
single file, so I would declare it statically in there.
E.g. in drivers/infiniband/hw/ehca/ehca_pd.c, you can do
static struct kmem_cache *ehca_pd_cache;
int ehca_init_pd_cache(void)
{
ehca_pd_cache = kmem_cache_init("ehca_cache_pd",
sizeof(struct ehca_pd), 0, SLAB_HWCACHE_ALIGN,
NULL, NULL);
if (!ehca_pd_cache)
return -ENOMEM;
return 0;
}
void ehca_cleanup_pd_cache(void)
{
if (ehca_pd_cache)
kmem_cache_destroy(ehca_pd_cache);
}
Moreover, for some of your more heavily used caches, you may
want to look into using constructor/destructor calls to
speed up allocation.
Arnd <><
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists