public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Bill Huey (hui) <billh@gnuppy.monkey.org>
To: Steven Rostedt <rostedt@goodmis.org>
Cc: Robert Crocombe <rcrocomb@gmail.com>,
	linux-kernel@vger.kernel.org, Ingo Molnar <mingo@elte.hu>,
	Thomas Gleixner <tglx@linutronix.de>,
	Darren Hart <dvhltc@us.ibm.com>,
	"Bill Huey (hui)" <billh@gnuppy.monkey.org>
Subject: Re: [Patch] restore the RCU callback to defer put_task_struct() Re: Problems with 2.6.17-rt8
Date: Mon, 7 Aug 2006 20:05:24 -0700	[thread overview]
Message-ID: <20060808030524.GA20530@gnuppy.monkey.org> (raw)
In-Reply-To: <20060808025615.GA20364@gnuppy.monkey.org>

[-- Attachment #1: Type: text/plain, Size: 1209 bytes --]

On Mon, Aug 07, 2006 at 07:56:15PM -0700, Bill Huey wrote:
> On Thu, Aug 03, 2006 at 10:27:41AM -0400, Steven Rostedt wrote:
> 
> ...(output and commentary a log deleted)...
> 
> > This could also have a side effect that messes things up.
> > 
> > Unfortunately, right now I'm assigned to other tasks and I cant spend
> > much more time on this at the moment.  So hopefully, Ingo, Thomas or
> > Bill, or someone else can help you find the reason for this problem.
> 
> Steve and company,
> 
> Speaking of which, after talking to Steve about this and confirming this
> with a revert of changes. put_task_struct() can't deallocated memory from
> either the zone or SLAB cache without taking a sleeping lock. It can't
> be called directly from finish_task_switch to reap the thread because of
> that (violation in atomic).
> 
> It is for this reason the RCU call back to delay processing was put into
> place to reap threads and was, seemingly by accident, missing from
> patch-2.6.17-rt7 to -rt8. That is what broke it in the first place.
> 
> I tested it with a "make -j4" which triggers the warning and it they all
> go away now.
> 
> Reverse patch attached:

Resend with instrumentation code removed:

bill


[-- Attachment #2: t.diff --]
[-- Type: text/plain, Size: 1940 bytes --]

============================================================
--- include/linux/sched.h	0ed8993484be9c13728f4ebdaa51fc0f0c229018
+++ include/linux/sched.h	db79c6b458b0776d3768141ff993a7c9e64d5794
@@ -1105,6 +1110,15 @@
 extern void free_task(struct task_struct *tsk);
 #define get_task_struct(tsk) do { atomic_inc(&(tsk)->usage); } while(0)
 
+#ifdef CONFIG_PREEMPT_RT
+extern void __put_task_struct_cb(struct rcu_head *rhp);
+
+static inline void put_task_struct(struct task_struct *t)
+{
+	if (atomic_dec_and_test(&t->usage))
+		call_rcu(&t->rcu, __put_task_struct_cb);
+}
+#else
 extern void __put_task_struct(struct task_struct *t);
 
 static inline void put_task_struct(struct task_struct *t)
@@ -1112,6 +1126,7 @@
 	if (atomic_dec_and_test(&t->usage))
 		__put_task_struct(t);
 }
+#endif
 
 /*
  * Per process flags
============================================================
--- kernel/fork.c	506dabd42d242f78e0321594c7723481e0cd87dc
+++ kernel/fork.c	d07df07ac627dd27933b4bfb83768461ef28731c
@@ -54,6 +54,8 @@
 #include <asm/cacheflush.h>
 #include <asm/tlbflush.h>
 
+#include <linux/dobject.h>
+
 /*
  * Protected counters by write_lock_irq(&tasklist_lock)
  */
@@ -120,6 +122,26 @@
 }
 EXPORT_SYMBOL(free_task);
 
+#ifdef CONFIG_PREEMPT_RT
+void __put_task_struct_cb(struct rcu_head *rhp)
+{
+	struct task_struct *tsk = container_of(rhp, struct task_struct, rcu);
+
+	BUG_ON(atomic_read(&tsk->usage));
+	WARN_ON(!(tsk->flags & PF_DEAD));
+	WARN_ON(!(tsk->exit_state & (EXIT_DEAD | EXIT_ZOMBIE)));
+	WARN_ON(tsk == current);
+
+	security_task_free(tsk);
+	free_uid(tsk->user);
+	put_group_info(tsk->group_info);
+
+	if (!profile_handoff_task(tsk))
+		free_task(tsk);
+}
+
+#else
+
 void __put_task_struct(struct task_struct *tsk)
 {
 	WARN_ON(!(tsk->exit_state & (EXIT_DEAD | EXIT_ZOMBIE)));
@@ -134,6 +156,7 @@
 	if (!profile_handoff_task(tsk))
 		free_task(tsk);
 }
