Skip to contentSkip to conversation

sched: Reduce contention in update_cfs_rq_blocked_load

PATCH Superseded Jason Low 5 participants 16 messages Aug 4, 2014 – Aug 11, 2014 Scheduler

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore

Jason Low

author
#0 lore raw

PATCH 1/1 sched: Reduce contention in update_cfs_rq_blocked_load

When running workloads on 2+ socket systems, based on perf profiles, the update_cfs_rq_blocked_load function constantly shows up as taking up a noticeable % of run time. This is especially apparent on an 8 socket machine. For example, when running the AIM7 custom workload, we see:

4.18% reaim [kernel.kallsyms] [k] update_cfs_rq_blocked_load

Much of the contention is in __update_cfs_rq_tg_load_contrib when we update the tg load contribution stats. However, it turns out that in many cases, they don't need to be updated and "tg_contrib" is 0.

This patch adds a check in __update_cfs_rq_tg_load_contrib to skip updating tg load contribution stats when nothing needs to be updated. This reduces the cacheline contention that would be unnecessary. In the above case, with the patch, perf reports the total time spent in this function went down by more than a factor of 3x:

1.18% reaim [kernel.kallsyms] [k] update_cfs_rq_blocked_load

---
 kernel/sched/fair.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)
kernel/sched/fair.c +3 -0
index bfa3c86..8d4cc72 100644
@@ -2377,6 +2377,9 @@ static inline void __update_cfs_rq_tg_load_contrib(struct cfs_rq *cfs_rq,
 	tg_contrib = cfs_rq->runnable_load_avg + cfs_rq->blocked_load_avg;
 	tg_contrib -= cfs_rq->tg_load_contrib;
 
+	if (!tg_contrib)
+		return;
+
 	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;
Signature · 1 line
1.7.1
reviewer Reviewed-by on v1 1/1
#1 lore raw
Quoted 17 lines · Jason Low

When running workloads on 2+ socket systems, based on perf profiles, the update_cfs_rq_blocked_load function constantly shows up as taking up a noticeable % of run time. This is especially apparent on an 8 socket machine. For example, when running the AIM7 custom workload, we see:

4.18% reaim [kernel.kallsyms] [k] update_cfs_rq_blocked_load

Much of the contention is in __update_cfs_rq_tg_load_contrib when we update the tg load contribution stats. However, it turns out that in many cases, they don't need to be updated and "tg_contrib" is 0.

This patch adds a check in __update_cfs_rq_tg_load_contrib to skip updating tg load contribution stats when nothing needs to be updated. This reduces the cacheline contention that would be unnecessary. In the above case, with the patch, perf reports the total time spent in this function went down by more than a factor of 3x:

Quoted 3 lines

1.18% reaim [kernel.kallsyms] [k] update_cfs_rq_blocked_load

That said, it might be better to remove force_update for this function, or make it just reduce the minimum to /64 or something. If the test is easy to run it would be good to see what it's like just removing the force_update param for this function to see if it's worth worrying about or if the zero case catches ~all the perf gain. Paul, your thoughts?

Quoted 18 lines
---
 kernel/sched/fair.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)
