netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Martin Sustrik <sustrik@250bpm.com>
To: Martin Lucina <mato@kotelna.sk>
Cc: netdev@vger.kernel.org
Subject: Re: Workqueues vs. kernel threads for processing asynchronous socket events
Date: Thu, 23 Dec 2010 18:54:36 +0100	[thread overview]
Message-ID: <4D138CDC.3000504@250bpm.com> (raw)
In-Reply-To: <20101210152754.GC28580@dezo.moloch.sk>

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

      reply	other threads:[~2010-12-23 17:54 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-12-10 15:27 Workqueues vs. kernel threads for processing asynchronous socket events Martin Lucina
2010-12-23 17:54 ` Martin Sustrik [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4D138CDC.3000504@250bpm.com \
    --to=sustrik@250bpm.com \
    --cc=mato@kotelna.sk \
    --cc=netdev@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).