linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Paul E. McKenney" <paulmck@linux.vnet.ibm.com>
To: Sasha Levin <levinsasha928@gmail.com>
Cc: linux-kernel <linux-kernel@vger.kernel.org>, gregkh@suse.de
Subject: Re: INFO: task rcuc/0:7 blocked for more than 120 seconds.
Date: Tue, 3 Jan 2012 12:27:16 -0800	[thread overview]
Message-ID: <20120103202716.GA8384@linux.vnet.ibm.com> (raw)
In-Reply-To: <20111228042959.GA2477@linux.vnet.ibm.com>

On Tue, Dec 27, 2011 at 08:29:59PM -0800, Paul E. McKenney wrote:
> On Tue, Dec 27, 2011 at 11:13:23AM +0200, Sasha Levin wrote:
> > On Mon, 2011-12-26 at 08:31 -0800, Paul E. McKenney wrote:
> > > Except that when I try looking for task_notify_func() in current mainline,
> > > I get nothing.
> > > 
> > > Where is task_notify_func() coming from? 
> > 
> > I was testing linux-next, it actually comes from the android tree:
> > drivers/staging/android/lowmemorykiller.c
> 
> That does sound familiar...  I wonder if the stuff in staging is current
> Android or historical stuff.

And memory did serve for once.  ;-)

Current Android has the following for task_notify_func():

static int
task_notify_func(struct notifier_block *self, unsigned long val, void *data)
{
	struct task_struct *task = data;

	if (task == lowmem_deathpending)
		lowmem_deathpending = NULL;

	return NOTIFY_OK;
}

This is from https://android.googlesource.com/kernel/common.git.

Commit 5545554aac04918ece318270d63cbfcb015577a9 fixed this problem.
The commit is shown below, FYI.

Greg, would it be possible to pull in the current Android code?  There
have been a few fixes.  ;-)

							Thanx, Paul

------------------------------------------------------------------------

commit 5545554aac04918ece318270d63cbfcb015577a9
Author: Rabin Vincent <rabin.vincent@stericsson.com>
Date:   Thu Sep 9 10:48:21 2010 +0530

    lowmemorykiller: don't unregister notifier from atomic context
    
    The lowmemorykiller registers an atomic notifier for notfication of when
    the task is freed.  From this atomic notifier callback, it removes the
    atomic notifier via task_free_unregister().  This is incorrect because
    atomic_notifier_chain_unregister() calls syncronize_rcu(), which can
    sleep, which shouldn't be done from an atomic notifier.
    
    Fix this by registering the notifier during init, and only unregister it
    if the lowmemorykiller is unloaded.
    
    Change-Id: I1577b04e617bc2b2e39dcb490fcfc9ce660eb7ec
    Signed-off-by: Rabin Vincent <rabin.vincent@stericsson.com>
    Signed-off-by: Christian Bejram <christian.bejram@stericsson.com>

diff --git a/drivers/staging/android/lowmemorykiller.c b/drivers/staging/android/lowmemorykiller.c
index 8b67ac0..efbe556 100644
--- a/drivers/staging/android/lowmemorykiller.c
+++ b/drivers/staging/android/lowmemorykiller.c
@@ -71,10 +71,10 @@ static int
 task_notify_func(struct notifier_block *self, unsigned long val, void *data)
 {
 	struct task_struct *task = data;
-	if (task == lowmem_deathpending) {
+
+	if (task == lowmem_deathpending)
 		lowmem_deathpending = NULL;
-		task_free_unregister(&task_nb);
-	}
+
 	return NOTIFY_OK;
 }
 
@@ -168,7 +168,6 @@ static int lowmem_shrink(struct shrinker *s, int nr_to_scan, gfp_t gfp_mask)
 			     selected->pid, selected->comm,
 			     selected_oom_adj, selected_tasksize);
 		lowmem_deathpending = selected;
-		task_free_register(&task_nb);
 		force_sig(SIGKILL, selected);
 		rem -= selected_tasksize;
 	}
@@ -185,6 +184,7 @@ static struct shrinker lowmem_shrinker = {
 
 static int __init lowmem_init(void)
 {
+	task_free_register(&task_nb);
 	register_shrinker(&lowmem_shrinker);
 	return 0;
 }
@@ -192,6 +192,7 @@ static int __init lowmem_init(void)
 static void __exit lowmem_exit(void)
 {
 	unregister_shrinker(&lowmem_shrinker);
+	task_free_unregister(&task_nb);
 }
 
 module_param_named(cost, lowmem_shrinker.seeks, int, S_IRUGO | S_IWUSR);


  reply	other threads:[~2012-01-03 20:27 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-12-26 12:16 INFO: task rcuc/0:7 blocked for more than 120 seconds Sasha Levin
2011-12-26 16:31 ` Paul E. McKenney
2011-12-26 16:37   ` Frederic Weisbecker
2011-12-26 19:56     ` Paul E. McKenney
2012-01-04 19:03       ` [PATCH] rcu: Improve detection of illegal synchronize_rcu() call from RCU read side Frederic Weisbecker
2012-01-04 21:30         ` Paul E. McKenney
2012-01-05  1:45           ` Frederic Weisbecker
2012-01-05  2:01             ` Paul E. McKenney
2012-01-05  2:06               ` Frederic Weisbecker
2012-01-05  2:17                 ` Paul E. McKenney
2011-12-27  9:13   ` INFO: task rcuc/0:7 blocked for more than 120 seconds Sasha Levin
2011-12-28  4:29     ` Paul E. McKenney
2012-01-03 20:27       ` Paul E. McKenney [this message]
2012-01-03 20:37         ` Greg KH
2012-01-03 21:38           ` Paul E. McKenney
2012-01-03 21:50             ` Greg KH
2012-01-03 22:26               ` Paul E. McKenney
2012-01-03 22:33                 ` Paul E. McKenney

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=20120103202716.GA8384@linux.vnet.ibm.com \
    --to=paulmck@linux.vnet.ibm.com \
    --cc=gregkh@suse.de \
    --cc=levinsasha928@gmail.com \
    --cc=linux-kernel@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).