public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Dmitry Torokhov <dtor@insightbb.com>
To: Om Narasimhan <om.turyx@gmail.com>
Cc: linux-kernel@vger.kernel.org, kernel-janitors@lists.osdl.org,
	bluez-devel@lists.sourceforge.net
Subject: Re: bluetooth drivers : kmalloc to kzalloc conversion
Date: Sun, 17 Sep 2006 22:38:27 -0400	[thread overview]
Message-ID: <200609172238.27674.dtor@insightbb.com> (raw)
In-Reply-To: <6b4e42d10609171924v1bb5d238l597fae8a21641a4d@mail.gmail.com>

On Sunday 17 September 2006 22:24, Om Narasimhan wrote:
> On 9/17/06, Dmitry Torokhov <dtor@insightbb.com> wrote:
> > On Sunday 17 September 2006 20:54, Om Narasimhan wrote:
> > > --- a/drivers/bluetooth/hci_usb.c
> > > +++ b/drivers/bluetooth/hci_usb.c
> > > @@ -147,10 +147,9 @@ static struct usb_device_id blacklist_id
> > >
> > > static struct _urb *_urb_alloc(int isoc, gfp_t gfp)
> > > {
> > > -struct _urb *_urb = kmalloc(sizeof(struct _urb) +
> > > +struct _urb *_urb = kzalloc(sizeof(struct _urb) +
> > > sizeof(struct usb_iso_packet_descriptor) * isoc, gfp);
> > > if (_urb) {
> > > -memset(_urb, 0, sizeof(*_urb));
> > > usb_init_urb(&_urb->urb);
> > > }
> > > return _urb;
> > >
> >
> > Note that only beginning if the aloocated memory was zeroed in original
> > code; your patch may introduce slowdowns.
> Would it? I thought memset() uses block move operation which doesn't
> scale linearly.

Well, the old code was zeroing sizeof(struct _urb) bytes while yours is
zeroing sizeof(struct _urb) + X so it will definitely take more time.

> And, usb_init_urb() calls memset() anyway, so the previously existed
> memset() was superfluous.
> 

It only clears part of struct _urb. Note that "stuct _urb" and "struct urb"
are 2 different structures.

-- 
Dmitry

  reply	other threads:[~2006-09-18  2:38 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-09-18  0:54 bluetooth drivers : kmalloc to kzalloc conversion Om Narasimhan
     [not found] ` <200609172121.36247.dtor@insightbb.com>
2006-09-18  2:24   ` Om Narasimhan
2006-09-18  2:38     ` Dmitry Torokhov [this message]
2006-09-18  6:13 ` [Bluez-devel] " Marcel Holtmann

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=200609172238.27674.dtor@insightbb.com \
    --to=dtor@insightbb.com \
    --cc=bluez-devel@lists.sourceforge.net \
    --cc=kernel-janitors@lists.osdl.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=om.turyx@gmail.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