Re: Read from file fails

From: Libor Vanek
Date: Wed May 05 2004 - 04:57:18 EST


On Tue, May 04, 2004 at 04:31:40PM +0200, Bart Samwel wrote:
> Libor Vanek wrote:
> >I know that kernel threads work. My question was more like: "I'd
> > like to know, whether writing my module as kernel thread will make
> > it able to read/write files".
> [...]
> >>>I think there are reasons (speed, speed, speed...) why some things
> >>> should be done kernel-space.
>
> Using a kernel thread won't improve speed, because to do anything you
> will have to context-switch to the thread. For the stuff you want to do
> you are probably better off having a tiny kernel module to intercept the
> events that you're interested in, notifying a userspace process to do

OK - how can I "notify" userspace process? Signals are "weak" - I need to send some data (filename etc.) to process. One solution is "on this signal call this syscall and result of this syscall will be data you need" - but I'd prefer to handle this in one "action".

> the real work. Yes, it will be slower than in kernel space, but only
> slightly. Especially if you use sendfile from the userspace process. And
> it's also good to remember that Linux is optimized for running user
> space processes as fast as possible. :)
>
> --Bart
-
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/