- iOS/Objective-C 元类和类别
- objective-c - -1001 错误,当 NSURLSession 通过 httpproxy 和/etc/hosts
- java - 使用网络类获取 url 地址
- ios - 推送通知中不播放声音
只是尝试使用 SCHED_FIFO
策略将调度优先级设置为最大。在我安装 libpam-systemd 后,这段代码开始抛出错误。
编辑:归结为下面的两个问题,尽可能把它们说清楚。
追踪:
sched_setscheduler(564, SCHED_FIFO, { 99 }) = -1 EPERM (Operation not permitted)
param.sched_priority = sched_get_priority_max(SCHED_FIFO);
printf("priority %d \n", param.sched_priority);
ret1 = sched_setscheduler(getpid(), SCHED_FIFO, ¶m);
printf("sched_setscheduler ret %d \n", ret1);
if(ret1 == -1){
perror("sched_setscheduler");
goto fail;
}
问题:为什么 root 用户应该获得 EPERM?
还尝试在 /etc/security/limits.conf
中进行以下设置,但没有成功。
root soft rtprio 99
root hard rtprio 99
来自 KENREL 配置文件
#CONFIG_SCHED_AUTOGROUP is not set
CONFIG_CGROUP_SCHED=y
CONFIG_FAIR_GROUP_SCHED=y
CONFIG_CFS_BANDWIDTH=y
CONFIG_RT_GROUP_SCHED=y
CONFIG_GENERIC_SCHED_CLOCK=y
CONFIG_CGROUPS=y
CONFIG_CGROUP_DEBUG=y
CONFIG_CGROUP_FREEZER=y
更新文件 linux/kernel/sched/core.c
#ifdef CONFIG_RT_GROUP_SCHED
/*
* Do not allow realtime tasks into groups that have no runtime
* assigned.
*/
if (rt_bandwidth_enabled() && rt_policy(policy) &&
task_group(p)->rt_bandwidth.rt_runtime == 0 &&
!task_group_is_autogroup(task_group(p))) {
task_rq_unlock(rq, p, &flags);
return -EPERM;
}
#endif
通过案例:没有libpam-systemd
,我得到以下值
[ 36.278241] rt_bandwidth_enabled(): 1
[ 36.281977] rt_policy(policy) : 1
[ 36.285367] task_group_is_autogroup(task_group(p)) : 0
[ 36.289883] task_group(p)->rt_bandwidth.rt_runtime : 950000000
失败案例:使用libpam-systemd
,我得到以下值
[ 2096.713855] rt_bandwidth_enabled(): 1
[ 2096.717871] rt_policy(policy) : 1
[ 2096.721408] task_group_is_autogroup(task_group(p)) : 0
[ 2096.726180] task_group(p)->rt_bandwidth.rt_runtime: 0
问题:为什么 libpam-systemd 应该修改 root 用户的 rt 运行时带宽?
来自 proc
的调度程序 RT 运行时值
root@jarvis:/home/jarvis# cat /proc/sys/kernel/sched_rt_runtime_us
950000
root@jarvis:/home/jarvis# cat /proc/sys/kernel/sched_rt_period_us
1000000
非常感谢任何帮助。
最佳答案
systemd 创建一个单独的 cgroup对于每个用户和每项服务。检查 /proc/self/cgroup
以查看差异。注意这里有 known problems使用 RT 调度:
We recommend to turn off Real-Time group scheduling in the
kernel when using systemd. RT group scheduling effectively
makes RT scheduling unavailable for most userspace, since it
requires explicit assignment of RT budgets to each unit whose
processes making use of RT. As there's no sensible way to
assign these budgets automatically this cannot really be
fixed, and it's best to disable group scheduling hence.
CONFIG_RT_GROUP_SCHED=n
关于linux - 安装 libpam-systemd 后的 sched_setscheduler 错误 (EPERM),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34018956/
我想在 systemd 的 myapp.service 文件中使用多个命令 [Unit] Description=to serve myapp [Service] User=ubuntu Workin
我想为 systemd 服务启用核心转储生成,该服务提供 SEGV 状态并退出。 scd.service: main process exited, code=killed, status=11/SE
我有一个由 systemd 运行的程序,其服务文件如下所示: [Unit] Description=... [Service] Type=notify ExecStart=/usr/sbin/mypr
我有一个 systemd 单元,参数中有空格 ExecStart=command --argument="text text" systemd 似乎无法识别双引号或单引号,并将参数拆分为两个参数。知道
我正在使用一个 systemd 服务,它在“启动”时调用一个进程(例如 systemctl start test.service)。根据设计,进程永远处于循环状态,我们可以使用 ps 命令查看进程的存
我的解决方案(到目前为止)是从公共(public) session 中评论 pam_systemd.so 。一切都在 system.slice 中运行,没有对照组。我还不确定这会产生什么影响,但至少一
我四处查看并用 google 搜索,找不到节点导出器公开的 systemd 指标列表? 最佳答案 node_systemd 指标列表: node_systemd_unit_state - System
我正在尝试将文件写入磁盘作为 ExecStartPre 的一部分systemd 单元文件的命令。 这就是我正在使用的: [Unit] Description=My service [Service]
我的 journalctl到处都是gnome-session警告。我已将问题追溯到谷歌浏览器,警告相对无害。然而,它淹没了我的日志输出,坦率地说,如果我确实需要检查它,我将无法找到我需要的东西。 Ma
操作系统级别:CentOS Linux release 7.4.1708普罗米修斯等级:2.4.2prometheus.service: [Unit] Description=Prometheus [
我们有一个 systemd 服务,根据建议的配置 here 来管理 Puma 进程。 . 虽然看起来运行良好,但重新启动超时,因此看起来失败,即使它们是成功的。如何调试这一类问题? systemd 期
systemd 可以让 rsyslog 守护进程保持事件状态,即使它死了,这真是太棒了。 但是我正在制作一个新的 rsyslog 配置文件,并且需要在 Debug模式下启动此 rsyslog 守护进程
我想更改 systemd-logind 服务的环境参数。这不在 configuration.nix 中可用的登录选项中,所以我尝试了 systemd = { services.system
我试图了解我的新项目中不同 systemd 服务之间的依赖关系。我们正在使用 yocto 构建系统和 systemd/系统服务。 如果我表现出色, systemctl -l 它将按字母顺序列出所有服务
我正在尝试在 lindux debian 上安装和配置 systemD,但在安装 systemd-sysv 时出现错误,我知道这是让 systemD 管理服务所必需的。 当我运行时 apt-get i
我有两个服务 A 和 B。 A 在启动时在 etcd 中设置一个值,比如它从环境文件中获取的公共(public) IP 地址: ExecStartPost=/usr/bin/etcdctl set /
我们目前在一台主机上运行着许多不同的服务,我们正在广泛使用 systemd,包括用于消息传递的 systemd-notify 和用于服务管理的自己的前端。 我们希望开始在容器内运行这些服务,以简化依赖
我们目前在一台主机上运行着许多不同的服务,我们正在广泛使用 systemd,包括用于消息传递的 systemd-notify 和用于服务管理的自己的前端。 我们希望开始在容器内运行这些服务,以简化依赖
几个月前,我使用 systemd.journal 编写了一个小型 Python 服务。 Pip list 显示我在相应的 virtualenv 中安装了 python-systemd (231)。 当
我想启动一个不存在的计时器,它应该在当时启动一个不存在的服务。这应该通过 systemd 临时单元(如 systemd-run)来完成。 当我执行以下代码时,我收到一个异常(见下文)。有人可以告诉我,
我是一名优秀的程序员,十分优秀!