+#endif
 
 void __init fork_init(unsigned long mempages)
 {
 

  reply	other threads:[~2006-08-08  3:05 UTC|newest]

Thread overview: 58+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <e6babb600608012231r74470b77x6e7eaeab222ee160@mail.gmail.com>
2006-08-02  5:37 ` Problems with 2.6.17-rt8 Robert Crocombe
2006-08-02 17:51   ` Steven Rostedt
2006-08-03 11:48     ` Robert Crocombe
2006-08-03 14:27       ` Steven Rostedt
2006-08-03 15:08         ` Robert Crocombe
2006-08-03 15:27           ` Steven Rostedt
2006-08-03 15:48             ` Robert Crocombe
2006-08-03 16:04               ` Steven Rostedt
2006-08-03 17:16                 ` Robert Crocombe
2006-08-03 20:22         ` Bill Huey
2006-08-03 20:54           ` Steven Rostedt
2006-08-03 21:18             ` Bill Huey
2006-08-08  2:56         ` [Patch] restore the RCU callback to defer put_task_struct() " Bill Huey
2006-08-08  3:05           ` Bill Huey [this message]
2006-08-08 18:46             ` Robert Crocombe
2006-08-08 19:06               ` Steven Rostedt
2006-08-08 21:35                 ` Robert Crocombe
2006-08-08 21:44                   ` Steven Rostedt
2006-08-08 22:10                     ` Robert Crocombe
2006-08-09 17:19                   ` Robert Crocombe
2006-08-09  0:35               ` Bill Huey
2006-08-11  7:47               ` Bill Huey
2006-08-11 14:52                 ` Robert Crocombe
2006-08-09 22:05             ` Esben Nielsen
2006-08-10  0:00               ` Steven Rostedt
2006-08-10  2:18               ` Bill Huey
2006-08-11  1:06                 ` Bill Huey
2006-08-11  8:16                   ` Esben Nielsen
2006-08-11  8:46                     ` Bill Huey
2006-08-11 15:00                   ` Robert Crocombe
2006-08-11 21:18                     ` Bill Huey
     [not found]                       ` <20060811221054.GA32459@gnuppy.monkey.org>
2006-08-14 17:56                         ` Robert Crocombe
2006-08-14 23:44                           ` Bill Huey
2006-08-15 10:43                             ` Bill Huey
2006-08-15 17:53                             ` Robert Crocombe
2006-08-18 11:59                               ` Bill Huey
2006-08-22  0:21                                 ` Robert Crocombe
2006-08-22  1:37                                   ` rtmutex assert failure (was [Patch] restore the RCU callback...) Bill Huey
2006-08-22 23:20                                     ` Bill Huey
2006-08-22 23:21                                       ` Bill Huey
2006-08-23 17:14                                       ` Robert Crocombe
2006-08-23 17:24                                         ` Robert Crocombe
2006-08-23 20:20                                         ` Bill Huey
2006-08-23 21:05                                           ` Bill Huey
2006-08-23 21:08                                             ` Bill Huey
2006-08-24  1:22                                               ` Robert Crocombe
2006-08-24  1:46                                                 ` Bill Huey
2006-08-25  7:19                                                   ` Bill Huey
2006-08-26  1:24                                                     ` Robert Crocombe
2006-08-26  1:28                                                       ` Robert Crocombe
2006-08-26  2:37                                                         ` Robert Crocombe
2006-08-26 10:28                                                       ` Bill Huey
2006-08-26 10:49                                                       ` Bill Huey
2006-08-28 18:33                                                         ` Robert Crocombe
2006-08-28 20:28                                                           ` Bill Huey
2006-08-29  4:05                                                             ` Robert Crocombe
2006-08-29 17:11                                                               ` Bill Huey
2006-08-29 17:19                                                                 ` Robert Crocombe

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=20060808030524.GA20530@gnuppy.monkey.org \
    --to=billh@gnuppy.monkey.org \
    --cc=dvhltc@us.ibm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=rcrocomb@gmail.com \
    --cc=rostedt@goodmis.org \
    --cc=tglx@linutronix.de \
    /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