New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
resourcemanager: stop scheduler in the old linux kernal #41766
resourcemanager: stop scheduler in the old linux kernal #41766
Conversation
Signed-off-by: Weizhen Wang <wangweizhen@pingcap.com>
[REVIEW NOTIFICATION] This pull request has been approved by:
To complete the pull request process, please ask the reviewers in the list to review by filling The full list of commands accepted by this bot can be found here. Reviewer can indicate their review by submitting an approval review. |
@@ -56,6 +59,12 @@ func NewCPUObserver() *Observer { | |||
|
|||
// Start starts the cpu observer. | |||
func (c *Observer) Start() { | |||
_, err := cgroup.GetCgroupCPU() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If the kernel version is too old, here will return an error and not start to scheduler the pool.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Signed-off-by: Weizhen Wang <wangweizhen@pingcap.com>
PTAL @tangenta |
/merge |
This pull request has been accepted and is ready to merge. Commit hash: 78b80aa
|
Why only manual testing? |
require.Less(t, GetCPUUsage(), 1.0) | ||
for n := 0; n < 10; n++ { | ||
time.Sleep(1 * time.Second) | ||
value, unsupported := GetCPUUsage() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please mock unsupported scenarios and make sure we will stop tune.
What problem does this PR solve?
Issue Number: close #41808
Problem Summary:
If you run the TiDB in the container with a kernel version lower than 4.7, you can not get the CPU usage of this container from groups. We get the CPU usage from the usage_user and usage_sys of cgroups. But those values are created on Linux 4.7.
In summary, We prevent unnecessary trouble. If we find the missing path of the cgroups path, we will stop the scheduler of the resource manager so that it is still able to work but it can not tune the concurrency.
the main cause in linux is here.
https://elixir.bootlin.com/linux/v4.7/source/kernel/sched/cpuacct.c
https://elixir.bootlin.com/linux/v4.6.7/source/kernel/sched/cpuacct.c
What is changed and how it works?
Check List
Tests
run on the old Linux kernel. you will read the error message and then not start the scheduler.
Side effects
Documentation
Release note
Please refer to Release Notes Language Style Guide to write a quality release note.