kernel/sched/fair.c +3 -0
index bfa3c86..8d4cc72 100644
@@ -2377,6 +2377,9 @@ static inline void __update_cfs_rq_tg_load_contrib(struct cfs_rq *cfs_rq,
 	tg_contrib = cfs_rq->runnable_load_avg + cfs_rq->blocked_load_avg;
 	tg_contrib -= cfs_rq->tg_load_contrib;
 
+	if (!tg_contrib)
+		return;
+
 	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;
author
#2 lore raw
Quoted 21 lines · On Mon, 2014-08-04 at 13:52 -0700, [email protected] wrote:
Quoted 19 lines · Jason Low

When running workloads on 2+ socket systems, based on perf profiles, the update_cfs_rq_blocked_load function constantly shows up as taking up a noticeable % of run time. This is especially apparent on an 8 socket machine. For example, when running the AIM7 custom workload, we see:

4.18% reaim [kernel.kallsyms] [k] update_cfs_rq_blocked_load

Much of the contention is in __update_cfs_rq_tg_load_contrib when we update the tg load contribution stats. However, it turns out that in many cases, they don't need to be updated and "tg_contrib" is 0.

This patch adds a check in __update_cfs_rq_tg_load_contrib to skip updating tg load contribution stats when nothing needs to be updated. This reduces the cacheline contention that would be unnecessary. In the above case, with the patch, perf reports the total time spent in this function went down by more than a factor of 3x:

1.18% reaim [kernel.kallsyms] [k] update_cfs_rq_blocked_load

Quoted 8 lines
Quoted 1 line

That said, it might be better to remove force_update for this function, or make it just reduce the minimum to /64 or something. If the test is easy to run it would be good to see what it's like just removing the force_update param for this function to see if it's worth worrying about or if the zero case catches ~all the perf gain.

Sure, I can test that out too. I did notice when running another AIM7 workload that !zero was the more common case, so this has the potential to further reduce contention.

Quoted 1 line

Paul, your thoughts?

author
#3 lore raw
In reply to [email protected]
Quoted 6 lines · On Mon, 2014-08-04 at 13:52 -0700, [email protected] wrote:

That said, it might be better to remove force_update for this function, or make it just reduce the minimum to /64 or something. If the test is easy to run it would be good to see what it's like just removing the force_update param for this function to see if it's worth worrying about or if the zero case catches ~all the perf gain.

Hi Ben,

I removed the force update in __update_cfs_rq_tg_load_contrib and it helped reduce overhead a lot more. I saw up to a 20x reduction in system overhead from update_cfs_rq_blocked_load when running some of the AIM7 workloads with this change.

-----

kernel/sched/fair.c +4 -6
index fea7d33..7a6e18b 100644
@@ -2352,8 +2352,7 @@ static inline u64 __synchronize_entity_decay(struct sched_entity *se)
 }
 
 #ifdef CONFIG_FAIR_GROUP_SCHED
-static inline void __update_cfs_rq_tg_load_contrib(struct cfs_rq *cfs_rq,
-						 int force_update)
+static inline void __update_cfs_rq_tg_load_contrib(struct cfs_rq *cfs_rq)
 {
 	struct task_group *tg = cfs_rq->tg;
 	long tg_contrib;
@@ -2361,7 +2360,7 @@ static inline void __update_cfs_rq_tg_load_contrib(struct cfs_rq *cfs_rq,
 	tg_contrib = cfs_rq->runnable_load_avg + cfs_rq->blocked_load_avg;
 	tg_contrib -= cfs_rq->tg_load_contrib;
 
-	if (force_update || abs(tg_contrib) > cfs_rq->tg_load_contrib / 8) {
+	if (abs(tg_contrib) > cfs_rq->tg_load_contrib / 8) {
 		atomic_long_add(tg_contrib, &tg->load_avg);
 		cfs_rq->tg_load_contrib += tg_contrib;
 	}
@@ -2436,8 +2435,7 @@ static inline void update_rq_runnable_avg(struct rq *rq, int runnable)
 	__update_tg_runnable_avg(&rq->avg, &rq->cfs);
 }
 #else /* CONFIG_FAIR_GROUP_SCHED */
-static inline void __update_cfs_rq_tg_load_contrib(struct cfs_rq *cfs_rq,
-						 int force_update) {}
+static inline void __update_cfs_rq_tg_load_contrib(struct cfs_rq *cfs_rq) {}
 static inline void __update_tg_runnable_avg(struct sched_avg *sa,
 						  struct cfs_rq *cfs_rq) {}
 static inline void __update_group_entity_contrib(struct sched_entity *se) {}
@@ -2537,7 +2535,7 @@ static void update_cfs_rq_blocked_load(struct cfs_rq *cfs_rq, int force_update)
 		cfs_rq->last_decay = now;
 	}
 
-	__update_cfs_rq_tg_load_contrib(cfs_rq, force_update);
+	__update_cfs_rq_tg_load_contrib(cfs_rq);
 }
 
 /* Add the load generated by se into cfs_rq's child load-average */
maintainer
#4 lore raw
In reply to Jason Low
Quoted 11 lines · Jason Low

