public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Ingo Molnar <mingo@elte.hu>
To: Steven Rostedt <rostedt@goodmis.org>
Cc: LKML <linux-kernel@vger.kernel.org>,
	Peter Zijlstra <a.p.zijlstra@chello.nl>
Subject: Re: [BUG -rt] scheduling in atomic.
Date: Fri, 15 Dec 2006 09:03:16 +0100	[thread overview]
Message-ID: <20061215080316.GA4213@elte.hu> (raw)
In-Reply-To: <1166154463.19210.7.camel@localhost.localdomain>


* Steven Rostedt <rostedt@goodmis.org> wrote:

> Ingo,
> 
> I've hit this. I compiled the kernel as CONFIG_PREEMPT, and turned off
> IRQ's as threads.
> 
> BUG: scheduling while atomic: swapper/0x00000001/1, CPU#3

> int filevec_add_drain_all(void)
> {
> 	return schedule_on_each_cpu(filevec_add_drain_per_cpu, NULL);
> }
> 
> 
> And schedule_on_each_cpu is easily schedulable.
> 
> So it seems that it schedules while holding a spin lock.

hm, indeed. I've Cc:-ed Pete who wrote the file-lock scalability 
patchset. My quick impression is that taking the workqueue_mutex in 
schedule_on_each_cpu() is unwarranted - i.e. the patch below should fix 
it.

	Ingo

Index: linux/kernel/workqueue.c
===================================================================
--- linux.orig/kernel/workqueue.c
+++ linux/kernel/workqueue.c
@@ -564,15 +564,15 @@ int schedule_on_each_cpu(void (*func)(vo
 	if (!works)
 		return -ENOMEM;
 
-	mutex_lock(&workqueue_mutex);
 	for_each_online_cpu(cpu) {
 		INIT_WORK(per_cpu_ptr(works, cpu), func, info);
 		__queue_work(per_cpu_ptr(keventd_wq->cpu_wq, cpu),
 				per_cpu_ptr(works, cpu));
 	}
-	mutex_unlock(&workqueue_mutex);
 	flush_workqueue(keventd_wq);
+
 	free_percpu(works);
+
 	return 0;
 }
 

      reply	other threads:[~2006-12-15  8:07 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-12-15  3:47 [BUG -rt] scheduling in atomic Steven Rostedt
2006-12-15  8:03 ` Ingo Molnar [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=20061215080316.GA4213@elte.hu \
    --to=mingo@elte.hu \
    --cc=a.p.zijlstra@chello.nl \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rostedt@goodmis.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