Re: sysfs vs. ioctl
From: Arnd Bergmann
Date: Tue Feb 23 2010 - 11:58:26 EST
On Tuesday 23 February 2010, Neshama Parhoti wrote:
> we are in the process of writing a new driver and we don't know
> whether to choose a sysfs or ioctl interface to user space.
>
> we know that sysfs is preferred, but we're concerned it will have bad
> performance when compared to ioctl (our driver will have its interface
> might be used many dozens of times per second, possible even more than
> 100 times per second).
>
> so should we opt for ioctls if a usage is expected even every 5
> miliseconds (in extreme scenarios) ?
The question is not that easy to answer generally, there are many
aspects that influence what interface to use, and sysfs is not
generally slower than ioctl either.
Can you describe what your driver is doing? One rule of thumb
is that if you already require a character device, using ioctl
is the right answer, but you shouldn't create a character device
if all you want to do over it is a single ioctl operation.
Arnd
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/