public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Li Zefan <lizefan@huawei.com>
To: Ingo Molnar <mingo@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>,
	LKML <linux-kernel@vger.kernel.org>
Subject: [PATCH 4/9] sched: Move struct sched_group to kernel/sched/sched.h
Date: Tue, 5 Mar 2013 16:06:23 +0800	[thread overview]
Message-ID: <5135A77F.2010705@huawei.com> (raw)
In-Reply-To: <5135A736.8050104@huawei.com>

Move struct sched_group_power and sched_group and related inline
functions to kernel/sched/sched.h, as they are used internally only.

Signed-off-by: Li Zefan <lizefan@huawei.com>
---
 include/linux/sched.h | 58 ++-------------------------------------------------
 kernel/sched/sched.h  | 56 +++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 58 insertions(+), 56 deletions(-)

diff --git a/include/linux/sched.h b/include/linux/sched.h
index f8826d0..0d64130 100644
--- a/include/linux/sched.h
+++ b/include/linux/sched.h
@@ -780,62 +780,6 @@ enum cpu_idle_type {
 
 extern int __weak arch_sd_sibiling_asym_packing(void);
 
-struct sched_group_power {
-	atomic_t ref;
-	/*
-	 * CPU power of this group, SCHED_LOAD_SCALE being max power for a
-	 * single CPU.
-	 */
-	unsigned int power, power_orig;
-	unsigned long next_update;
-	/*
-	 * Number of busy cpus in this group.
-	 */
-	atomic_t nr_busy_cpus;
-
-	unsigned long cpumask[0]; /* iteration mask */
-};
-
-struct sched_group {
-	struct sched_group *next;	/* Must be a circular list */
-	atomic_t ref;
-
-	unsigned int group_weight;
-	struct sched_group_power *sgp;
-
-	/*
-	 * The CPUs this group covers.
-	 *
-	 * NOTE: this field is variable length. (Allocated dynamically
-	 * by attaching extra space to the end of the structure,
-	 * depending on how many CPUs the kernel has booted up with)
-	 */
-	unsigned long cpumask[0];
-};
-
-static inline struct cpumask *sched_group_cpus(struct sched_group *sg)
-{
-	return to_cpumask(sg->cpumask);
-}
-
-/*
- * cpumask masking which cpus in the group are allowed to iterate up the domain
- * tree.
- */
-static inline struct cpumask *sched_group_mask(struct sched_group *sg)
-{
-	return to_cpumask(sg->sgp->cpumask);
-}
-
-/**
- * group_first_cpu - Returns the first cpu in the cpumask of a sched_group.
- * @group: The group whose first cpu is to be returned.
- */
-static inline unsigned int group_first_cpu(struct sched_group *group)
-{
-	return cpumask_first(sched_group_cpus(group));
-}
-
 struct sched_domain_attr {
 	int relax_domain_level;
 };
@@ -846,6 +790,8 @@ struct sched_domain_attr {
 
 extern int sched_domain_level_max;
 
+struct sched_group;
+
 struct sched_domain {
 	/* These fields must be setup */
 	struct sched_domain *parent;	/* top domain must be null terminated */
diff --git a/kernel/sched/sched.h b/kernel/sched/sched.h
index 709a30c..1a4a2b1 100644
--- a/kernel/sched/sched.h
+++ b/kernel/sched/sched.h
@@ -572,6 +572,62 @@ static inline struct sched_domain *highest_flag_domain(int cpu, int flag)
 DECLARE_PER_CPU(struct sched_domain *, sd_llc);
 DECLARE_PER_CPU(int, sd_llc_id);
 
+struct sched_group_power {
+	atomic_t ref;
+	/*
+	 * CPU power of this group, SCHED_LOAD_SCALE being max power for a
+	 * single CPU.
+	 */
+	unsigned int power, power_orig;
+	unsigned long next_update;
+	/*
+	 * Number of busy cpus in this group.
+	 */
+	atomic_t nr_busy_cpus;
+
+	unsigned long cpumask[0]; /* iteration mask */
+};
+
+struct sched_group {
+	struct sched_group *next;	/* Must be a circular list */
+	atomic_t ref;
+
+	unsigned int group_weight;
+	struct sched_group_power *sgp;
+
+	/*
+	 * The CPUs this group covers.
+	 *
+	 * NOTE: this field is variable length. (Allocated dynamically
+	 * by attaching extra space to the end of the structure,
+	 * depending on how many CPUs the kernel has booted up with)
+	 */
+	unsigned long cpumask[0];
+};
+
+static inline struct cpumask *sched_group_cpus(struct sched_group *sg)
+{
+	return to_cpumask(sg->cpumask);
+}
+
+/*
+ * cpumask masking which cpus in the group are allowed to iterate up the domain
+ * tree.
+ */
+static inline struct cpumask *sched_group_mask(struct sched_group *sg)
+{
+	return to_cpumask(sg->sgp->cpumask);
+}
+
+/**
+ * group_first_cpu - Returns the first cpu in the cpumask of a sched_group.
+ * @group: The group whose first cpu is to be returned.
+ */
+static inline unsigned int group_first_cpu(struct sched_group *group)
+{
+	return cpumask_first(sched_group_cpus(group));
+}
+
 extern int group_balance_cpu(struct sched_group *sg);
 
 #endif /* CONFIG_SMP */
-- 
1.8.0.2

  parent reply	other threads:[~2013-03-05  8:07 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-03-05  8:05 [PATCH 0/9] sched: Shrink include/linux/sched.h Li Zefan
2013-03-05  8:05 ` [PATCH 1/9] sched: Remove some dummpy functions Li Zefan
2013-03-06 14:32   ` [tip:sched/core] sched: Remove some dummy functions tip-bot for Li Zefan
2013-03-05  8:05 ` [PATCH 2/9] sched: Remove test_sd_parent() Li Zefan
2013-03-06 14:34   ` [tip:sched/core] " tip-bot for Li Zefan
2013-03-05  8:06 ` [PATCH 3/9] sched: Move SCHED_LOAD_SHIFT macros to kernel/sched/sched.h Li Zefan
2013-03-06 14:35   ` [tip:sched/core] sched: Move SCHED_LOAD_SHIFT macros to kernel/ sched/sched.h tip-bot for Li Zefan
2013-03-05  8:06 ` Li Zefan [this message]
2013-03-06 14:36   ` [tip:sched/core] sched: Move struct sched_group to kernel/sched/ sched.h tip-bot for Li Zefan
2013-03-05  8:06 ` [PATCH 5/9] sched: Move wake flags to kernel/sched/sched.h Li Zefan
2013-03-06 14:37   ` [tip:sched/core] " tip-bot for Li Zefan
2013-03-05  8:06 ` [PATCH 6/9] sched: Move struct sched_class " Li Zefan
2013-03-06 14:38   ` [tip:sched/core] sched: Move struct sched_class to kernel/sched/ sched.h tip-bot for Li Zefan
2013-03-05  8:07 ` [PATCH 7/9] sched: Make default_scale_freq_power() static Li Zefan
2013-03-06 14:40   ` [tip:sched/core] " tip-bot for Li Zefan
2013-03-05  8:07 ` [PATCH 8/9] sched: Move group scheduling functions out of include/linux/sched.h Li Zefan
2013-03-06 14:41   ` [tip:sched/core] " tip-bot for Li Zefan
2013-03-05  8:07 ` [PATCH 9/9] sched: Remove double declaration of root_task_group Li Zefan
2013-03-06 14:42   ` [tip:sched/core] " tip-bot for Li Zefan
2013-03-05 16:43 ` [PATCH 0/9] sched: Shrink include/linux/sched.h Lai Jiangshan

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=5135A77F.2010705@huawei.com \
    --to=lizefan@huawei.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=peterz@infradead.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