public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Oliver Neukum <oliver@neukum.org>
To: Alan Stern <stern@rowland.harvard.edu>
Cc: Alan Cox <alan@lxorguk.ukuu.org.uk>,
	Jason Wessel <jason.wessel@windriver.com>,
	greg@kroah.com, linux-usb@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH 5/5] usb_debug: EXPERIMENTAL - poll hcd device to force writes
Date: Wed, 6 May 2009 22:01:42 +0200	[thread overview]
Message-ID: <200905062201.42965.oliver@neukum.org> (raw)
In-Reply-To: <Pine.LNX.4.44L0.0905061447500.4430-100000@iolanthe.rowland.org>

Am Mittwoch, 6. Mai 2009 21:24:56 schrieb Alan Stern:
> On Wed, 6 May 2009, Oliver Neukum wrote:

> A little thought yielded the following algorithm.  It assumes there is
> a fixed set of URBs allocated, unlike what you have done.  Does it make

No, it does not ;-) Your approach is more general than you think.
The only important constraint is that the number of URBs in flight
be limited. It doesn't matter when they are allocated.

> sense to take this approach?

Yes.

> Let N be the total number of URBs allocated, each capable of holding up
> to B bytes.  Let NIF be the number of URBs in flight at any time, so
> the number of available URBs is N - NIF.  The number of available bytes
> might be < (N - NIF)*B because the next URB might be partially full.
>
> P is an adjustable parameter of the algorithm.  For simplicity you can
> take P = 1, but increasing P (any value below N is okay) would yield
> reduced latency at the cost of more partially-filled URB submissions
> (so possibly reduced throughput).
>
>     Write routine:
> 	Copy bytes into the available URB buffers, submitting URBs as
> 	they get filled.  At the end, if the next URB is partially full
> 	then submit it only if NIF < P.

I did so. In principle. I am leaving the iteration to the tty layer.

>     Completion routine:
> 	If the next URB to send is partially filled, submit it.

Much easier if P = N - 1

>     write_room routine:
> 	Return the actual number of bytes remaining in the available
> 	URBs, but no more than (N-P)*B.

Yes.

> How does that sound?  Converting \n to \r\n will add some complication
> but not too much.
>
> Allocating URBs on the fly adds a lot of complication.  There has to be
> a minimum number of pre-allocated URBs; otherwise write_room could

Why? You can always calculate with the number of URBs you'd
allocate as a maximum.

> never return a positive value.  If you allocate additional URBs
> later on, when would you free them?

Like you free all URBs, on completion.

	Regards
		Oliver


  reply	other threads:[~2009-05-06 20:01 UTC|newest]

Thread overview: 38+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-05-06  2:00 [PATCH 0/5] usb_debug driver improvements Jason Wessel
2009-05-06  2:00 ` [PATCH 1/5] usb_debug: implement multi urb write Jason Wessel
2009-05-06  2:00   ` [PATCH 2/5] usb_debug,usb_generic_serial: implement sysrq and serial break Jason Wessel
2009-05-06  2:00     ` [PATCH 3/5] usb,early_printk: insert cr prior to nl as needed Jason Wessel
2009-05-06  2:00       ` [PATCH 4/5] usb,early_printk: unregister early usb before rest_init() Jason Wessel
2009-05-06  2:00         ` [PATCH 5/5] usb_debug: EXPERIMENTAL - poll hcd device to force writes Jason Wessel
2009-05-06 15:18           ` Alan Stern
2009-05-06 15:25             ` Greg KH
2009-05-06 15:42               ` Alan Cox
2009-05-06 15:59               ` Jason Wessel
2009-05-06 15:41             ` Alan Cox
2009-05-06 15:45               ` Greg KH
2009-05-06 17:17               ` Oliver Neukum
2009-05-06 19:24                 ` Alan Stern
2009-05-06 20:01                   ` Oliver Neukum [this message]
2009-05-06 20:24                     ` Alan Stern
2009-05-06 22:24                       ` Oliver Neukum
2009-05-07 14:35                         ` Alan Stern
2009-05-07 15:01                           ` Oliver Neukum
2009-05-07 16:32                             ` Alan Stern
2009-05-06 20:24                     ` Jason Wessel
2009-05-06 20:28                       ` Greg KH
2009-05-06 20:51                         ` [PATCH 5/5] usb_debug: EXPERIMENTAL - poll hcd device to forcewrites Jason Wessel
2009-05-06 21:32                           ` Greg KH
2009-05-07 14:00                             ` Alan Stern
2009-05-07  0:06                   ` [PATCH 5/5] usb_debug: EXPERIMENTAL - poll hcd device to force writes Alan Cox
2009-05-07 14:27                     ` Alan Stern
2009-05-07 14:49                       ` Oliver Neukum
2009-05-06  7:34         ` [PATCH 4/5] usb,early_printk: unregister early usb before rest_init() Ingo Molnar
2009-05-06 13:02           ` Jason Wessel
2009-05-07 15:09             ` Ingo Molnar
2009-05-06  7:30       ` [PATCH 3/5] usb,early_printk: insert cr prior to nl as needed Ingo Molnar
2009-05-06 15:25         ` Greg KH
2009-05-07 15:04           ` Ingo Molnar
2009-05-06  7:16   ` [PATCH 1/5] usb_debug: implement multi urb write Oliver Neukum
2009-05-06 11:57     ` Jason Wessel
2009-05-06 12:31       ` Oliver Neukum
2009-05-06 15:26   ` Greg KH

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=200905062201.42965.oliver@neukum.org \
    --to=oliver@neukum.org \
    --cc=alan@lxorguk.ukuu.org.uk \
    --cc=greg@kroah.com \
    --cc=jason.wessel@windriver.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=stern@rowland.harvard.edu \
    /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