When running workloads on 2+ socket systems, based on perf profiles, the update_cfs_rq_blocked_load function constantly shows up as taking up a noticeable % of run time. This is especially apparent on an 8 socket machine. For example, when running the AIM7 custom workload, we see:

4.18% reaim [kernel.kallsyms] [k] update_cfs_rq_blocked_load

Much of the contention is in __update_cfs_rq_tg_load_contrib when we update the tg load contribution stats. However, it turns out that in many cases, they don't need to be updated and "tg_contrib" is 0.

Quoted 8 lines

This patch adds a check in __update_cfs_rq_tg_load_contrib to skip updating tg load contribution stats when nothing needs to be updated. This reduces the cacheline contention that would be unnecessary. In the above case, with the patch, perf reports the total time spent in this function went down by more than a factor of 3x:

1.18% reaim [kernel.kallsyms] [k] update_cfs_rq_blocked_load

Supposedly adding something like __cacheline_aligned to task_group::load_avg is also rumoured to help.

#5 lore raw
In reply to Jason Low

Hi Jason,

I am not sure whether you noticed my latest work: rewriting per entity load average

http://article.gmane.org/gmane.linux.kernel/1760754
http://article.gmane.org/gmane.linux.kernel/1760755
http://article.gmane.org/gmane.linux.kernel/1760757
http://article.gmane.org/gmane.linux.kernel/1760756

which simply does not track blocked load average at all. Are you interested in testing the patchset with the workload you have? The comparison can also help us understand the rewrite. Overall, per our tests, the overhead should be less, and perf should be better.

Thanks,
Yuyang

Quoted 48 lines · Jason Low

When running workloads on 2+ socket systems, based on perf profiles, the update_cfs_rq_blocked_load function constantly shows up as taking up a noticeable % of run time. This is especially apparent on an 8 socket machine. For example, when running the AIM7 custom workload, we see:

4.18% reaim [kernel.kallsyms] [k] update_cfs_rq_blocked_load

Much of the contention is in __update_cfs_rq_tg_load_contrib when we update the tg load contribution stats. However, it turns out that in many cases, they don't need to be updated and "tg_contrib" is 0.

This patch adds a check in __update_cfs_rq_tg_load_contrib to skip updating tg load contribution stats when nothing needs to be updated. This reduces the cacheline contention that would be unnecessary. In the above case, with the patch, perf reports the total time spent in this function went down by more than a factor of 3x:

1.18% reaim [kernel.kallsyms] [k] update_cfs_rq_blocked_load

---
 kernel/sched/fair.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)
kernel/sched/fair.c +3 -0
index bfa3c86..8d4cc72 100644
@@ -2377,6 +2377,9 @@ static inline void __update_cfs_rq_tg_load_contrib(struct cfs_rq *cfs_rq,
 	tg_contrib = cfs_rq->runnable_load_avg + cfs_rq->blocked_load_avg;
 	tg_contrib -= cfs_rq->tg_load_contrib;
 
+	if (!tg_contrib)
+		return;
+
 	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;
Signature · 9 lines
1.7.1



--
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/
#6 lore raw
Quoted 10 lines · Yuyang Du

Hi Jason,

I am not sure whether you noticed my latest work: rewriting per entity load average

http://article.gmane.org/gmane.linux.kernel/1760754
http://article.gmane.org/gmane.linux.kernel/1760755
http://article.gmane.org/gmane.linux.kernel/1760757
http://article.gmane.org/gmane.linux.kernel/1760756

which simply does not track blocked load average at all.

Actually, it tracks blocked load, but along with runnable load, so no this extra overhead.

Quoted 60 lines

Are you interested in
testing the patchset with the workload you have? The comparison can also help us understand the rewrite. Overall, per our tests, the overhead should be less, and perf should be better.

Quoted 48 lines · Jason Low

When running workloads on 2+ socket systems, based on perf profiles, the update_cfs_rq_blocked_load function constantly shows up as taking up a noticeable % of run time. This is especially apparent on an 8 socket machine. For example, when running the AIM7 custom workload, we see:

4.18% reaim [kernel.kallsyms] [k] update_cfs_rq_blocked_load

Much of the contention is in __update_cfs_rq_tg_load_contrib when we update the tg load contribution stats. However, it turns out that in many cases, they don't need to be updated and "tg_contrib" is 0.

This patch adds a check in __update_cfs_rq_tg_load_contrib to skip updating tg load contribution stats when nothing needs to be updated. This reduces the cacheline contention that would be unnecessary. In the above case, with the patch, perf reports the total time spent in this function went down by more than a factor of 3x:

1.18% reaim [kernel.kallsyms] [k] update_cfs_rq_blocked_load

---
 kernel/sched/fair.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)
