All of lore.kernel.org
 help / color / mirror / Atom feed
* [KJ] bluetooth drivers : kmalloc to kzalloc conversion
@ 2006-09-18  0:54 ` Om Narasimhan
  0 siblings, 0 replies; 14+ messages in thread
From: Om Narasimhan @ 2006-09-18  0:54 UTC (permalink / raw)
  To: linux-kernel, kernel-janitors, bluez-devel

Tested by compiling with $make allmodconfig; make

Signed off by Om Narasimhan <om.turyx@gmail.com>

 drivers/bluetooth/bfusb.c   |    2 +-
 drivers/bluetooth/hci_usb.c |   11 +++++------
 2 files changed, 6 insertions(+), 7 deletions(-)

diff --git a/drivers/bluetooth/bfusb.c b/drivers/bluetooth/bfusb.c
index 23f9621..9772d8c 100644
--- a/drivers/bluetooth/bfusb.c
+++ b/drivers/bluetooth/bfusb.c
@@ -588,7 +588,7 @@ static int bfusb_load_firmware(struct bf

 	bfusb->udev->toggle[0] = bfusb->udev->toggle[1] = 0;

-	buf = kmalloc(BFUSB_MAX_BLOCK_SIZE + 3, GFP_ATOMIC);
+	buf = kzalloc(BFUSB_MAX_BLOCK_SIZE + 3, GFP_ATOMIC);
 	if (!buf) {
 		BT_ERR("Can't allocate memory chunk for firmware");
 		return -ENOMEM;
diff --git a/drivers/bluetooth/hci_usb.c b/drivers/bluetooth/hci_usb.c
index e2d4bea..2274248 100644
--- 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;
@@ -220,7 +219,7 @@ static int hci_usb_intr_rx_submit(struct

 	size = le16_to_cpu(husb->intr_in_ep->desc.wMaxPacketSize);

-	buf = kmalloc(size, GFP_ATOMIC);
+	buf = kzalloc(size, GFP_ATOMIC);
 	if (!buf)
 		return -ENOMEM;

@@ -255,7 +254,7 @@ static int hci_usb_bulk_rx_submit(struct
 	int err, pipe, size = HCI_MAX_FRAME_SIZE;
 	void *buf;

-	buf = kmalloc(size, GFP_ATOMIC);
+	buf = kzalloc(size, GFP_ATOMIC);
 	if (!buf)
 		return -ENOMEM;

@@ -296,7 +295,7 @@ static int hci_usb_isoc_rx_submit(struct
 	mtu  = le16_to_cpu(husb->isoc_in_ep->desc.wMaxPacketSize);
 	size = mtu * HCI_MAX_ISOC_FRAMES;

-	buf = kmalloc(size, GFP_ATOMIC);
+	buf = kzalloc(size, GFP_ATOMIC);
 	if (!buf)
 		return -ENOMEM;

@@ -471,7 +470,7 @@ static inline int hci_usb_send_ctrl(stru
 			return -ENOMEM;
 		_urb->type = bt_cb(skb)->pkt_type;

-		dr = kmalloc(sizeof(*dr), GFP_ATOMIC);
+		dr = kzalloc(sizeof(*dr), GFP_ATOMIC);
 		if (!dr) {
 			_urb_free(_urb);
 			return -ENOMEM;
_______________________________________________
Kernel-janitors mailing list
Kernel-janitors@lists.osdl.org
https://lists.osdl.org/mailman/listinfo/kernel-janitors

^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [Bluez-devel] bluetooth drivers : kmalloc to kzalloc conversion
@ 2006-09-18  0:54 ` Om Narasimhan
  0 siblings, 0 replies; 14+ messages in thread
From: Om Narasimhan @ 2006-09-18  0:54 UTC (permalink / raw)
  To: linux-kernel, kernel-janitors, bluez-devel

Tested by compiling with $make allmodconfig; make

Signed off by Om Narasimhan <om.turyx@gmail.com>

 drivers/bluetooth/bfusb.c   |    2 +-
 drivers/bluetooth/hci_usb.c |   11 +++++------
 2 files changed, 6 insertions(+), 7 deletions(-)

