Skip to contentSkip to conversation

change 64 bit variables to long type

RFC PATCH In review Alex Shi 3 participants 20 messages Jun 7, 2013 – Jun 18, 2013 Scheduler

lore
Share & tools
lore

Alex Shi

author
#0 lore raw

cover change 64 bit variables to long type

There are some 64 bits variables in cfs_rq/tg etc. That ask expersive operations in 32 bit machine. But in fact, long type is enough for them.

So do this change lead more efficient code and without data lose.

Regards
Alex

author
#1 lore raw

RFC PATCH 1/4 sched: change cfs_rq load avg to unsigned long

Since the 'u64 runnable_load_avg, blocked_load_avg' in cfs_rq struct are smaller than 'unsigned long' cfs_rq->load.weight. We don't need u64 vaiables to describe them. unsigned long is more efficient and convenience.

---
 kernel/sched/debug.c | 4 ++--
 kernel/sched/sched.h | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)
kernel/sched/debug.c +2 -2
index 75024a6..160afdc 100644
@@ -211,9 +211,9 @@ void print_cfs_rq(struct seq_file *m, int cpu, struct cfs_rq *cfs_rq)
 	SEQ_printf(m, "  .%-30s: %ld\n", "load", cfs_rq->load.weight);
 #ifdef CONFIG_FAIR_GROUP_SCHED
 #ifdef CONFIG_SMP
