From: Dmitry Torokhov <dtor@insightbb.com>
To: Om Narasimhan <om.turyx@gmail.com>
Cc: kernel-janitors@lists.osdl.org, linux-kernel@vger.kernel.org,
bluez-devel@lists.sf.net
Subject: Re: [KJ] bluetooth drivers : kmalloc to kzalloc conversion
Date: Mon, 18 Sep 2006 02:38:27 +0000 [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
_______________________________________________
Kernel-janitors mailing list
Kernel-janitors@lists.osdl.org
https://lists.osdl.org/mailman/listinfo/kernel-janitors
WARNING: multiple messages have this Message-ID (diff)
From: Dmitry Torokhov <dtor@insightbb.com>
To: Om Narasimhan <om.turyx@gmail.com>
Cc: kernel-janitors@lists.osdl.org, linux-kernel@vger.kernel.org,
bluez-devel@lists.sf.net
Subject: Re: [Bluez-devel] 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
-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Bluez-devel mailing list
Bluez-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bluez-devel
WARNING: multiple messages have this Message-ID (diff)
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
next prev parent reply other threads:[~2006-09-18 2:38 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-09-18 0:54 [KJ] bluetooth drivers : kmalloc to kzalloc conversion Om Narasimhan
2006-09-18 0:54 ` Om Narasimhan
2006-09-18 0:54 ` [Bluez-devel] " Om Narasimhan
2006-09-18 1:21 ` [KJ] " Dmitry Torokhov
2006-09-18 1:21 ` [Bluez-devel] " Dmitry Torokhov
2006-09-18 2:24 ` [KJ] " Om Narasimhan
2006-09-18 2:24 ` Om Narasimhan
2006-09-18 2:24 ` [Bluez-devel] " Om Narasimhan
2006-09-18 2:38 ` Dmitry Torokhov [this message]
2006-09-18 2:38 ` Dmitry Torokhov
2006-09-18 2:38 ` [Bluez-devel] " Dmitry Torokhov
2006-09-18 6:13 ` [KJ] [Bluez-devel] bluetooth drivers : kmalloc to kzalloc Marcel Holtmann
2006-09-18 6:13 ` [Bluez-devel] bluetooth drivers : kmalloc to kzalloc conversion Marcel Holtmann
2006-09-18 6:13 ` 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.sf.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.