Date: Mon, 25 Mar 2002 15:22:50 -0500
   From: Chris Hanson <[EMAIL PROTECTED]>

      From: David Brownell <[EMAIL PROTECTED]>
      Date: 2002-03-25 18:52:29

      > Meanwhile, though, if eliminating the 4k limit seems like a good idea,
      > may I suggest applying this patch to the kernel?

      It'd make sense to me, though as I said in my original post
      I'd rather use kmalloc (up to its limit of about 128KBytes) on
      the grounds that, among other things, the typical case won't
      be adding new pressure to the page allocator.

   That sounds reasonable.  I only used __get_free_pages to mimic the
   code that was already there.

Here is an updated patch using kmalloc.  I've tested it and it seems
to work OK.

I've been doing some more exploration and have found that the
performance problem I've been seeing seems to have to do with the way
the hardware is initialized.  I'm currently using 2.4.18 with the RML
preemption patch, and if I boot right into this I get the slow
performance.  If instead I boot into a fairly vanilla 2.4.17 kernel,
then reboot into the 2.4.18+preempt kernel, I get fast performance.
I'm running tests right now to narrow this down and figure out if it's
2.4.18 or the preempt patch that's causing the trouble.  But if this
sounds familiar to anyone, please holler.

BTW, when I do this double-boot to get fast performance, increasing
the bulk transfer size from 0x1000 to 0xfe00 gives a dramatic
improvement.  With the smaller size, I get about 330 kB/s rates, while
with the larger size I get about 530 kB/s rates.  So this patch is
well worth installing.

I'll follow up as soon as I know more.

Chris


--- linux-2.4.18-orig/drivers/usb/devio.c       Fri Nov  2 20:18:58 2001
+++ linux-2.4.18/drivers/usb/devio.c    Wed Apr  3 16:41:17 2002
@@ -587,33 +587,31 @@
        if (!usb_maxpacket(dev, pipe, !(bulk.ep & USB_DIR_IN)))
                return -EINVAL;
        len1 = bulk.len;
-       if (len1 > PAGE_SIZE)
-               return -EINVAL;
-       if (!(tbuf = (unsigned char *)__get_free_page(GFP_KERNEL)))
+       if (!(tbuf = kmalloc(len1, GFP_KERNEL)))
                return -ENOMEM;
        tmo = (bulk.timeout * HZ + 999) / 1000;
        if (bulk.ep & 0x80) {
                if (len1 && !access_ok(VERIFY_WRITE, bulk.data, len1)) {
-                       free_page((unsigned long)tbuf);
+                       kfree(tbuf);
                        return -EINVAL;
                }
                i = usb_bulk_msg(dev, pipe, tbuf, len1, &len2, tmo);
                if (!i && len2) {
                        if (copy_to_user(bulk.data, tbuf, len2)) {
-                               free_page((unsigned long)tbuf);
+                               kfree(tbuf);
                                return -EFAULT;
                        }
                }
        } else {
                if (len1) {
                        if (copy_from_user(tbuf, bulk.data, len1)) {
-                               free_page((unsigned long)tbuf);
+                               kfree(tbuf);
                                return -EFAULT;
                        }
                }
                i = usb_bulk_msg(dev, pipe, tbuf, len1, &len2, tmo);
        }
-       free_page((unsigned long)tbuf);
+       kfree(tbuf);
        if (i < 0) {
                printk(KERN_WARNING "usbdevfs: USBDEVFS_BULK failed dev %d ep 0x%x len 
%u ret %d\n", 
                       dev->devnum, bulk.ep, bulk.len, i);

_______________________________________________
[EMAIL PROTECTED]
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel

Reply via email to