[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <4D138CDC.3000504@250bpm.com>
Date: Thu, 23 Dec 2010 18:54:36 +0100
From: Martin Sustrik <sustrik@...bpm.com>
To: Martin Lucina <mato@...elna.sk>
CC: netdev@...r.kernel.org
Subject: Re: Workqueues vs. kernel threads for processing asynchronous socket
events
On 12/10/2010 04:27 PM, Martin Lucina wrote:
> 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?
It turns out that the issue was caused by kmalloc(GFP_KERNEL) in the
callback function, not the schedule_work() function. Using GFP_ATOMIC
instead solves the problem.
Sorry for the annoyance.
Martin
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists