Skip to contentSkip to conversation

sched/doc: Update documentation for base_slice_ns and CONFIG_HZ relation

PATCH Applied Mukesh Kumar Chaurasiya 3 participants 3 messages Mar 20, 2024 – Mar 21, 2024 Documentation

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 sched/doc: Update documentation for base_slice_ns and CONFIG_HZ relation

The tunable base_slice_ns is dependent on CONFIG_HZ (i.e. TICK_NSEC) for any significant performance improvement. The reason being the scheduler tick is not frequent enough to force preemption when base_slice expires in case of

base_slice_ns < TICK_NSEC

The below data is of stress-ng
Number of CPU: 1
Stressor threads: 4
Time: 30sec

On CONFIG_HZ=1000

| base_slice | avg-run (msec) | context-switches |
| ---------- | -------------- | ---------------- |
| 3ms        | 2.914          | 10342            |
| 6ms        | 4.857          | 6196             |
| 9ms        | 6.754          | 4482             |
| 12ms       | 7.872          | 3802             |
| 22ms       | 11.294         | 2710             |
| 32ms       | 13.425         | 2284             |

On CONFIG_HZ=100

| base_slice | avg-run (msec) | context-switches |
| ---------- | -------------- | ---------------- |
| 3ms        | 9.144          | 3337             |
| 6ms        | 9.113          | 3301             |
| 9ms        | 8.991          | 3315             |
| 12ms       | 12.935         | 2328             |
| 22ms       | 16.031         | 1915             |
| 32ms       | 18.608         | 1622             |

base_slice: the value of base_slice in ms
avg-run (msec): average time of the stressor threads got on cpu before it got preempted
context-switches: number of context switches for the stress-ng process

---
 Documentation/scheduler/sched-design-CFS.rst | 3 +++
 1 file changed, 3 insertions(+)
Documentation/scheduler/sched-design-CFS.rst +3 -0
index 6cffffe26500..82985d675554 100644
@@ -100,6 +100,9 @@ which can be used to tune the scheduler from "desktop" (i.e., low latencies) to
 "server" (i.e., good batching) workloads.  It defaults to a setting suitable
 for desktop workloads.  SCHED_BATCH is handled by the CFS scheduler module too.
 
+In case the CONFIG_HZ leads to base_slice_ns < TICK_NSEC. The settings of
+base_slice_ns will have little to no impact on the workloads.
+
 Due to its design, the CFS scheduler is not prone to any of the "attacks" that
 exist today against the heuristics of the stock scheduler: fiftyp.c, thud.c,
 chew.c, ring-test.c, massive_intr.c all work fine and do not impact
Signature · 1 line
2.44.0
reviewer
#1 lore raw

Hi,

Quoted 49 lines · Mukesh Kumar Chaurasiya

The tunable base_slice_ns is dependent on CONFIG_HZ (i.e. TICK_NSEC) for any significant performance improvement. The reason being the scheduler tick is not frequent enough to force preemption when base_slice expires in case of

base_slice_ns < TICK_NSEC

The below data is of stress-ng
Number of CPU: 1
Stressor threads: 4
Time: 30sec

On CONFIG_HZ=1000

| base_slice | avg-run (msec) | context-switches |
| ---------- | -------------- | ---------------- |
| 3ms        | 2.914          | 10342            |
| 6ms        | 4.857          | 6196             |
| 9ms        | 6.754          | 4482             |
| 12ms       | 7.872          | 3802             |
| 22ms       | 11.294         | 2710             |
| 32ms       | 13.425         | 2284             |

On CONFIG_HZ=100

| base_slice | avg-run (msec) | context-switches |
| ---------- | -------------- | ---------------- |
| 3ms        | 9.144          | 3337             |
| 6ms        | 9.113          | 3301             |
| 9ms        | 8.991          | 3315             |
| 12ms       | 12.935         | 2328             |
| 22ms       | 16.031         | 1915             |
| 32ms       | 18.608         | 1622             |

base_slice: the value of base_slice in ms
avg-run (msec): average time of the stressor threads got on cpu before it got preempted
context-switches: number of context switches for the stress-ng process

---
 Documentation/scheduler/sched-design-CFS.rst | 3 +++
 1 file changed, 3 insertions(+)