-	SEQ_printf(m, "  .%-30s: %lld\n", "runnable_load_avg",
+	SEQ_printf(m, "  .%-30s: %ld\n", "runnable_load_avg",
 			cfs_rq->runnable_load_avg);
-	SEQ_printf(m, "  .%-30s: %lld\n", "blocked_load_avg",
+	SEQ_printf(m, "  .%-30s: %ld\n", "blocked_load_avg",
 			cfs_rq->blocked_load_avg);
 	SEQ_printf(m, "  .%-30s: %lld\n", "tg_load_avg",
 			(unsigned long long)atomic64_read(&cfs_rq->tg->load_avg));
kernel/sched/sched.h +1 -1
index 8bc66c6..5a80943 100644
@@ -277,7 +277,7 @@ struct cfs_rq {
 	 * This allows for the description of both thread and group usage (in
 	 * the FAIR_GROUP_SCHED case).
 	 */
-	u64 runnable_load_avg, blocked_load_avg;
+	unsigned long runnable_load_avg, blocked_load_avg;
 	atomic64_t decay_counter, removed_load;
 	u64 last_decay;
 
Signature · 1 line
1.7.12
maintainer
#2 lore raw

Re: [RFC patch 1/4] sched: change cfs_rq load avg to unsigned long

Quoted 4 lines · Alex Shi

Since the 'u64 runnable_load_avg, blocked_load_avg' in cfs_rq struct are smaller than 'unsigned long' cfs_rq->load.weight. We don't need u64 vaiables to describe them. unsigned long is more efficient and convenience.

Hi Alex,

I just want to point out that we can't have more than 48388 tasks with highest priority on a runqueue with an unsigned long on a 32 bits system. I don't know if we can reach such kind of limit on a 32bits machine ? For sure, not on an embedded system.

Regards,
Vincent

Quoted 38 lines
---
 kernel/sched/debug.c | 4 ++--
 kernel/sched/sched.h | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)
kernel/sched/debug.c +2 -2
index 75024a6..160afdc 100644
@@ -211,9 +211,9 @@ void print_cfs_rq(struct seq_file *m, int cpu, struct cfs_rq *cfs_rq)
        SEQ_printf(m, "  .%-30s: %ld\n", "load", cfs_rq->load.weight);
 #ifdef CONFIG_FAIR_GROUP_SCHED
 #ifdef CONFIG_SMP
-       SEQ_printf(m, "  .%-30s: %lld\n", "runnable_load_avg",
+       SEQ_printf(m, "  .%-30s: %ld\n", "runnable_load_avg",
                        cfs_rq->runnable_load_avg);
-       SEQ_printf(m, "  .%-30s: %lld\n", "blocked_load_avg",
+       SEQ_printf(m, "  .%-30s: %ld\n", "blocked_load_avg",
                        cfs_rq->blocked_load_avg);
        SEQ_printf(m, "  .%-30s: %lld\n", "tg_load_avg",
                        (unsigned long long)atomic64_read(&cfs_rq->tg->load_avg));
kernel/sched/sched.h +1 -2
index 8bc66c6..5a80943 100644
@@ -277,7 +277,7 @@ struct cfs_rq {
         * This allows for the description of both thread and group usage (in
         * the FAIR_GROUP_SCHED case).
         */
-       u64 runnable_load_avg, blocked_load_avg;
+       unsigned long runnable_load_avg, blocked_load_avg;
        atomic64_t decay_counter, removed_load;
        u64 last_decay;
 
--

1.7.12

author
#3 lore raw

Re: [RFC patch 1/4] sched: change cfs_rq load avg to unsigned long

Quoted 11 lines · Vincent Guittot
Quoted 4 lines · Alex Shi
Quoted 4 lines

Since the 'u64 runnable_load_avg, blocked_load_avg' in cfs_rq struct are smaller than 'unsigned long' cfs_rq->load.weight. We don't need u64 vaiables to describe them. unsigned long is more efficient and convenience.

Hi Alex,

I just want to point out that we can't have more than 48388 tasks with highest priority on a runqueue with an unsigned long on a 32 bits system. I don't know if we can reach such kind of limit on a 32bits machine ? For sure, not on an embedded system.

Thanks question!
It should be a talked problem. I just remember the conclusion is when you get the up bound task number, you already run out the memory space on 32 bit.

Just for kernel resource for a process, it need 2 pages stack. mm_struct, task_struct, task_stats, vm_area_struct, page table etc. these are already beyond 4 pages. so 4 * 4k * 48388 = 774MB. plus user level resources.

So, usually the limited task number in Linux is often far lower this
number: $ulimit -u.

Anyway, at least, the runnable_load_avg is smaller then load.weight. if load.weight can use long type, runablle_load_avg is no reason can't.

Signature · 2 lines
Thanks
    Alex
Reviewed-by
#4 lore raw

Re: [RFC patch 1/4] sched: change cfs_rq load avg to unsigned long

Quoted 6 lines · Alex Shi
Quoted 5 lines · Vincent Guittot
Quoted 4 lines · Alex Shi
Quoted 4 lines

Since the 'u64 runnable_load_avg, blocked_load_avg' in cfs_rq struct are smaller than 'unsigned long' cfs_rq->load.weight. We don't need u64 vaiables to describe them. unsigned long is more efficient and convenience.

Quoted 6 lines
Quoted 6 lines

Hi Alex,

I just want to point out that we can't have more than 48388 tasks with highest priority on a runqueue with an unsigned long on a 32 bits system. I don't know if we can reach such kind of limit on a 32bits machine ? For sure, not on an embedded system.

This should be ok.

Note that:
runnable_load_avg = \Sum se->load_avg_contrib <= \Sum
se->load.weight = cfs_rq->load.weight

And load_weight uses unsigned longs also.

blocked_load_avg must be also safe since anything appearing in blocked load could have appeared in runnable load and we've said that was ok above.

Quoted 20 lines

Thanks question!
It should be a talked problem. I just remember the conclusion is when you get the up bound task number, you already run out the memory space on 32 bit.

Just for kernel resource for a process, it need 2 pages stack. mm_struct, task_struct, task_stats, vm_area_struct, page table etc. these are already beyond 4 pages. so 4 * 4k * 48388 = 774MB. plus user level resources.

So, usually the limited task number in Linux is often far lower this
number: $ulimit -u.

Anyway, at least, the runnable_load_avg is smaller then load.weight. if load.weight can use long type, runablle_load_avg is no reason can't.

--
Thanks
Alex

author
#5 lore raw

Re: [RFC patch 1/4] sched: change cfs_rq load avg to unsigned long

Quoted 12 lines · Paul Turner
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines

Hi Alex,

I just want to point out that we can't have more than 48388 tasks with highest priority on a runqueue with an unsigned long on a 32 bits system. I don't know if we can reach such kind of limit on a 32bits machine ? For sure, not on an embedded system.

This should be ok.

Note that:
runnable_load_avg = \Sum se->load_avg_contrib <= \Sum
se->load.weight = cfs_rq->load.weight

Quoted 8 lines

And load_weight uses unsigned longs also.

blocked_load_avg must be also safe since anything appearing in blocked load could have appeared in runnable load and we've said that was ok above.

thanks for review!

Signature · 2 lines
Thanks
    Alex
maintainer
#6 lore raw

Re: [RFC patch 1/4] sched: change cfs_rq load avg to unsigned long

In reply to Alex Shi
Quoted 23 lines · Alex Shi
Quoted 11 lines · Vincent Guittot
Quoted 4 lines · Alex Shi
Quoted 4 lines

Since the 'u64 runnable_load_avg, blocked_load_avg' in cfs_rq struct are smaller than 'unsigned long' cfs_rq->load.weight. We don't need u64 vaiables to describe them. unsigned long is more efficient and convenience.

Hi Alex,

I just want to point out that we can't have more than 48388 tasks with highest priority on a runqueue with an unsigned long on a 32 bits system. I don't know if we can reach such kind of limit on a 32bits machine ? For sure, not on an embedded system.

Thanks question!
It should be a talked problem. I just remember the conclusion is when you get the up bound task number, you already run out the memory space on 32 bit.

Just for kernel resource for a process, it need 2 pages stack. mm_struct, task_struct, task_stats, vm_area_struct, page table etc. these are already beyond 4 pages. so 4 * 4k * 48388 = 774MB. plus user level resources.

Quoted 5 lines

So, usually the limited task number in Linux is often far lower this
number: $ulimit -u.

Anyway, at least, the runnable_load_avg is smaller then load.weight. if load.weight can use long type, runablle_load_avg is no reason can't.

Alex,

You can add my tested-by for this patchset.

Regards,
Vincent

Quoted 9 lines

--
Thanks
Alex
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

author
#7 lore raw

Re: [RFC patch 1/4] sched: change cfs_rq load avg to unsigned long

Quoted 8 lines · Vincent Guittot
Quoted 5 lines
Quoted 5 lines

So, usually the limited task number in Linux is often far lower this
number: $ulimit -u.

Anyway, at least, the runnable_load_avg is smaller then load.weight. if load.weight can use long type, runablle_load_avg is no reason can't.

Alex,

You can add my tested-by for this patchset.

thanks for test!

Signature · 2 lines
Thanks
    Alex
author Reviewed-by Paul Turner Tested-by Vincent Guittot on v1 1/4
#8 lore raw

Re: [RFC patch 1/4] sched: change cfs_rq load avg to unsigned long

In reply to Alex Shi
Quoted 4 lines · Alex Shi

Since the 'u64 runnable_load_avg, blocked_load_avg' in cfs_rq struct are smaller than 'unsigned long' cfs_rq->load.weight. We don't need u64 vaiables to describe them. unsigned long is more efficient and convenience.

update with a a bit clean up in tg_load_down()
---

Quoted 1 line

From e78ccc55dff1a5ef406a100f6453d0b8c86ca310 Mon Sep 17 00:00:00 2001

From: Alex Shi <[email protected]>
Date: Thu, 6 Jun 2013 20:12:36 +0800
Subject: [PATCH 1/5] sched: change cfs_rq load avg to unsigned long

Since the 'u64 runnable_load_avg, blocked_load_avg' in cfs_rq struct are smaller than 'unsigned long' cfs_rq->load.weight. We don't need u64 variables to describe them. unsigned long is more efficient and convenience.

---
 kernel/sched/debug.c | 4 ++--
 kernel/sched/fair.c  | 7 ++-----
 kernel/sched/sched.h | 2 +-
 3 files changed, 5 insertions(+), 8 deletions(-)
kernel/sched/debug.c +2 -2
index 75024a6..160afdc 100644
@@ -211,9 +211,9 @@ void print_cfs_rq(struct seq_file *m, int cpu, struct cfs_rq *cfs_rq)
 	SEQ_printf(m, "  .%-30s: %ld\n", "load", cfs_rq->load.weight);
 #ifdef CONFIG_FAIR_GROUP_SCHED
 #ifdef CONFIG_SMP
-	SEQ_printf(m, "  .%-30s: %lld\n", "runnable_load_avg",
+	SEQ_printf(m, "  .%-30s: %ld\n", "runnable_load_avg",
 			cfs_rq->runnable_load_avg);
-	SEQ_printf(m, "  .%-30s: %lld\n", "blocked_load_avg",
+	SEQ_printf(m, "  .%-30s: %ld\n", "blocked_load_avg",
 			cfs_rq->blocked_load_avg);
 	SEQ_printf(m, "  .%-30s: %lld\n", "tg_load_avg",
 			(unsigned long long)atomic64_read(&cfs_rq->tg->load_avg));
kernel/sched/fair.c +2 -5
index 395f57c..39a5bae 100644
@@ -4186,12 +4186,9 @@ static int tg_load_down(struct task_group *tg, void *data)
 	if (!tg->parent) {
 		load = cpu_rq(cpu)->avg.load_avg_contrib;
 	} else {
-		unsigned long tmp_rla;
-		tmp_rla = tg->parent->cfs_rq[cpu]->runnable_load_avg + 1;
-
 		load = tg->parent->cfs_rq[cpu]->h_load;
-		load *= tg->se[cpu]->avg.load_avg_contrib;
-		load /= tmp_rla;
+		load = div64_ul(load * tg->se[cpu]->avg.load_avg_contrib,
+				tg->parent->cfs_rq[cpu]->runnable_load_avg + 1);
 	}
 
 	tg->cfs_rq[cpu]->h_load = load;
kernel/sched/sched.h +1 -1
index 0684c26..762fa63 100644
@@ -277,7 +277,7 @@ struct cfs_rq {
 	 * This allows for the description of both thread and group usage (in
 	 * the FAIR_GROUP_SCHED case).
 	 */
-	u64 runnable_load_avg, blocked_load_avg;
+	unsigned long runnable_load_avg, blocked_load_avg;
 	atomic64_t decay_counter, removed_load;
 	u64 last_decay;
 
Signature · 1 line
1.7.12
author
#9 lore raw

RFC PATCH 2/4 sched/tg: use 'unsigned long' for load variable in task group

In reply to Alex Shi

Since tg->load_avg is smaller than tg->load_weight, we don't need a atomic64_t variable for load_avg in 32 bit machine.
The same reason for cfs_rq->tg_load_contrib.

The atomic_long_t/unsigned long variable type are more efficient and convenience for them.

---
 kernel/sched/debug.c |  6 +++---
 kernel/sched/fair.c  | 12 ++++++------
 kernel/sched/sched.h |  4 ++--
 3 files changed, 11 insertions(+), 11 deletions(-)
kernel/sched/debug.c +3 -3
index 160afdc..d803989 100644
@@ -215,9 +215,9 @@ void print_cfs_rq(struct seq_file *m, int cpu, struct cfs_rq *cfs_rq)
 			cfs_rq->runnable_load_avg);
 	SEQ_printf(m, "  .%-30s: %ld\n", "blocked_load_avg",
 			cfs_rq->blocked_load_avg);
-	SEQ_printf(m, "  .%-30s: %lld\n", "tg_load_avg",
-			(unsigned long long)atomic64_read(&cfs_rq->tg->load_avg));
-	SEQ_printf(m, "  .%-30s: %lld\n", "tg_load_contrib",
+	SEQ_printf(m, "  .%-30s: %ld\n", "tg_load_avg",
+			atomic_long_read(&cfs_rq->tg->load_avg));
+	SEQ_printf(m, "  .%-30s: %ld\n", "tg_load_contrib",
 			cfs_rq->tg_load_contrib);
 	SEQ_printf(m, "  .%-30s: %d\n", "tg_runnable_contrib",
 			cfs_rq->tg_runnable_contrib);
kernel/sched/fair.c +6 -6
index 985d47e..30fb7dc 100644
@@ -1075,7 +1075,7 @@ static inline long calc_tg_weight(struct task_group *tg, struct cfs_rq *cfs_rq)
 	 * to gain a more accurate current total weight. See
 	 * update_cfs_rq_load_contribution().
 	 */
-	tg_weight = atomic64_read(&tg->load_avg);
+	tg_weight = atomic_long_read(&tg->load_avg);
 	tg_weight -= cfs_rq->tg_load_contrib;
 	tg_weight += cfs_rq->load.weight;
 
@@ -1356,13 +1356,13 @@ static inline void __update_cfs_rq_tg_load_contrib(struct cfs_rq *cfs_rq,
 						 int force_update)
 {
 	struct task_group *tg = cfs_rq->tg;
-	s64 tg_contrib;
+	long tg_contrib;
 
 	tg_contrib = cfs_rq->runnable_load_avg;
 	tg_contrib -= cfs_rq->tg_load_contrib;
 
-	if (force_update || abs64(tg_contrib) > cfs_rq->tg_load_contrib / 8) {
-		atomic64_add(tg_contrib, &tg->load_avg);
+	if (force_update || abs(tg_contrib) > cfs_rq->tg_load_contrib / 8) {
+		atomic_long_add(tg_contrib, &tg->load_avg);
 		cfs_rq->tg_load_contrib += tg_contrib;
 	}
 }
@@ -1397,8 +1397,8 @@ static inline void __update_group_entity_contrib(struct sched_entity *se)
 	u64 contrib;
 
 	contrib = cfs_rq->tg_load_contrib * tg->shares;
-	se->avg.load_avg_contrib = div64_u64(contrib,
-					     atomic64_read(&tg->load_avg) + 1);
+	se->avg.load_avg_contrib = div_u64(contrib,
+				     atomic_long_read(&tg->load_avg) + 1);
 
 	/*
 	 * For group entities we need to compute a correction term in the case
kernel/sched/sched.h +2 -2
index 5a80943..1bfa91a 100644
@@ -150,7 +150,7 @@ struct task_group {
 
 	atomic_t load_weight;
 #ifdef	CONFIG_SMP
-	atomic64_t load_avg;
+	atomic_long_t load_avg;
 	atomic_t runnable_avg;
 #endif
 #endif
@@ -284,7 +284,7 @@ struct cfs_rq {
 #ifdef CONFIG_FAIR_GROUP_SCHED
 	/* Required to track per-cpu representation of a task_group */
 	u32 tg_runnable_contrib;
-	u64 tg_load_contrib;
+	unsigned long tg_load_contrib;
 #endif /* CONFIG_FAIR_GROUP_SCHED */
 
 	/*
Signature · 1 line
1.7.12
#10 lore raw

Re: [RFC patch 2/4] sched/tg: use 'unsigned long' for load variable in task group

Quoted 3 lines · Alex Shi

Since tg->load_avg is smaller than tg->load_weight, we don't need a atomic64_t variable for load_avg in 32 bit machine.
The same reason for cfs_rq->tg_load_contrib.

This description is incorrect, another patch removes tg->load_weight for being unused.

Rest seems fine.

author
#11 lore raw

Re: [RFC patch 2/4] sched/tg: use 'unsigned long' for load variable in task group

Quoted 6 lines · Paul Turner
Quoted 3 lines · Alex Shi
Quoted 3 lines

Since tg->load_avg is smaller than tg->load_weight, we don't need a atomic64_t variable for load_avg in 32 bit machine.
The same reason for cfs_rq->tg_load_contrib.

This description is incorrect, another patch removes tg->load_weight for being unused.

You can say this, but tg->load_weight was designed for the same meaning as load_avg before. :)

Quoted 2 lines

Rest seems fine.

thanks for review.

Signature · 2 lines
Thanks
    Alex
author
#12 lore raw

RFC PATCH 3/4 sched/cfs_rq: change atomic64_t removed_load to atomic_long_t

In reply to Alex Shi

Like as runnable_load_avg, blocked_load_avg variable, long type is enough for removed_load in 64 bit or 32 bit machine.

Then we avoid the expensive atomic64 operations on 32 bit machine.

---
 kernel/sched/fair.c  | 10 ++++++----
 kernel/sched/sched.h |  3 ++-
 2 files changed, 8 insertions(+), 5 deletions(-)
kernel/sched/fair.c +6 -4
index 30fb7dc..9cc4211 100644
@@ -1517,8 +1517,9 @@ static void update_cfs_rq_blocked_load(struct cfs_rq *cfs_rq, int force_update)
 	if (!decays && !force_update)
 		return;
 
-	if (atomic64_read(&cfs_rq->removed_load)) {
-		u64 removed_load = atomic64_xchg(&cfs_rq->removed_load, 0);
+	if (atomic_long_read(&cfs_rq->removed_load)) {
+		unsigned long removed_load;
+		removed_load = atomic_long_xchg(&cfs_rq->removed_load, 0);
 		subtract_blocked_load_contrib(cfs_rq, removed_load);
 	}
 
@@ -3479,7 +3480,8 @@ migrate_task_rq_fair(struct task_struct *p, int next_cpu)
 	 */
 	if (se->avg.decay_count) {
 		se->avg.decay_count = -__synchronize_entity_decay(se);
-		atomic64_add(se->avg.load_avg_contrib, &cfs_rq->removed_load);
+		atomic_long_add(se->avg.load_avg_contrib,
+						&cfs_rq->removed_load);
 	}
 }
 #endif /* CONFIG_SMP */
@@ -5944,7 +5946,7 @@ void init_cfs_rq(struct cfs_rq *cfs_rq)
 #endif
 #if defined(CONFIG_FAIR_GROUP_SCHED) && defined(CONFIG_SMP)
 	atomic64_set(&cfs_rq->decay_counter, 1);
-	atomic64_set(&cfs_rq->removed_load, 0);
+	atomic_long_set(&cfs_rq->removed_load, 0);
 #endif
 }
 
kernel/sched/sched.h +2 -1
index 1bfa91a..874731f 100644
@@ -278,8 +278,9 @@ struct cfs_rq {
 	 * the FAIR_GROUP_SCHED case).
 	 */
 	unsigned long runnable_load_avg, blocked_load_avg;
-	atomic64_t decay_counter, removed_load;
+	atomic64_t decay_counter;
 	u64 last_decay;
+	atomic_long_t removed_load;
 
 #ifdef CONFIG_FAIR_GROUP_SCHED
 	/* Required to track per-cpu representation of a task_group */
Signature · 1 line
1.7.12
Reviewed-by on v1 3/4
#13 lore raw

Re: [RFC patch 3/4] sched/cfs_rq: change atomic64_t removed_load to atomic_long_t

Quoted 6 lines · Alex Shi

Like as runnable_load_avg, blocked_load_avg variable, long type is enough for removed_load in 64 bit or 32 bit machine.

Then we avoid the expensive atomic64 operations on 32 bit machine.

So while this isn't under quite the same constraints as blocked_load since this is per-migration and only cleared on the tick; it would take an awful lot (~47k) of wake-upmigrations of a large (nice-20) task to overflow.

One concern is that this would be potentially user-triggerable using sched_setaffinity() when combined with a sufficiently low HZ.

Although all this would actually do would strand blocked load on the cpu, which mostly punishes the cgroup doing this (likely an ok behavior). If it ever became an issue we could force a update_cfs_rq_blocked_load() when a removal would result in an overflow, but I think this is fine for now.

Quoted 58 lines
---
 kernel/sched/fair.c  | 10 ++++++----
 kernel/sched/sched.h |  3 ++-
 2 files changed, 8 insertions(+), 5 deletions(-)
kernel/sched/fair.c +6 -4
index 30fb7dc..9cc4211 100644
@@ -1517,8 +1517,9 @@ static void update_cfs_rq_blocked_load(struct cfs_rq *cfs_rq, int force_update)
        if (!decays && !force_update)
                return;
 
-       if (atomic64_read(&cfs_rq->removed_load)) {
-               u64 removed_load = atomic64_xchg(&cfs_rq->removed_load, 0);
+       if (atomic_long_read(&cfs_rq->removed_load)) {
+               unsigned long removed_load;
+               removed_load = atomic_long_xchg(&cfs_rq->removed_load, 0);
                subtract_blocked_load_contrib(cfs_rq, removed_load);
        }
 
@@ -3479,7 +3480,8 @@ migrate_task_rq_fair(struct task_struct *p, int next_cpu)
         */
        if (se->avg.decay_count) {
                se->avg.decay_count = -__synchronize_entity_decay(se);
-               atomic64_add(se->avg.load_avg_contrib, &cfs_rq->removed_load);
+               atomic_long_add(se->avg.load_avg_contrib,
+                                               &cfs_rq->removed_load);
        }
 }
 #endif /* CONFIG_SMP */
@@ -5944,7 +5946,7 @@ void init_cfs_rq(struct cfs_rq *cfs_rq)
 #endif
 #if defined(CONFIG_FAIR_GROUP_SCHED) && defined(CONFIG_SMP)
        atomic64_set(&cfs_rq->decay_counter, 1);
-       atomic64_set(&cfs_rq->removed_load, 0);
+       atomic_long_set(&cfs_rq->removed_load, 0);
 #endif
 }
 
kernel/sched/sched.h +2 -2
index 1bfa91a..874731f 100644
@@ -278,8 +278,9 @@ struct cfs_rq {
         * the FAIR_GROUP_SCHED case).
         */
        unsigned long runnable_load_avg, blocked_load_avg;
-       atomic64_t decay_counter, removed_load;
+       atomic64_t decay_counter;
        u64 last_decay;
+       atomic_long_t removed_load;
 
 #ifdef CONFIG_FAIR_GROUP_SCHED
        /* Required to track per-cpu representation of a task_group */
--

1.7.12

author
#14 lore raw

RFC PATCH 4/4 sched/tg: remove tg.load_weight

In reply to Alex Shi

Since no one use it.

---
 kernel/sched/sched.h | 1 -
 1 file changed, 1 deletion(-)
kernel/sched/sched.h +0 -1
index 874731f..09e2719 100644
@@ -148,7 +148,6 @@ struct task_group {
 	struct cfs_rq **cfs_rq;
 	unsigned long shares;
 
-	atomic_t load_weight;
 #ifdef	CONFIG_SMP
 	atomic_long_t load_avg;
 	atomic_t runnable_avg;
Signature · 1 line
1.7.12
author
#16 lore raw
In reply to Alex Shi
Quoted 4 lines · Alex Shi

There are some 64 bits variables in cfs_rq/tg etc. That ask expersive operations in 32 bit machine. But in fact, long type is enough for them.

So do this change lead more efficient code and without data lose.

BTW, this patch bases on my v8 patchset: use runnable load in balance. the git tree is here:
[email protected]:alexshi/power-scheduling.git runnablelb

Any more comments?

Quoted 4 lines

Regards
Alex

Signature · 2 lines
Thanks
    Alex
author
#17 lore raw
Quoted 4 lines · Alex Shi
Quoted 3 lines · Alex Shi
Quoted 3 lines

There are some 64 bits variables in cfs_rq/tg etc. That ask expersive operations in 32 bit machine. But in fact, long type is enough for them.

Quoted 8 lines
Quoted 1 line
Quoted 1 line

So do this change lead more efficient code and without data lose.

BTW, this patch bases on my v8 patchset: use runnable load in balance. the git tree is here:
[email protected]:alexshi/power-scheduling.git runnablelb

Any more comments?

Paul, Could you like to give a bit comments?

Signature · 2 lines
Thanks
    Alex
author
#18 lore raw
In reply to Alex Shi
Quoted 5 lines · Alex Shi

There are some 64 bits variables in cfs_rq/tg etc. That ask expersive operations in 32 bit machine. But in fact, long type is enough for them.

So do this change lead more efficient code and without data lose.

some variable like cfs_rq->runnable_load_avg, there is no much changes in patch 1/4, since in most of place it was treated as a 'unsigned long', not u64.

Anyway, Paul, I know you are watching the mailing list. :) Could you like to give some comments on this patchset?

Quoted 3 lines

Regards
Alex

Signature · 2 lines
Thanks
    Alex
author
#19 lore raw
Quoted 11 lines · Alex Shi
Quoted 5 lines · Alex Shi

There are some 64 bits variables in cfs_rq/tg etc. That ask expensive operations in 32 bit machine. But in fact, long type is enough for them.

So do this change lead more efficient code and without data lose.

some variable like cfs_rq->runnable_load_avg, there is no much changes in patch 1/4, since in most of place it was treated as a 'unsigned long', not u64.

The patchset change some u64 load avg variables to 'unsigned long' type, because the related load variable is 'unsigned long' too.

Peter,
It looks quite straight. So if Paul is too busy to look into this, Believe you can do decide independent. :)

Quoted 5 lines
Quoted 3 lines

Regards
Alex

Signature · 2 lines
Thanks
    Alex