kernel/sched/fair.c +3 -0
index bfa3c86..8d4cc72 100644
@@ -2377,6 +2377,9 @@ static inline void __update_cfs_rq_tg_load_contrib(struct cfs_rq *cfs_rq,
 	tg_contrib = cfs_rq->runnable_load_avg + cfs_rq->blocked_load_avg;
 	tg_contrib -= cfs_rq->tg_load_contrib;
 
+	if (!tg_contrib)
+		return;
+
 	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;
Signature · 9 lines
1.7.1



--
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/

--
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
In reply to Yuyang Du
Quoted 11 lines · Yuyang Du

Hi Jason,

I am not sure whether you noticed my latest work: rewriting per entity load average

http://article.gmane.org/gmane.linux.kernel/1760754
http://article.gmane.org/gmane.linux.kernel/1760755
http://article.gmane.org/gmane.linux.kernel/1760757
http://article.gmane.org/gmane.linux.kernel/1760756

which simply does not track blocked load average at all. Are you interested in testing the patchset with the workload you have?

Hi Yuyang, yes I can also test your latest patchset with some of the AIM7 workloads. Not needing extra overhead for the blocked load should also address this contention in update_cfs_rq_blocked_load().

Quoted 3 lines

The comparison can also help
us understand the rewrite. Overall, per our tests, the overhead should be less, and perf should be better.

author
#8 lore raw
In reply to Yuyang Du
Quoted 11 lines · Yuyang Du

Hi Jason,

I am not sure whether you noticed my latest work: rewriting per entity load average

http://article.gmane.org/gmane.linux.kernel/1760754
http://article.gmane.org/gmane.linux.kernel/1760755
http://article.gmane.org/gmane.linux.kernel/1760757
http://article.gmane.org/gmane.linux.kernel/1760756

which simply does not track blocked load average at all. Are you interested in testing the patchset with the workload you have?

Hi Yuyang,

I ran these tests with most of the AIM7 workloads to compare its performance between a 3.16 kernel and the kernel with these patches applied.

The table below contains the percent difference between the baseline kernel and the kernel with the patches at various user counts. A positive percent means the kernel with the patches performed better, while a negative percent means the baseline performed better.

Based on these numbers, for many of the workloads, the change was beneficial in those highly contended, while it had - impact in many of the lightly/moderately contended case (10 to 90 users).

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

              |   10-90   |  100-1000   |  1100-2000
              |   users   |   users     |   users

-----------------------------------------------------
alltests | -3.37% | -10.64% | -2.25%
-----------------------------------------------------
all_utime | +0.33% | +3.73% | +3.33%
-----------------------------------------------------
compute | -5.97% | +2.34% | +3.22%
-----------------------------------------------------
custom | -31.61% | -10.29% | +15.23%
-----------------------------------------------------
disk | +24.64% | +28.96% | +21.28%
-----------------------------------------------------
fserver | -1.35% | +4.82% | +9.35%
-----------------------------------------------------
high_systime | -6.73% | -6.28% | +12.36%
-----------------------------------------------------
shared | -28.31% | -19.99% | -7.10%
-----------------------------------------------------
short | -44.63% | -37.48% | -33.62%
-----------------------------------------------------

#9 lore raw
Quoted 27 lines · Jason Low

I ran these tests with most of the AIM7 workloads to compare its performance between a 3.16 kernel and the kernel with these patches applied.

The table below contains the percent difference between the baseline kernel and the kernel with the patches at various user counts. A positive percent means the kernel with the patches performed better, while a negative percent means the baseline performed better.

Based on these numbers, for many of the workloads, the change was beneficial in those highly contended, while it had - impact in many of the lightly/moderately contended case (10 to 90 users).

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

              |   10-90   |  100-1000   |  1100-2000
              |   users   |   users     |   users

-----------------------------------------------------
alltests | -3.37% | -10.64% | -2.25%
-----------------------------------------------------
all_utime | +0.33% | +3.73% | +3.33%
-----------------------------------------------------
compute | -5.97% | +2.34% | +3.22%
-----------------------------------------------------
custom | -31.61% | -10.29% | +15.23%
-----------------------------------------------------
disk | +24.64% | +28.96% | +21.28%
-----------------------------------------------------

Quoted 9 lines

fserver | -1.35% | +4.82% | +9.35%
-----------------------------------------------------
high_systime | -6.73% | -6.28% | +12.36%
-----------------------------------------------------
shared | -28.31% | -19.99% | -7.10%
-----------------------------------------------------
short | -44.63% | -37.48% | -33.62%
-----------------------------------------------------

Thanks, Jason. Sorry for late response.

What about the variation of the tests? The machine you test on?

Yuyang

author
#10 lore raw
Quoted 37 lines · Yuyang Du
Quoted 27 lines · Jason Low

I ran these tests with most of the AIM7 workloads to compare its performance between a 3.16 kernel and the kernel with these patches applied.

The table below contains the percent difference between the baseline kernel and the kernel with the patches at various user counts. A positive percent means the kernel with the patches performed better, while a negative percent means the baseline performed better.

Based on these numbers, for many of the workloads, the change was beneficial in those highly contended, while it had - impact in many of the lightly/moderately contended case (10 to 90 users).

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

              |   10-90   |  100-1000   |  1100-2000
              |   users   |   users     |   users

-----------------------------------------------------
alltests | -3.37% | -10.64% | -2.25%
-----------------------------------------------------
all_utime | +0.33% | +3.73% | +3.33%
-----------------------------------------------------
compute | -5.97% | +2.34% | +3.22%
-----------------------------------------------------
custom | -31.61% | -10.29% | +15.23%
-----------------------------------------------------
disk | +24.64% | +28.96% | +21.28%
-----------------------------------------------------

Quoted 9 lines

fserver | -1.35% | +4.82% | +9.35%
-----------------------------------------------------
high_systime | -6.73% | -6.28% | +12.36%
-----------------------------------------------------
shared | -28.31% | -19.99% | -7.10%
-----------------------------------------------------
short | -44.63% | -37.48% | -33.62%
-----------------------------------------------------

Quoted 3 lines

Thanks, Jason. Sorry for late response.

What about the variation of the tests? The machine you test on?

Hi Yuyang,

These tests were also done on an 8 socket machine (80 cores). In terms of variation between the average throughputs, typically the noise range is about 2% in many of the workloads.

Jason

#11 lore raw
Quoted 40 lines · Jason Low
Quoted 39 lines · Yuyang Du
Quoted 27 lines · Jason Low

I ran these tests with most of the AIM7 workloads to compare its performance between a 3.16 kernel and the kernel with these patches applied.

The table below contains the percent difference between the baseline kernel and the kernel with the patches at various user counts. A positive percent means the kernel with the patches performed better, while a negative percent means the baseline performed better.

Based on these numbers, for many of the workloads, the change was beneficial in those highly contended, while it had - impact in many of the lightly/moderately contended case (10 to 90 users).

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

              |   10-90   |  100-1000   |  1100-2000
              |   users   |   users     |   users

-----------------------------------------------------
alltests | -3.37% | -10.64% | -2.25%
-----------------------------------------------------
all_utime | +0.33% | +3.73% | +3.33%
-----------------------------------------------------
compute | -5.97% | +2.34% | +3.22%
-----------------------------------------------------
custom | -31.61% | -10.29% | +15.23%
-----------------------------------------------------
disk | +24.64% | +28.96% | +21.28%
-----------------------------------------------------

Quoted 9 lines

fserver | -1.35% | +4.82% | +9.35%
-----------------------------------------------------
high_systime | -6.73% | -6.28% | +12.36%
-----------------------------------------------------
shared | -28.31% | -19.99% | -7.10%
-----------------------------------------------------
short | -44.63% | -37.48% | -33.62%
-----------------------------------------------------

Thanks, Jason. Sorry for late response.

Quoted 8 lines
Quoted 1 line

What about the variation of the tests? The machine you test on?

Hi Yuyang,

These tests were also done on an 8 socket machine (80 cores). In terms of variation between the average throughputs, typically the noise range is about 2% in many of the workloads.

Thanks a lot, Jason.

So for this particular set of workloads on a big machine, I think the result is mixed and overall "neutral", but I expected the variation probably could be bigger especially for light workloads.

Any comment from the maintainers and others? Ping Peter and Ben, I haven't heard from you for the 5th version.

Yuyang

maintainer
#12 lore raw
Quoted 23 lines · Yuyang Du
Quoted 14 lines
Quoted 14 lines
Quoted 14 lines

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

              |   10-90   |  100-1000   |  1100-2000
              |   users   |   users     |   users

-----------------------------------------------------
alltests | -3.37% | -10.64% | -2.25%
-----------------------------------------------------
all_utime | +0.33% | +3.73% | +3.33%
-----------------------------------------------------
compute | -5.97% | +2.34% | +3.22%
-----------------------------------------------------
custom | -31.61% | -10.29% | +15.23%
-----------------------------------------------------
disk | +24.64% | +28.96% | +21.28%
-----------------------------------------------------

Quoted 8 lines
Quoted 8 lines
Quoted 8 lines

fserver | -1.35% | +4.82% | +9.35%
-----------------------------------------------------
high_systime | -6.73% | -6.28% | +12.36%
-----------------------------------------------------
shared | -28.31% | -19.99% | -7.10%
-----------------------------------------------------
short | -44.63% | -37.48% | -33.62%
-----------------------------------------------------

Quoted 8 lines

Thanks a lot, Jason.

So for this particular set of workloads on a big machine, I think the result is mixed and overall "neutral", but I expected the variation probably could be bigger especially for light workloads.

Any comment from the maintainers and others? Ping Peter and Ben, I haven't heard from you for the 5th version.

Been a bit busy.. but in general I worry about the performance decrease on the lighter loads. I should probably run some workloads on my 2 socket and 4 socket machines, but the coming few weeks will be very busy and I'm afraid I'll not get around to it in a timely manner.

#13 lore raw
Quoted 30 lines · Peter Zijlstra
Quoted 29 lines · Yuyang Du
Quoted 14 lines
Quoted 14 lines
Quoted 14 lines

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

              |   10-90   |  100-1000   |  1100-2000
              |   users   |   users     |   users

-----------------------------------------------------
alltests | -3.37% | -10.64% | -2.25%
-----------------------------------------------------
all_utime | +0.33% | +3.73% | +3.33%
-----------------------------------------------------
compute | -5.97% | +2.34% | +3.22%
-----------------------------------------------------
custom | -31.61% | -10.29% | +15.23%
-----------------------------------------------------
disk | +24.64% | +28.96% | +21.28%
-----------------------------------------------------

Quoted 8 lines
Quoted 8 lines
Quoted 8 lines

fserver | -1.35% | +4.82% | +9.35%
-----------------------------------------------------
high_systime | -6.73% | -6.28% | +12.36%
-----------------------------------------------------
shared | -28.31% | -19.99% | -7.10%
-----------------------------------------------------
short | -44.63% | -37.48% | -33.62%
-----------------------------------------------------

Thanks a lot, Jason.

So for this particular set of workloads on a big machine, I think the result is mixed and overall "neutral", but I expected the variation probably could be bigger especially for light workloads.

Quoted 7 lines
Quoted 2 lines

Any comment from the maintainers and others? Ping Peter and Ben, I haven't heard from you for the 5th version.

Been a bit busy.. but in general I worry about the performance decrease on the lighter loads. I should probably run some workloads on my 2 socket and 4 socket machines, but the coming few weeks will be very busy and I'm afraid I'll not get around to it in a timely manner.

Ok. I understand. From our part, Fengguang's LKP does not include light loads, we also need some such tests to confirm this and see what is next.

Since typical benchmarks would be heavy ones, what do you suggest for light loads?

Jason, possible you can share some of your workloads?

Thanks,
Yuyang

#14 lore raw
Quoted 39 lines · Yuyang Du
Quoted 30 lines · Peter Zijlstra
Quoted 29 lines · Yuyang Du
Quoted 14 lines
Quoted 14 lines
Quoted 14 lines

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

              |   10-90   |  100-1000   |  1100-2000
              |   users   |   users     |   users

-----------------------------------------------------
alltests | -3.37% | -10.64% | -2.25%
-----------------------------------------------------
all_utime | +0.33% | +3.73% | +3.33%
-----------------------------------------------------
compute | -5.97% | +2.34% | +3.22%
-----------------------------------------------------
custom | -31.61% | -10.29% | +15.23%
-----------------------------------------------------
disk | +24.64% | +28.96% | +21.28%
-----------------------------------------------------

Quoted 8 lines
Quoted 8 lines
Quoted 8 lines

fserver | -1.35% | +4.82% | +9.35%
-----------------------------------------------------
high_systime | -6.73% | -6.28% | +12.36%
-----------------------------------------------------
shared | -28.31% | -19.99% | -7.10%
-----------------------------------------------------
short | -44.63% | -37.48% | -33.62%
-----------------------------------------------------

Thanks a lot, Jason.

So for this particular set of workloads on a big machine, I think the result is mixed and overall "neutral", but I expected the variation probably could be bigger especially for light workloads.

Quoted 7 lines
Quoted 2 lines

Any comment from the maintainers and others? Ping Peter and Ben, I haven't heard from you for the 5th version.

Been a bit busy.. but in general I worry about the performance decrease on the lighter loads. I should probably run some workloads on my 2 socket and 4 socket machines, but the coming few weeks will be very busy and I'm afraid I'll not get around to it in a timely manner.

Quoted 7 lines

Ok. I understand. From our part, Fengguang's LKP does not include light loads, we also need some such tests to confirm this and see what is next.

Since typical benchmarks would be heavy ones, what do you suggest for light loads?

Jason, possible you can share some of your workloads?

Just heard from Fengguang, LKP has AIM7, which is not private workload. We will do it. Thanks, Jason.

+Fengguang

Reviewed-by on v1 1/1
#15 lore raw
In reply to Jason Low
Quoted 29 lines · Jason Low

When running workloads on 2+ socket systems, based on perf profiles, the update_cfs_rq_blocked_load function constantly shows up as taking up a noticeable % of run time. This is especially apparent on an 8 socket machine. For example, when running the AIM7 custom workload, we see:

4.18% reaim [kernel.kallsyms] [k] update_cfs_rq_blocked_load

Much of the contention is in __update_cfs_rq_tg_load_contrib when we update the tg load contribution stats. However, it turns out that in many cases, they don't need to be updated and "tg_contrib" is 0.

This patch adds a check in __update_cfs_rq_tg_load_contrib to skip updating tg load contribution stats when nothing needs to be updated. This reduces the cacheline contention that would be unnecessary. In the above case, with the patch, perf reports the total time spent in this function went down by more than a factor of 3x:

1.18% reaim [kernel.kallsyms] [k] update_cfs_rq_blocked_load

---
  kernel/sched/fair.c |    3 +++
  1 files changed, 3 insertions(+), 0 deletions(-)
kernel/sched/fair.c +0 -0
index bfa3c86..8d4cc72 100644

kernel/sched/fair.c static inline void __update_cfs_rq_tg_load_contrib(struct cfs_rq *cfs_rq, · line 2385

Quoted 9 lines
kernel/sched/fair.c +3 -0
@@ -2377,6 +2377,9 @@ static inline void __update_cfs_rq_tg_load_contrib(struct cfs_rq *cfs_rq,
  	tg_contrib = cfs_rq->runnable_load_avg + cfs_rq->blocked_load_avg;
  	tg_contrib -= cfs_rq->tg_load_contrib;
 
+	if (!tg_contrib)
+		return;
+
  	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;