diff --git a/drivers/bluetooth/bfusb.c b/drivers/bluetooth/bfusb.c
index 23f9621..9772d8c 100644
--- a/drivers/bluetooth/bfusb.c
+++ b/drivers/bluetooth/bfusb.c
@@ -588,7 +588,7 @@ static int bfusb_load_firmware(struct bf

 	bfusb->udev->toggle[0] = bfusb->udev->toggle[1] = 0;

-	buf = kmalloc(BFUSB_MAX_BLOCK_SIZE + 3, GFP_ATOMIC);
+	buf = kzalloc(BFUSB_MAX_BLOCK_SIZE + 3, GFP_ATOMIC);
 	if (!buf) {
 		BT_ERR("Can't allocate memory chunk for firmware");
 		return -ENOMEM;
diff --git a/drivers/bluetooth/hci_usb.c b/drivers/bluetooth/hci_usb.c
index e2d4bea..2274248 100644
--- 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;
@@ -220,7 +219,7 @@ static int hci_usb_intr_rx_submit(struct

 	size = le16_to_cpu(husb->intr_in_ep->desc.wMaxPacketSize);

-	buf = kmalloc(size, GFP_ATOMIC);
+	buf = kzalloc(size, GFP_ATOMIC);
 	if (!buf)
 		return -ENOMEM;

@@ -255,7 +254,7 @@ static int hci_usb_bulk_rx_submit(struct
 	int err, pipe, size = HCI_MAX_FRAME_SIZE;
 	void *buf;

-	buf = kmalloc(size, GFP_ATOMIC);
+	buf = kzalloc(size, GFP_ATOMIC);
 	if (!buf)
 		return -ENOMEM;

@@ -296,7 +295,7 @@ static int hci_usb_isoc_rx_submit(struct
 	mtu  = le16_to_cpu(husb->isoc_in_ep->desc.wMaxPacketSize);
 	size = mtu * HCI_MAX_ISOC_FRAMES;

-	buf = kmalloc(size, GFP_ATOMIC);
+	buf = kzalloc(size, GFP_ATOMIC);
 	if (!buf)
 		return -ENOMEM;

@@ -471,7 +470,7 @@ static inline int hci_usb_send_ctrl(stru
 			return -ENOMEM;
 		_urb->type = bt_cb(skb)->pkt_type;

-		dr = kmalloc(sizeof(*dr), GFP_ATOMIC);
+		dr = kzalloc(sizeof(*dr), GFP_ATOMIC);
 		if (!dr) {
 			_urb_free(_urb);
 			return -ENOMEM;

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

^ permalink raw reply related	[flat|nested] 14+ messages in thread

* bluetooth drivers : kmalloc to kzalloc conversion
@ 2006-09-18  0:54 ` Om Narasimhan
  0 siblings, 0 replies; 14+ messages in thread
From: Om Narasimhan @ 2006-09-18  0:54 UTC (permalink / raw)
  To: linux-kernel, kernel-janitors, bluez-devel

Tested by compiling with $make allmodconfig; make

Signed off by Om Narasimhan <om.turyx@gmail.com>

 drivers/bluetooth/bfusb.c   |    2 +-
 drivers/bluetooth/hci_usb.c |   11 +++++------
 2 files changed, 6 insertions(+), 7 deletions(-)

diff --git a/drivers/bluetooth/bfusb.c b/drivers/bluetooth/bfusb.c
index 23f9621..9772d8c 100644
--- a/drivers/bluetooth/bfusb.c
+++ b/drivers/bluetooth/bfusb.c
@@ -588,7 +588,7 @@ static int bfusb_load_firmware(struct bf

 	bfusb->udev->toggle[0] = bfusb->udev->toggle[1] = 0;

-	buf = kmalloc(BFUSB_MAX_BLOCK_SIZE + 3, GFP_ATOMIC);
+	buf = kzalloc(BFUSB_MAX_BLOCK_SIZE + 3, GFP_ATOMIC);
 	if (!buf) {
 		BT_ERR("Can't allocate memory chunk for firmware");
 		return -ENOMEM;
diff --git a/drivers/bluetooth/hci_usb.c b/drivers/bluetooth/hci_usb.c
index e2d4bea..2274248 100644
--- 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;
@@ -220,7 +219,7 @@ static int hci_usb_intr_rx_submit(struct

 	size = le16_to_cpu(husb->intr_in_ep->desc.wMaxPacketSize);

-	buf = kmalloc(size, GFP_ATOMIC);
+	buf = kzalloc(size, GFP_ATOMIC);
 	if (!buf)
 		return -ENOMEM;

@@ -255,7 +254,7 @@ static int hci_usb_bulk_rx_submit(struct
 	int err, pipe, size = HCI_MAX_FRAME_SIZE;
 	void *buf;

-	buf = kmalloc(size, GFP_ATOMIC);
+	buf = kzalloc(size, GFP_ATOMIC);
 	if (!buf)
 		return -ENOMEM;

@@ -296,7 +295,7 @@ static int hci_usb_isoc_rx_submit(struct
 	mtu  = le16_to_cpu(husb->isoc_in_ep->desc.wMaxPacketSize);
 	size = mtu * HCI_MAX_ISOC_FRAMES;

-	buf = kmalloc(size, GFP_ATOMIC);
+	buf = kzalloc(size, GFP_ATOMIC);
 	if (!buf)
 		return -ENOMEM;

@@ -471,7 +470,7 @@ static inline int hci_usb_send_ctrl(stru
 			return -ENOMEM;
 		_urb->type = bt_cb(skb)->pkt_type;

-		dr = kmalloc(sizeof(*dr), GFP_ATOMIC);
+		dr = kzalloc(sizeof(*dr), GFP_ATOMIC);
 		if (!dr) {
 			_urb_free(_urb);
 			return -ENOMEM;

^ permalink raw reply related	[flat|nested] 14+ messages in thread

* Re: [KJ] bluetooth drivers : kmalloc to kzalloc conversion
  2006-09-18  0:54 ` [Bluez-devel] " Om Narasimhan
@ 2006-09-18  1:21   ` Dmitry Torokhov
  -1 siblings, 0 replies; 14+ messages in thread
From: Dmitry Torokhov @ 2006-09-18  1:21 UTC (permalink / raw)
  To: Om Narasimhan; +Cc: kernel-janitors, linux-kernel, bluez-devel

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 originalcode; your patch may introduce slowdowns.
-- Dmitry
_______________________________________________
Kernel-janitors mailing list
Kernel-janitors@lists.osdl.org
https://lists.osdl.org/mailman/listinfo/kernel-janitors

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [Bluez-devel] bluetooth drivers : kmalloc to kzalloc conversion
@ 2006-09-18  1:21   ` Dmitry Torokhov
  0 siblings, 0 replies; 14+ messages in thread
From: Dmitry Torokhov @ 2006-09-18  1:21 UTC (permalink / raw)
  To: Om Narasimhan; +Cc: kernel-janitors, linux-kernel, bluez-devel

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

> =A0static struct _urb *_urb_alloc(int isoc, gfp_t gfp)
> =A0{
> -=A0=A0=A0=A0=A0=A0=A0struct _urb *_urb =3D kmalloc(sizeof(struct _urb) +
> +=A0=A0=A0=A0=A0=A0=A0struct _urb *_urb =3D kzalloc(sizeof(struct _urb) +
> =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=
=A0=A0=A0=A0=A0=A0=A0=A0sizeof(struct usb_iso_packet_descriptor) * isoc, gf=
p);
> =A0=A0=A0=A0=A0=A0=A0=A0if (_urb) {
> -=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0memset(_urb, 0, sizeof(*_ur=
b));
> =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0usb_init_urb(&_urb->urb);
> =A0=A0=A0=A0=A0=A0=A0=A0}
> =A0=A0=A0=A0=A0=A0=A0=A0return _urb;
> =


Note that only beginning if the aloocated memory was zeroed in original
code; your patch may introduce slowdowns.

-- =

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 easi=
er
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=3Dlnk&kid=3D120709&bid=3D263057&dat=3D1=
21642
_______________________________________________
Bluez-devel mailing list
Bluez-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bluez-devel

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [KJ] bluetooth drivers : kmalloc to kzalloc conversion
  2006-09-18  1:21   ` [Bluez-devel] " Dmitry Torokhov
  (?)
@ 2006-09-18  2:24     ` Om Narasimhan
  -1 siblings, 0 replies; 14+ messages in thread
From: Om Narasimhan @ 2006-09-18  2:24 UTC (permalink / raw)
  To: Dmitry Torokhov; +Cc: kernel-janitors, linux-kernel, bluez-devel

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.
And, usb_init_urb() calls memset() anyway, so the previously existed
memset() was superfluous.

Thanks for the comment.
Regards,
Om.
_______________________________________________
Kernel-janitors mailing list
Kernel-janitors@lists.osdl.org
https://lists.osdl.org/mailman/listinfo/kernel-janitors

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [Bluez-devel] bluetooth drivers : kmalloc to kzalloc conversion
@ 2006-09-18  2:24     ` Om Narasimhan
  0 siblings, 0 replies; 14+ messages in thread
From: Om Narasimhan @ 2006-09-18  2:24 UTC (permalink / raw)
  To: Dmitry Torokhov; +Cc: kernel-janitors, linux-kernel, bluez-devel

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.
And, usb_init_urb() calls memset() anyway, so the previously existed
memset() was superfluous.

Thanks for the comment.
Regards,
Om.

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

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: bluetooth drivers : kmalloc to kzalloc conversion
@ 2006-09-18  2:24     ` Om Narasimhan
  0 siblings, 0 replies; 14+ messages in thread
From: Om Narasimhan @ 2006-09-18  2:24 UTC (permalink / raw)
  To: Dmitry Torokhov; +Cc: linux-kernel, kernel-janitors, bluez-devel

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.
And, usb_init_urb() calls memset() anyway, so the previously existed
memset() was superfluous.

Thanks for the comment.
Regards,
Om.

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [KJ] bluetooth drivers : kmalloc to kzalloc conversion
  2006-09-18  2:24     ` [Bluez-devel] " Om Narasimhan
  (?)
@ 2006-09-18  2:38       ` Dmitry Torokhov
  -1 siblings, 0 replies; 14+ messages in thread
From: Dmitry Torokhov @ 2006-09-18  2:38 UTC (permalink / raw)
  To: Om Narasimhan; +Cc: kernel-janitors, linux-kernel, bluez-devel

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

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [Bluez-devel] bluetooth drivers : kmalloc to kzalloc conversion
@ 2006-09-18  2:38       ` Dmitry Torokhov
  0 siblings, 0 replies; 14+ messages in thread
From: Dmitry Torokhov @ 2006-09-18  2:38 UTC (permalink / raw)
  To: Om Narasimhan; +Cc: kernel-janitors, linux-kernel, bluez-devel

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

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: bluetooth drivers : kmalloc to kzalloc conversion
@ 2006-09-18  2:38       ` Dmitry Torokhov
  0 siblings, 0 replies; 14+ messages in thread
From: Dmitry Torokhov @ 2006-09-18  2:38 UTC (permalink / raw)
  To: Om Narasimhan; +Cc: linux-kernel, kernel-janitors, bluez-devel

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

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [KJ] [Bluez-devel] bluetooth drivers : kmalloc to kzalloc
  2006-09-18  0:54 ` [Bluez-devel] " Om Narasimhan
  (?)
@ 2006-09-18  6:13   ` Marcel Holtmann
  -1 siblings, 0 replies; 14+ messages in thread
From: Marcel Holtmann @ 2006-09-18  6:13 UTC (permalink / raw)
  To: BlueZ development; +Cc: kernel-janitors, linux-kernel, bluez-devel

Hi Om,

> Tested by compiling with $make allmodconfig; make
> 
> Signed off by Om Narasimhan <om.turyx@gmail.com>
> 
>  drivers/bluetooth/bfusb.c   |    2 +-
>  drivers/bluetooth/hci_usb.c |   11 +++++------
>  2 files changed, 6 insertions(+), 7 deletions(-)

the kzalloc is suppose to replace a kmalloc followed by a memset
operation. It is not the case for these changes and so these changes
make no sense.

Regards

Marcel


_______________________________________________
Kernel-janitors mailing list
Kernel-janitors@lists.osdl.org
https://lists.osdl.org/mailman/listinfo/kernel-janitors

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [Bluez-devel] bluetooth drivers : kmalloc to kzalloc conversion
@ 2006-09-18  6:13   ` Marcel Holtmann
  0 siblings, 0 replies; 14+ messages in thread
From: Marcel Holtmann @ 2006-09-18  6:13 UTC (permalink / raw)
  To: BlueZ development; +Cc: kernel-janitors, linux-kernel, bluez-devel

Hi Om,

> Tested by compiling with $make allmodconfig; make
> 
> Signed off by Om Narasimhan <om.turyx@gmail.com>
> 
>  drivers/bluetooth/bfusb.c   |    2 +-
>  drivers/bluetooth/hci_usb.c |   11 +++++------
>  2 files changed, 6 insertions(+), 7 deletions(-)

the kzalloc is suppose to replace a kmalloc followed by a memset
operation. It is not the case for these changes and so these changes
make no sense.

Regards

Marcel



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

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [Bluez-devel] bluetooth drivers : kmalloc to kzalloc conversion
@ 2006-09-18  6:13   ` Marcel Holtmann
  0 siblings, 0 replies; 14+ messages in thread
From: Marcel Holtmann @ 2006-09-18  6:13 UTC (permalink / raw)
  To: BlueZ development; +Cc: linux-kernel, kernel-janitors, bluez-devel

Hi Om,

> Tested by compiling with $make allmodconfig; make
> 
> Signed off by Om Narasimhan <om.turyx@gmail.com>
> 
>  drivers/bluetooth/bfusb.c   |    2 +-
>  drivers/bluetooth/hci_usb.c |   11 +++++------
>  2 files changed, 6 insertions(+), 7 deletions(-)

the kzalloc is suppose to replace a kmalloc followed by a memset
operation. It is not the case for these changes and so these changes
make no sense.

Regards

Marcel



^ permalink raw reply	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2006-09-18  6:13 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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     ` [KJ] " Dmitry Torokhov
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

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.