Documentation/scheduler/sched-design-CFS.rst +0 -0
index 6cffffe26500..82985d675554 100644

Documentation/scheduler/sched-design-CFS.rst which can be used to tune the scheduler from "desktop" (i.e., low latencies) to · line 103

Quoted 4 lines
Documentation/scheduler/sched-design-CFS.rst +1 -0
@@ -100,6 +100,9 @@ which can be used to tune the scheduler from "desktop" (i.e., low latencies) to
 "server" (i.e., good batching) workloads.  It defaults to a setting suitable
 for desktop workloads.  SCHED_BATCH is handled by the CFS scheduler module too.
 
+In case the CONFIG_HZ leads to base_slice_ns < TICK_NSEC. The settings of
                                                  TICK_NSEC, the {setting, value}
Quoted 5 lines
Documentation/scheduler/sched-design-CFS.rst +2 -0
+base_slice_ns will have little to no impact on the workloads.
+
 Due to its design, the CFS scheduler is not prone to any of the "attacks" that
 exist today against the heuristics of the stock scheduler: fiftyp.c, thud.c,
 chew.c, ring-test.c, massive_intr.c all work fine and do not impact
Signature · 1 line
#Randy
#2 lore raw
In reply to Mukesh Kumar Chaurasiya
The following commit has been merged into the sched/urgent branch of tip:

The following commit has been merged into the sched/urgent branch of tip:

Commit-ID:     a26979377bf34534ce5ee2712d2a46157ec61498
Gitweb:        https://git.kernel.org/tip/a26979377bf34534ce5ee2712d2a46157ec61498
Author:        Mukesh Kumar Chaurasiya <[email protected]>
AuthorDate:    Wed, 20 Mar 2024 23:08:16 +05:30
Committer:     Ingo Molnar <[email protected]>
CommitterDate: Thu, 21 Mar 2024 20:34:16 +01:00

sched/doc: Update documentation for base_slice_ns and CONFIG_HZ relation

The tunable base_slice_ns is dependent on CONFIG_HZ (i.e. TICK_NSEC) for any significant performance improvement. The reason being the scheduler tick is not frequent enough to force preemption when base_slice expires in case of:

base_slice_ns < TICK_NSEC

The below data is of stress-ng:

	Number of CPU: 1
	Stressor threads: 4
	Time: 30sec

	On CONFIG_HZ=1000

	| base_slice | avg-run (msec) | context-switches |
	| ---------- | -------------- | ---------------- |
	| 3ms        | 2.914          | 10342            |
	| 6ms        | 4.857          | 6196             |
	| 9ms        | 6.754          | 4482             |
	| 12ms       | 7.872          | 3802             |
	| 22ms       | 11.294         | 2710             |
	| 32ms       | 13.425         | 2284             |

	On CONFIG_HZ=100

	| base_slice | avg-run (msec) | context-switches |
	| ---------- | -------------- | ---------------- |
	| 3ms        | 9.144          | 3337             |
	| 6ms        | 9.113          | 3301             |
	| 9ms        | 8.991          | 3315             |
	| 12ms       | 12.935         | 2328             |
	| 22ms       | 16.031         | 1915             |
	| 32ms       | 18.608         | 1622             |

	base_slice: the value of base_slice in ms
	avg-run (msec): average time of the stressor threads got on cpu before
	it got preempted
	context-switches: number of context switches for the stress-ng process
---
 Documentation/scheduler/sched-design-CFS.rst | 3 +++
 1 file changed, 3 insertions(+)
Documentation/scheduler/sched-design-CFS.rst +3 -0
index 6cffffe..e030876 100644
@@ -100,6 +100,9 @@ which can be used to tune the scheduler from "desktop" (i.e., low latencies) to
 "server" (i.e., good batching) workloads.  It defaults to a setting suitable
 for desktop workloads.  SCHED_BATCH is handled by the CFS scheduler module too.
 
+In case CONFIG_HZ results in base_slice_ns < TICK_NSEC, the value of
+base_slice_ns will have little to no impact on the workloads.
+
 Due to its design, the CFS scheduler is not prone to any of the "attacks" that
 exist today against the heuristics of the stock scheduler: fiftyp.c, thud.c,
 chew.c, ring-test.c, massive_intr.c all work fine and do not impact