[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <200905062201.42965.oliver@neukum.org>
Date: Wed, 6 May 2009 22:01:42 +0200
From: Oliver Neukum <oliver@...kum.org>
To: Alan Stern <stern@...land.harvard.edu>
Cc: Alan Cox <alan@...rguk.ukuu.org.uk>,
Jason Wessel <jason.wessel@...driver.com>, greg@...ah.com,
linux-usb@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH 5/5] usb_debug: EXPERIMENTAL - poll hcd device to force writes
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
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists