public inbox for linuxppc-dev@ozlabs.org 
 help / color / mirror / Atom feed
From: Arnd Bergmann <arnd.bergmann@de•ibm.com>
To: linuxppc-dev@ozlabs•org
Cc: linux-kernel@vger•kernel.org, openib-general@openib•org,
	Christoph Raisch <RAISCH@de•ibm.com>,
	Hoang-Nam Nguyen <HNGUYEN@de•ibm.com>,
	Marcus Eder <MEDER@de•ibm.com>,
	abergman@de•ibm.com
Subject: Re: [PATCH 02/13] IB/ehca: includes
Date: Wed, 30 Aug 2006 11:43:34 +0200	[thread overview]
Message-ID: <200608301143.35320.arnd.bergmann@de.ibm.com> (raw)
In-Reply-To: <OF23CA96AE.C7DBFD52-ONC12571DA.00321849-C12571DA.00324865@de.ibm.com>

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 <><

  reply	other threads:[~2006-08-30  9:43 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <OFED0915E4.3CED6795-ONC12571CE.0053ECB8-C12571CE.0055546A@LocalDomain>
2006-08-30  9:13 ` [PATCH 02/13] IB/ehca: includes Hoang-Nam Nguyen
2006-08-30  9:43   ` Arnd Bergmann [this message]
2006-08-30 18:27     ` [openib-general] " Hoang-Nam Nguyen
2006-08-17 20:11 [PATCH 01/13] IB/ehca: hca Roland Dreier
2006-08-17 20:11 ` [PATCH 02/13] IB/ehca: includes Roland Dreier
2006-08-17 23:44   ` Arnd Bergmann
2006-08-18 15:35     ` Christoph Raisch
2006-08-18 16:21       ` Arnd Bergmann

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=200608301143.35320.arnd.bergmann@de.ibm.com \
    --to=arnd.bergmann@de$(echo .)ibm.com \
    --cc=HNGUYEN@de$(echo .)ibm.com \
    --cc=MEDER@de$(echo .)ibm.com \
    --cc=RAISCH@de$(echo .)ibm.com \
    --cc=abergman@de$(echo .)ibm.com \
    --cc=linux-kernel@vger$(echo .)kernel.org \
    --cc=linuxppc-dev@ozlabs$(echo .)org \
    --cc=openib-general@openib$(echo .)org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
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