netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Workqueues vs. kernel threads for processing asynchronous socket events
@ 2010-12-10 15:27 Martin Lucina
  2010-12-23 17:54 ` Martin Sustrik
  0 siblings, 1 reply; 2+ messages in thread
From: Martin Lucina @ 2010-12-10 15:27 UTC (permalink / raw)
  To: netdev; +Cc: Martin Sustrik

Hi,

I'm trying to find the best mechanism to process events from kernel space
sockets in an asynchronous manner. The work in progress code I have at the
moment tries to at least call kernel_accept() on a bound TCP socket when it
gets called by the underlying sk->sk_data_ready callback.

The current approach I have is to use a workqueue and try to schedule work
inside the callback, but this has the kernel complaining about "scheduling
while atomic", so it doesn't look like it's the right approach? Am I
allowed to call schedule_work() from the context of a sk->sk_data_ready
callback or not?

Sunrpc/knfsd appears to use a different approach where
svc_tcp_listen_data_ready() sets the appropriate state and then calls
wake_up_interruptible_all(sk_sleep(sk)) -- it's not clear who this is
waking up, the nfsd kernel thread or someone else?

Any advice on what is the best future-proof approach to use for this kind
of thing in a new project?

-mato

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2010-12-23 17:54 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-12-10 15:27 Workqueues vs. kernel threads for processing asynchronous socket events Martin Lucina
2010-12-23 17:54 ` Martin Sustrik

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).