mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: tip-bot for Yong Zhang <yong.zhang0@gmail.com>
To: linux-tip-commits@vger.kernel.org
Cc: linux-kernel@vger.kernel.org, hpa@zytor.com, mingo@redhat.com,
	a.p.zijlstra@chello.nl, efault@gmx.de, yong.zhang0@gmail.com,
	tglx@linutronix.de, mingo@elte.hu
Subject: [tip:sched/core] sched, autogroup: Stop going ahead if autogroup is disabled
Date: Wed, 23 Feb 2011 12:05:42 GMT	[thread overview]
Message-ID: <tip-800d4d30c8f20bd728e5741a3b77c4859a613f7c@git.kernel.org> (raw)
In-Reply-To: <1298185696-4403-4-git-send-email-yong.zhang0@gmail.com>

Commit-ID:  800d4d30c8f20bd728e5741a3b77c4859a613f7c
Gitweb:     http://git.kernel.org/tip/800d4d30c8f20bd728e5741a3b77c4859a613f7c
Author:     Yong Zhang <yong.zhang0@gmail.com>
AuthorDate: Sun, 20 Feb 2011 15:08:14 +0800
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Wed, 23 Feb 2011 11:33:59 +0100

sched, autogroup: Stop going ahead if autogroup is disabled

when autogroup is disable from the beginning,
sched_autogroup_create_attach()
  autogroup_move_group()                    <== 1
    sched_move_task()                       <== 2
      task_move_group_fair()
        set_task_rq()
          task_group()
            autogroup_task_group()

We go the whole path without doing anything useful.

Then stop going further if autogroup is disabled.

But there will be a race window between 1 and 2, in which
sysctl_sched_autogroup_enabled is enabled. This issue
will be toke by following patch.

Signed-off-by: Yong Zhang <yong.zhang0@gmail.com>
Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Mike Galbraith <efault@gmx.de>
LKML-Reference: <1298185696-4403-4-git-send-email-yong.zhang0@gmail.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
---
 kernel/sched_autogroup.c |    4 ++++
 kernel/sched_autogroup.h |    5 +++++
 2 files changed, 9 insertions(+), 0 deletions(-)

diff --git a/kernel/sched_autogroup.c b/kernel/sched_autogroup.c
index 9fb6562..137a096 100644
--- a/kernel/sched_autogroup.c
+++ b/kernel/sched_autogroup.c
@@ -161,11 +161,15 @@ autogroup_move_group(struct task_struct *p, struct autogroup *ag)
 
 	p->signal->autogroup = autogroup_kref_get(ag);
 
+	if (!ACCESS_ONCE(sysctl_sched_autogroup_enabled))
+		goto out;
+
 	t = p;
 	do {
 		sched_move_task(t);
 	} while_each_thread(p, t);
 
+out:
 	unlock_task_sighand(p, &flags);
 	autogroup_kref_put(prev);
 }
diff --git a/kernel/sched_autogroup.h b/kernel/sched_autogroup.h
index 7b859ff..0557705 100644
--- a/kernel/sched_autogroup.h
+++ b/kernel/sched_autogroup.h
@@ -1,6 +1,11 @@
 #ifdef CONFIG_SCHED_AUTOGROUP
 
 struct autogroup {
+	/*
+	 * reference doesn't mean how many thread attach to this
+	 * autogroup now. It just stands for the number of task
+	 * could use this autogroup.
+	 */
 	struct kref		kref;
 	struct task_group	*tg;
 	struct rw_semaphore	lock;

  reply	other threads:[~2011-02-23 12:06 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-02-20  7:08 [PATCH 0/5] autogroup runtime enable/disable tuning fix Yong Zhang
2011-02-20  7:08 ` [PATCH 1/5] sched, autogroup, sysctl: use proc_dointvec_minmax instead Yong Zhang
2011-02-23 12:05   ` [tip:sched/core] sched, autogroup, sysctl: Use proc_dointvec_minmax() instead tip-bot for Yong Zhang
2011-02-20  7:08 ` [PATCH 2/5] sched: hide cfs_rq of autogroup if autogroup is disabled Yong Zhang
2011-02-20  7:08 ` [PATCH 3/5] sched, autogroup: stop going ahead " Yong Zhang
2011-02-23 12:05   ` tip-bot for Yong Zhang [this message]
2011-02-20  7:08 ` [PATCH 4/5] sched: refactor task_group() Yong Zhang
2011-02-20  7:08 ` [PATCH 5/5] sched, autogroup: runtime enable/disable tuning fix Yong Zhang
2011-02-20 13:09   ` Mike Galbraith
2011-02-20 14:10     ` Yong Zhang
2011-02-20 17:22       ` Mike Galbraith
2011-02-21  3:13         ` Mike Galbraith
2011-02-21  9:05           ` Yong Zhang
2011-02-21 16:36         ` Peter Zijlstra
2011-02-21 21:12           ` Ingo Molnar
2011-02-22  3:13           ` Yong Zhang
2011-02-22  9:56             ` Peter Zijlstra
2011-02-22 12:10               ` [PATCH V2] sched, autogroup: always show autogroup name in sched_debug Yong Zhang
2011-02-22 14:02                 ` Mike Galbraith
2011-02-22 14:32                   ` Yong Zhang
2011-02-23 12:06                   ` [tip:sched/core] sched, autogroup: Stop claiming ownership of the root task group tip-bot for Mike Galbraith

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=tip-800d4d30c8f20bd728e5741a3b77c4859a613f7c@git.kernel.org \
    --to=yong.zhang0@gmail.com \
    --cc=a.p.zijlstra@chello.nl \
    --cc=efault@gmx.de \
    --cc=hpa@zytor.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-tip-commits@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=mingo@redhat.com \
    --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

Powered by JetHome