Re: 3 Serial issues up for discussion

From: Remco Treffkorn (remco@rvt.com)
Date: Tue Jul 30 2002 - 13:23:47 EST


On Monday 29 July 2002 19:54, David S. Miller wrote:
> From: Remco Treffkorn <remco@rvt.com>
> Date: Mon, 29 Jul 2002 12:46:42 -0700
>
> Drivers need not fight about minor numbers. That can be simply handled:
>
> int get_new_serial_minor()
> {
> static int minor;
>
> return minor++;
> }
>
> Any serial driver can call this when it initializes a new uart.
> Hot pluggable drivers have to hang on to their minors, and
> re-use.
>
> I don't think it's wise to make hot-plug drivers keep track
> of the minors they ever use in such a sloppy way. Why not
> make the get_new_serial_minor() thing have a release method
> too and then we can keep track of minor allocation in one
> place.
>
> Also if I remmove the module for a serial port driver, those minors
> should get reused by the next registered uart too.

Point taken.
Here are a few more points.

The given solution presents almost zero overhead, but has the mentioned
problem. There is a way to allocate and free minor numbers, but that requires
storage. It could be handled like the fd_set's select uses. Just a bit field.
Bit cleared == minor available, bit set == in use.

If you want to do that, you would want to know the maximum number of minors
used. Also, finding the first cleared bit in your field costs more on some
platforms, than on others.

Although I suspect this additional overhead to not matter much, since
initialising a new uart is a rare event, I have bin surprised in the past.

So:
How many minors?
Is the overhead in getting a minor acceptable?
Is it worth doing?

Cheers,
Remco

-- 
Remco Treffkorn (RT445)
HAM DC2XT
remco@rvt.com   (831) 685-1201
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Tue Jul 30 2002 - 14:00:37 EST