Re: [PATCH] xHCI: refine td allocation

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello.

On 26-07-2011 4:34, Andiry Xu wrote:

In xhci_urb_enqueue(), allocate a block of memory for all the TDs instead
of allocating memory for each of them separately. This reduces the number
of kzalloc calling when an isochronous usb is submitted.

Signed-off-by: Andiry Xu <andiry.xu@xxxxxxx>
---
  drivers/usb/host/xhci-mem.c |   14 +++-----------
  drivers/usb/host/xhci.c     |   15 +++++++++------
  2 files changed, 12 insertions(+), 17 deletions(-)

[...]

diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c
index d0a6540..95c6d91 100644
--- a/drivers/usb/host/xhci.c
+++ b/drivers/usb/host/xhci.c
@@ -1029,6 +1029,7 @@ static int xhci_check_maxpacket(struct xhci_hcd *xhci, unsigned int slot_id,
  int xhci_urb_enqueue(struct usb_hcd *hcd, struct urb *urb, gfp_t mem_flags)
  {
  	struct xhci_hcd *xhci = hcd_to_xhci(hcd);
+	struct xhci_td *buffer;
  	unsigned long flags;
  	int ret = 0;
  	unsigned int slot_id, ep_index;
@@ -1059,13 +1060,15 @@ int xhci_urb_enqueue(struct usb_hcd *hcd, struct urb *urb, gfp_t mem_flags)
  	if (!urb_priv)
  		return -ENOMEM;

+	buffer = kzalloc(size * sizeof(struct xhci_td), mem_flags);

   kcalloc() fits somewhat better here.

WBR, Sergei

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux