Bug 11859 - [Anolis23.2][6.6.25-2.2_rc1]执行chrt --rr --pid 1 xxx报chrt: failed to set pid xxx's policy: Operation not permitted
Summary: [Anolis23.2][6.6.25-2.2_rc1]执行chrt --rr --pid 1 xxx报chrt: failed to set pid x...
Status: CONFIRMED
Alias: None
Product: ANCK 6.6 Dev
Classification: ANCK
Component: sched (show other bugs) sched
Version: 6.6.25-2.2
Hardware: All Linux
: P3-Medium S3-normal
Target Milestone: ---
Assignee: banye97
QA Contact: bolong_tbl
URL:
Whiteboard:
Keywords: Function
Depends on:
Blocks:
 
Reported: 2024-11-13 14:43 UTC by zhf668260
Modified: 2024-11-27 14:12 UTC (History)
5 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description zhf668260 alibaba_cloud_group 2024-11-13 14:43:20 UTC
[问题描述]:
Anolis23环境,chrt --rr --pid 1 xxx报chrt: failed to set pid xxx's policy: Operation not permitted

[环境信息]:
机器类型:ECS

[内核信息]:
uname -r
6.6.25-2.1.an23.x86_64


[操作系统信息]:
cat /etc/os-release
NAME="Anolis OS"
VERSION="23.1"
ID="anolis"
VERSION_ID="23.1"
PLATFORM_ID="platform:an23"
PRETTY_NAME="Anolis OS 23.1"
ANSI_COLOR="0;31"
HOME_URL="https://openanolis.cn/"
BUG_REPORT_URL="https://bugzilla.openanolis.cn/"


[重现步骤]:
前置条件: 
- 执行命令sleep 1000 &,创建一个进程

测试步骤:
- 执行chrt -p xxx
- 执行chrt --rr --pid 1 xxx

期望结果:
- 执行chrt --rr --pid 1 xxx成功

实际执行结果:
[root@iZbp1i8xs1woj0bi2hazqbZ]# sleep 10000 &
[1] 662349
[root@iZbp1i8xs1woj0bi2hazqbZ]# chrt -p 662349
pid 662349's current scheduling policy: SCHED_OTHER
pid 662349's current scheduling priority: 0
[root@iZbp1i8xs1woj0bi2hazqbZ]# chrt --rr --pid 1 662349
chrt: failed to set pid 662349's policy: Operation not permitted


经调查跟kernel.sched_rt_runtime_us相关,默认值为950000,将他修改为-1后执行成功
[root@iZbp1i8xs1woj0bi2hazqbZ]# sysctl kernel.sched_rt_runtime_us
kernel.sched_rt_runtime_us = 950000
[root@iZbp1i8xs1woj0bi2hazqbZ]# sysctl -w kernel.sched_rt_runtime_us=-1
kernel.sched_rt_runtime_us = -1
[root@iZbp1i8xs1woj0bi2hazqbZ]# chrt --rr --pid 1 662349
[root@iZbp1i8xs1woj0bi2hazqbZ]#



另外的机器即使是950000,也不会报错
[root@12 ~]# sleep 10000 &
[1] 2422588
[root@12 ~]#  chrt -p 2422588
pid 2422588's current scheduling policy: SCHED_OTHER
pid 2422588's current scheduling priority: 0
[root@12 ~]# chrt --rr --pid 1 2422588
[root@12 ~]#  chrt -p 2422588
pid 2422588's current scheduling policy: SCHED_RR
pid 2422588's current scheduling priority: 1
[root@12 ~]# sysctl kernel.sched_rt_runtime_us
kernel.sched_rt_runtime_us = 950000
[root@12 ~]# uname -r
5.10.134-011.ali5000.al8.x86_64
[root@12_f5_Lab15 ~]# cat /etc/os-release
NAME="Alibaba Cloud Linux"
VERSION="3 (OpenAnolis Edition)"
ID="alinux"
ID_LIKE="rhel fedora centos anolis"
VERSION_ID="3"
VARIANT="OpenAnolis Edition"
VARIANT_ID="openanolis"
ALINUX_MINOR_ID="2104"
ALINUX_UPDATE_ID="10"
PLATFORM_ID="platform:al8"
PRETTY_NAME="Alibaba Cloud Linux 3.2104 U10 (OpenAnolis Edition)"
ANSI_COLOR="0;31"
HOME_URL="https://www.aliyun.com/"
Comment 1 banye97 alibaba_cloud_group 2024-11-27 14:12:10 UTC
非 6.6.25-002.2 新增问题,暂不处理