On Tue, Aug 29, 2017 at 04:22:34PM +0000, Grant Edwards wrote: > Roughly how much kernel memory is allocated for a UART by > uart_register_driver() for UARTS that never get instantiated by > uart_add_one_port()? > > A few KB, tens of KB, hundreds of KB? > > Many of the serial-core drivers have a configurable "number of uarts" > value that goes into a 'uart_driver' struct: > > static struct uart_driver foo_uart_driver = > { > .owner = THIS_MODULE, > .driver_name = DRV_NAME, > .dev_name = "ttyFoo", > .nr = CONFIG_SERIAL_FOO_NR_UARTS, > }; > > which is then passed to uart_register_driver: > > rc = uart_register_driver(&foo_uart_driver); > > which then allocates stuff as approprite depending on the .nr value. > > I'm reading through the tty and serial-core code trying to figure out > how much memory is allocated per uart by that call, but I'm not at all > confident I've found all (or even most) of it. > > I'm considering setting .nr to 256 in order to handle large > configurations without burdening the user with building the drivier, > installing it, loading it, searching through the syslog for the > failures messages, troubleshooting the failure, changing > CONFIG_SERIAL_FOO_NR_UARTS, and repeating. > > But if that's going to allocate huge amounts of kernel memory that > don't get used in the common case where there are only 4 or 8 UARTs it > may be a bad idea... Should be a pretty easy thing for you to test yourself, right? Build two different kernels, look at the memory used, and there you go... And what specific serial driver are you wanting to modify for this? Are there systems with large numbers of serial ports on that platform? thanks, greg k-h -- To unsubscribe from this list: send the line "unsubscribe linux-serial" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html