当前位置:首页>Linux>Linux PELT 负载跟踪子系统深度分析(基于 v5.10.262)

Linux PELT 负载跟踪子系统深度分析(基于 v5.10.262)

  • 2026-08-18 23:11:51
Linux PELT 负载跟踪子系统深度分析(基于 v5.10.262)
1. 设计目标与设计思想

1.1 解决什么内核问题

单核 CFS 只关心"同一 CPU 上实体间的 vruntime 公平",不关心"这个 CPU 上到底有多少负载/利用率"。多核时代(尤其异构大小核、DVFS、EAS)必须回答三个问题:

  1. 负载(load):CPU 上"有多少重量"——用于 SMP 负载均衡决定"搬多少任务过去"。
  2. 利用率(utilization):CPU 上"近期实际烧掉了多少计算能力"——用于 schedutil 调频与 EAS 能量选核。
  3. 可运行率(runnable):在队列上(含排队未运行)的占比——判断排队延迟 / 组容量是否耗尽。

老内核用 cpu_load[] 指数衰减数组(无实体粒度、与优先级无关、只反映 tick 抽样),无法支撑上述三类决策。PELT 把历史负载建模为一个按 1ms 分段、几何衰减的等比级数,且每个 sched_entity、每个 cfs_rq、每个 rt/dl/irq/thermal 队列各自维护一套指标,实现 O(1) 增量更新。

1.2 核心设计思路

等比级数模型

  • 把实体可运行历史切成 1ms(1024us)段:p_0(当前) ~ p_N(N ms 前)。
  • 令 u_i 为第 i 段中实体"可运行/运行"的时间占比,则历史负载 = u_0 + u_1·y + u_2·y² + ...
  • 取 y^32 = 0.5LOAD_AVG_PERIOD = 32):32ms 前的贡献权重减半,对应"一个调度周期"。
  • 周期回卷时只需整体再乘一次 y:load_avg' = u_0' + y·load_avg,O(1) 增量。
  • 三个信号:
    • load_avg = runnable% × scale_load_down(load)
      (带任务权重,用于负载均衡);
    • runnable_avg = runnable% × 1024
    • util_avg = running% × 1024
      (与权重无关,反映"真实计算量")。

为加深理解,这里重点介绍上述三个信号:三个量来自同一套 PELT 引擎,只是三种不同的度量口径:

  • load_avg = 权重视角——enqueued 信号 × 任务权重的时间积分。回答"这台 CPU 按权重该承担多少负载",单位是调度权重;负载均衡迁移、cgroup 带宽、task_h_load 都用它。
  • runnable_avg = 队列深度视角——runnable 信号(每可运行实体贡献 1024)的时间积分,不带权重。回答"有多少任务在等 CPU",用于满载/过载判定(group_runnable)、wake_wide。
  • util_avg = 利用率视角——running 信号的时间积分,归一化到 [0,1024] 即 0~100%,且经 clock_pelt 缩放后容量不变。回答"CPU 实际忙不忙",是 schedutil 调频、EAS 能量计算、misfit 的输入。
类别
load_avg
runnable_avg
util_avg
度量信号
在队列上(enqueued)
可运行(runnable)
正在执行(running)
是否带权重
是(× weight)
否(计数)
否(纯时间)
典型范围
∝ 调度权重
[0, 1024×h_nr_running]
[0, 1024]
回答的问题
CPU 该承担多少
有多少任务在排队
CPU 实际忙不忙
主要消费者
负载均衡、cgroup 带宽
负载均衡、cgroup 带宽
schedutil、EAS、misfit

定点数与查表:y^n 用 32 位定点数查表 runnable_avg_yN_inv[](由 Documentation/scheduler/sched-pelt.c 工具生成);LOAD_AVG_MAX = 47742 为等比级数上限。

LOAD_AVG_MAX = 47742(定点饱和值,可理解为单个任务在每个PELT周期内一直运行所对应的load值)定义:PELT 单周期(32ms)衰减系数:y^32 = 0.5每ms的衰减系数: y = 0.5^(1/32)指数加权滑动平均稳态饱和最大值公式:$$(LOAD_AVG_MAX = \sum_{n=0}^{\infty} 1024 \cdot y^{n}) $$根据等比数列关系可以换算为:$$LOAD_AVG_MAX = \sum_{n=0}^{\infty} 1024 \cdot y^{n} = \frac{1024}{1-y},\quad |y|<1$$内核定点整数递推、每周期整数截断,将y定义代入后或计算出实际收敛饱和上限等于 47742。

频率/容量不变量(clock_pelt):util_avg 要能跨频率、跨 CPU 容量比较,因此 PELT 使用的时钟不是裸 clock_task,而是经过 arch_scale_cpu_capacity/arch_scale_freq_capacity 缩放后的 clock_pelt(update_rq_clock_pelt)。update_rq_clock_pelt 在 rq 空闲(is_idle_task)时把 clock_pelt 同步回 clock_task;满载饱和时的"丢失空闲"则由 update_idle_rq_clock_pelt 累计进 lost_idle_time,读取侧 rq_clock_pelt = clock_pelt - lost_idle_time。

lost_idle_time 用于稳定负载变化率:现实中即使 rq 的 util_avg 稳定在 100%,队列也几乎总是非空,依然会出现瞬时空闲(任务切换缝隙、新任务唤醒延迟、负载均衡迁入迁出瞬间、softirq 处理窗口等)。这些空闲在满容量下同样存在,只是微不足道(100% 利用率意味着平均空闲趋近于 0),PELT 的衰减会被随后的 running 迅速补回。

PELT 的时钟输入为 rq->clock_pelt:rq 的 curr 为 idle 时更新 rq->clock_pelt = rq_clock_task(rq);rq->clock_task 是真实时间,不会经 capacity 缩放。

隐藏冲突点:同样的瞬时空闲,在低 capacity CPU 上会被"放大"。放大不是空闲本身变长,而是 clock_pelt 的 idle 同步把整个 busy 段累计的缩放差值一次性吐了出来。

场景:half capacity(容量 512)满载 rq,忙碌 100 个墙钟单元后出现 20 单元的瞬时 idle。

1.3 关键权衡

  • 事件驱动 vs tick 驱动:PELT 是事件驱动的(入队/出队/上下文切换/周期性 entity_tick/阻塞负载衰减),不做独立定时器,代价是负载更新的时基不固定,需用 delta 累积。
  • 精度 vs 成本:1024us 分段、delta >>= 10 截断,量化误差导致 *_avg 在 [1002..1024) 抖动,用 get_pelt_divider()(PELT_MIN_DIVIDER + period_contrib)做除法定标消除该抖动。
  • 新任务 util 高估风险:新任务 util_avg 按"CPU 剩余容量的一半"预置(cap = (cpu_scale - cfs_rq->avg.util_avg) / 2,见 post_init_entity_util_avg),防新任务瞬间冲高越过 overutilized 阈值、破坏 EAS 布置。
  • 唤醒任务的 util_est:PELT util_avg 衰减慢,唤醒场景会低估任务需求。用 util_est(EWMA + enqueued 峰值)做唤醒时任务利用率的上界估计(task_util_est)。

2. 整体代码架构与组件划分

依赖关系:PELT 核心不依赖上层;上层只读 *.avg.{load,runnable,util}_avg / util_est / avg_rt / avg_dl / avg_irq / avg_thermal。所有写操作都发生在持 rq->lock 的调度路径内,读方多用 READ_ONCE。

3. 源码目录与关键文件清单

类别
文件(相对 /Volumes/workspace/linux/linux-stable-5.10
说明
实现
kernel/sched/pelt.c
PELT 数学核心与各队列更新入口
内核头
kernel/sched/pelt.h
接口声明、clock_pelt 时钟语义、PELT_MIN_DIVIDER
内核头
kernel/sched/sched-pelt.h
常量表 runnable_avg_yN_inv[]LOAD_AVG_PERIOD=32LOAD_AVG_MAX=47742
内核头
kernel/sched/sched.hstruct cfs_rq
(avg/removed)、struct rq(avg_rt/avg_dl/avg_irq/avg_thermal/clock_pelt/lost_idle_time)
内核头
include/linux/sched.hstruct sched_avg
struct util_eststruct sched_entity
集成
kernel/sched/fair.c
update_load_avg 、util_est、blocked 更新、负载均衡统计消费
集成
kernel/sched/cpufreq_schedutil.cschedutil_cpu_util
/sugov_get_util消费 cpu_util_cfs
集成
kernel/sched/core.cupdate_rq_clock
/update_rq_clock_task(调用 pelt.h 的 clock 更新)、scheduler_tick
trace
include/trace/events/sched.hpelt_{se,cfs,rt,dl,thermal,irq}_tp
sched_util_est_{se,cfs}_tpsched_overutilized_tp
文档
Documentation/scheduler/sched-pelt
生成 sched-pelt.h 的工具(源码注释注明)
编译
kernel/sched/Makefileobj-$(CONFIG_SMP) += ... pelt.o

uapi 说明:PELT 结构(struct sched_avg/util_est)全部位于内核私有头 include/linux/sched.hkernel/sched/sched.h不向用户态暴露任何 uapi 结构/系统调用。用户态只能通过 tracepoint/procfs/debugfs 观测。

相关CONFIG_*配置项及开关影响

配置
影响
CONFIG_SMP
PELT 总开关kernel/sched/Makefile 仅 SMP 编译 pelt.o;非 SMP 下 pelt.h 全为 inline 空实现,update_load_avg 退化为只调 cfs_rq_util_change
CONFIG_FAIR_GROUP_SCHED
组调度;cfs_rq->tg_load_avg_contrib/h_load/propagate 组负载传播,影响 task_h_load 与 update_cfs_group
CONFIG_CFS_BANDWIDTHcfs_rq_clock_pelt
 扣除 throttled 时间,带宽控制期间负载不虚增
CONFIG_SCHED_THERMAL_PRESSURE
追踪 avg_thermal;热降频期间的"容量损失"计入负载
CONFIG_HAVE_SCHED_AVG_IRQ
追踪 avg_irq;中断/steal 时间作为任务不可见容量损失计入 util
CONFIG_ENERGY_MODEL
 + CONFIG_CPU_FREQ_GOV_SCHEDUTIL
EAS:find_energy_efficient_cpu 用 cpu_util_next + compute_energy
CONFIG_CPU_FREQ_GOV_SCHEDUTIL
schedutil 调频消费 cpu_util_cfs(util_avg + util_est)
CONFIG_NUMA_BALANCINGsg_lb_stats.nr_numa_running
 等;PELT 不直接参与
CONFIG_SCHED_DEBUG
debugfs sched_features 可动态开关 UTIL_EST 等调度特性
CONFIG_SCHEDSTATS
负载均衡统计计数(与 PELT 数值本身无关)

本文聚焦于负载统计与更新,暂不展开调频相关部分。

4. 核心数据结构解析

4.1 struct sched_avg(include/linux/sched.h)

struct sched_avg {	u64				last_update_time;   /* 上次更新时间(clock_pelt 域) */	u64				load_sum;           /* 未归一化加权负载累积和(64bit,防溢出,见 395-408) */	u64				runnable_sum;       /* 未归一化可运行累积和 */	u32				util_sum;           /* 未归一化利用率累积和(<<10 定标) */	u32				period_contrib;     /* 当前 1ms 周期内已累计的 us 数 */	unsigned long			load_avg;           /* = load*load_sum/divider */	unsigned long			runnable_avg;       /* = runnable_sum/divider */	unsigned long			util_avg;           /* = util_sum/divider, [0,1024] */	struct util_est			util_est;           /* 唤醒估计 */} ____cacheline_aligned;                            /* 与实体其它字段隔离缓存行 */
  • 核心不变量:*_avg = *_sum / get_pelt_divider(sa),其中 get_pelt_divider = LOAD_AVG_MAX - 1024 + period_contrib。对 sched_entity 而言:load_sum 不含权重,load_avg 含权重,即 load_avg = se_weight() * load_sum / get_pelt_divider(sa)
  • last_update_time
     在事件间跳跃,靠 delta = now - last_update_time 补算流失周期。
  • 生命周期/并发:SE 的 avg 随任务迁移/调度类切换在 CPU 间漂移;util_avg 用 WRITE_ONCE 发布,读者(EAS/均衡/调频)用 READ_ONCEutil_est.enqueued 用 MSB UTIL_AVG_UNCHANGED 做脏标记,原子读改写。

4.2 struct util_est(include/linux/sched.h)

struct util_est {	unsigned int			enqueued;  /* 最近一次激活结束时的 PELT util_avg 快照(高比特位兼作脏标记) */	unsigned int			ewma;      /* 历史 EWMA,平滑 util 下降 */};#define UTIL_EST_WEIGHT_SHIFT	2   /* EWMA 权重 w=1/4 */#define UTIL_AVG_UNCHANGED	0x80000000
  • 用途:唤醒时 task_util_est(p) = max(task_util(p), max(ue.ewma, ue.enqueued&~MSB))。
  • enqueued
     的 MSB 在 cfs_se_util_change()里被清零以标记 "PELT 已更新",util_est_update() 在任务睡眠时据此决定是否刷新 EWMA。

4.3 struct sched_entity(include/linux/sched.h)

CONFIG_SMP 下成员:struct sched_avg avg(独占缓存行)。相关字段:load.weight(负载权重)、on_rq、sum_exec_runtime、vruntime。任务迁移/睡眠后avg仍保留,用于在新 CPU 上 attach_entity_load_avg 恢复。

4.4 struct cfs_rq(kernel/sched/sched.h)

  • struct sched_avg avg
    :整条 CFS 队列(含阻塞任务)的聚合负载。
  • struct { raw_spinlock_t lock; int nr; unsigned long load_avg/util_avg/runnable_avg; } removed
    解耦锁。任务退出/迁移时由 remove_entity_load_avg() 在自身 rq->lock 下把 avg 累加到 removed,随后由任意 CPU 的 update_cfs_rq_load_avg() 在拿 removed.lock 后批量减除。这是 32bit 与 CPU 热插拔/跨 CPU 衰减的重要并发设计。
  • tg_load_avg_contrib
    :组对上层 tg->load_avg 的贡献。
  • propagate
    /prop_runnable_sum:组负载向上传播的挂起量。
  • h_load
    /h_load_next:层级化负载因子(task_h_load 用)。

4.5 struct rq(kernel/sched/sched.h)

  • u64 clock_pelt
    unsigned long lost_idle_time:频率/容量不变量时钟。
  • struct sched_avg avg_rt
    avg_dlavg_irq(CONFIG_HAVE_SCHED_AVG_IRQ)、avg_thermal(CONFIG_SCHED_THERMAL_PRESSURE)。
  • unsigned long misfit_task_load
    :由 update_misfit_status维护,表示"当前 CPU 上装不下的大任务"。
  • 锁:以上全部字段仅在持 rq->lock 时写;clock/clock_pelt 由 update_rq_clock()(要求 rq->lock)维护。

4.6 avg 成员在四个结构中的"位置语义"

结构
avg成员
语义
struct rq
cfs(内嵌 rq->cfs)+ avg_rt/avg_dl/avg_thermal/avg_irq
rq 本身无 avg;root 队列内嵌、其他调度类各自携带 PELT
struct cfs_rq
avg
队列聚合:Σ 已 attach 实体(任务加法 + 组实体上抛)
struct sched_entity
avg(include/linux/sched.h,CONFIG_SMP)
实体自身度量:任务度量自己;组实体复制子队列(propagate)
struct task_group
load_avg(atomic_long_t)
全局聚合:Σ 各 CPU cfs_rq->avg.load_avg 增量;注意它不是 sched_avg,只有 load 一个量

avg 之间的三层聚合关系:

  • 树内(se ↔ cfs_rq):任务 T.se->avg 经 attach 加法并入 G.cfs_rq->avg;组 G.cfs_rq->avg 经 propagate 同步给 G.se->avg,再 attach 并入 rq->cfs->avg。整棵 CFS 树的汇聚点就是 rq->cfs->avg(负载均衡的读取入口)。
  • 组级(仅 load):update_tg_load_avg把每个 CPU 上 cfs_rq->avg.load_avg 的增量并入 tg->load_avg,带死区判断(abs(delta) > contrib/64 才更新,防抖动)。util/runnable 只上抛到 rq->cfs 为止,不进 tg——组级只需要 load 做 shares 分配。
  • rq 级并行:avg_rt/avg_dl/avg_thermal/avg_irq 是 RT/DL/热/中断各自的 PELT,与 CFS 树完全独立,由各自的 update_*_rq_load_avg 维护,只在消费端(cpu_util、满载判定)与 CFS 相加。

5. 完整执行工作流

5.1 PELT 数学核心:一次负载更新

__update_load_avg_se(now, cfs_rq, se)  持 rq->lock  → ___update_load_sum(now, &se->avg, load, runnable, running)      ├─ delta = now - sa->last_update_time      ├─ (s64)delta < 0 → 时钟回拨(sched clock 初始化换源): 仅复位 last_update_time,return 0      ├─ delta >>= 10(1024ns≈1us 单位); !delta → return 0      ├─ !load → runnable = running = 0  处理”已出队但 cfs_rq->curr 仍指向它”的边角(idle_balance 时)      └─ accumulate_sum(delta, sa, load, runnable, running)          ├─ periods = (delta + period_contrib) / 1024          ├─ 跨周期时 Step1: load/runnable/util_sum 全部 decay_load(× y^periods)          ├─ Step2: __accumulate_pelt_segments(periods, 1024-period_contrib, delta%1024)          │     c1 = d1·y^periods;  c2 = 1024·Σy^n(n=1..p-1) = LOAD_AVG_MAX - decay(LOAD_AVG_MAX,p) - 1024;  c3=d3          ├─ period_contrib = delta % 1024          └─ load_sum += load·contrib;  runnable_sum += runnable·contrib<<10;  util_sum += contrib<<10          return periods(>0 表示跨了周期)  → ___update_load_avg(&se->avg, se_weight(se))  /* 只有跨周期才执行 */      divider = PELT_MIN_DIVIDER + period_contrib      load_avg = load·load_sum/divider;  runnable_avg = runnable_sum/divider      WRITE_ONCE(util_avg, util_sum/divider)  → cfs_se_util_change(&se->avg) // 清 UTIL_AVG_UNCHANGED 脏标记  → trace_pelt_se_tp(se)

同理的入口:__update_load_avg_cfs_rq(scale_load_down(cfs_rq->load.weight)/h_nr_running/curr!=NULL)、__update_load_avg_blocked_se(load=runnable=running=0 纯衰减)、update_rt_rq_load_avg、update_dl_rq_load_avg、update_thermal_load_avg(用 capacity 做衰减量)、update_irq_load_avg(先以 clock-running 衰减旧量、再以 clock 加新量)。

5.2 事件驱动的 PELT 更新点(CFS 集成,全部持 rq->lock)

事件
调用链
说明
入队
enqueue_task_fair
→ enqueue_entity→ update_load_avg(cfs_rq, se, UPDATE_TG|DO_ATTACH)
首次/迁移后 attach(attach_entity_load_avg,对齐 period_contrib 并把 se 的 *_avg 并入 cfs_rq)
出队
dequeue_task_fair
→ dequeue_entity→ update_load_avg(..., UPDATE_TG)
出队瞬间累计运行时间;睡眠任务的 util_est 在此后 util_est_dequeue 减除
上下文切换
put_prev_entity
update_load_avg(cfs_rq, prev, 0)set_next_entityupdate_load_avg(..., UPDATE_TG)
每个切换点推进运行实体的 PELT 时间
周期 tick
scheduler_tick
→ task_tick_fair→ entity_tick→ update_load_avg(cfs_rq, curr, UPDATE_TG)
周期性修正 runnable_avg;随后 update_misfit_status/update_overutilized_status
阻塞负载衰减
run_rebalance_domains
/sched_balance_newidle→ update_blocked_averages(cpu)→ __update_blocked_others+__update_blocked_fair(迭代 leaf cfs_rq 对阻塞实体衰减;cfs_rq_is_decayed收敛后移出 leaf 链表,update_blocked_load_status记录 has_blocked
任务退出/迁移离开
task_dead_fair
/migrate_task_rq_fair→ remove_entity_load_avg
加锁累积到 cfs_rq->removed,由下一次 update_cfs_rq_load_avg 批量减除
迁移到达
switched_to_fair
/wakeup 后 enqueue_entity 的 DO_ATTACH → attach_entity_load_avg
se->avg.last_update_time=0
 标记迁移,DO_ATTACH 触发重新 attach
新任务
wake_up_new_task
 → post_init_entity_util_avg
按"剩余容量的一半"预置 util_avg;fair 任务 attach_entity_cfs_rq

5.3 clock_pelt 的维护(上下文:持 rq->lock,任意上下文)

update_rq_clock(rq)  → delta = sched_clock_cpu(cpu) - rq->clock  → rq->clock += delta  → update_rq_clock_task(rq, delta)      → update_irq_load_avg(rq, irq_delta+steal)     [CONFIG_HAVE_SCHED_AVG_IRQ]      → update_rq_clock_pelt(rq, delta)          ├─ rq 空闲: clock_pelt = rq_clock_task(rq)(同步回真实时间)          └─ 忙: clock_pelt += cap_scale(cap_scale(delta, cpu_capacity), freq_capacity)

update_idle_rq_clock_pelt 在 rq 进 idle 时若 util_sum(cfs+rt+dl 三者之和)≥ ((LOAD_AVG_MAX-1024)<<10) - LOAD_AVG_MAX 判定"满载无空闲可偷",把差值累计进 lost_idle_time;读取侧 rq_clock_pelt = clock_pelt - lost_idle_time。CFS 带宽下 cfs_rq_clock_pelt 再扣 throttled 时间。

5.4 负载均衡中的 PELT 消费

  • 忙均衡:SCHED_SOFTIRQ → run_rebalance_domains→ update_blocked_averages + rebalance_domains→ load_balance→ find_busiest_group
  • 新空闲均衡:schedule() → sched_balance_newidle→ update_blocked_averagesload_balance(..., CPU_NEWLY_IDLE)
  • nohz:nohz_balancer_kick根据 check_cpu_capacity/check_misfit_status/nr_busy_cpus 决定 kick_ilb,ILB CPU 上 nohz_idle_balance代跑。

6. 关键 API 接口分析

接口
类别
入参
返回
调用上下文限制
调用前提
失败/边界场景
__update_load_avg_se
私有
now, cfs_rq, se
1=跨周期已更新, 0=未更新
持 rq->lock
se->avg.last_update_time 有效
时钟回拨/delta<1024 返回 0
__update_load_avg_cfs_rq
私有
now, cfs_rq
同上
持 rq->lock
__update_load_avg_blocked_se
私有
now, se
同上
持 rq->lock
用于无锁同步(sync_entity_load_avg
update_rt_rq_load_avg
私有
now, rq, running
同上
持 rq->lock
running 表示 rq->curr 是否 rt
update_dl_rq_load_avg
私有
now, rq, running
同上
持 rq->lock
update_thermal_load_avg
私有
now, rq, capacity
同上
持 rq->lock
CONFIG_SCHED_THERMAL_PRESSURE
无配置时为 inline 0
update_irq_load_avg
私有
rq, running
同上
持 rq->lock
CONFIG_HAVE_SCHED_AVG_IRQ
无配置时为 inline 0
update_load_avg(cfs_rq,se,flags)
CFS 私有
flags=UPDATE_TG/SKIP_AGE_LOAD/DO_ATTACH
void
持 rq->lock
se 已在/将在此 cfs_rq
DO_ATTACH 仅在 !last_update_time 时触发 attach
attach_entity_load_avg
私有
cfs_rq, se
void
持 rq->lock
先 update_cfs_rq_load_avg 对齐时基
detach_entity_load_avg
私有
cfs_rq, se
void
持 rq->lock
remove_entity_load_avg
私有
se
void
持 task rq lock
用 removed.lock 解耦
进程退出/迁移/切调度类
update_cfs_rq_load_avg
私有
now, cfs_rq
decayed(bool)
持 rq->lock
返回值决定是否 update_tg_load_avg
update_blocked_averages
私有
cpu
void
可外部调用(nohz/newidle),内部 rq_lock
被 idle_cpu 判定门控
cpu_util(cpu)
CFS 私有(被均衡/EAS 复用)
cpu
[0, capacity_orig]
无锁,READ_ONCE
cap 到 capacity_orig
cpu_util_without(cpu,p)
私有
cpu, task
[0, capacity_orig]
无锁
与 detach_task 存在小窗口竞争
task_util_est(p)
私有
task
[0,1024]
无锁
task_h_load(p)
私有
task
层级化 load
无锁;内部更新 h_load 链
组调度
div64_ul(load_avg × h_load, cfs_rq_load_avg + 1)
,分母 +1 防除零
rq_clock_pelt
私有
rq
u64
持 rq->lock 且时钟已更新
cfs_rq_clock_pelt
私有
cfs_rq
u64
持 rq->lock
CFS 带宽时含 throttled 扣除
post_init_entity_util_avg
半导出(sched_core 用)
p
void
fork 路径,rq_lock
新任务
非 fair 类仅置 last_update_time

导出面说明:PELT 无 EXPORT_SYMBOL 给内核模块的通用接口;update_rq_clock/scheduler_tick 属 core.c 内部。模块观测只能通过 tracepoint 或读 cpu_util_cfs 之类(仅内核内部)。用户态无系统调用接口。

7. PELT 与内核 SMP 负载均衡的结合逻辑(重点)

7.1 数据互通:均衡统计里哪些字段来自 PELT

update_sg_lb_stats逐 CPU 累加:

  • sgs->group_load += cpu_load(rq)
    (= cfs_rq->avg.load_avg)→ 经典"重量"均衡。
  • sgs->group_util += cpu_util(i)
    (= max(util_avg, util_est.enqueued),cap 到 capacity_orig)→ 利用率均衡。
  • sgs->group_runnable += cpu_runnable(rq)
    (= cfs_rq->avg.runnable_avg)。
  • sgs->group_misfit_task_load
    rq->misfit_task_load(来自 task_h_load,PELT load_avg×h_load,非大小核处理器不考虑)。
  • 超载/超用标记:*sg_status |= SG_OVERLOAD(nr_running>1)/SG_OVERUTILIZEDcpu_overutilized(i),基于 cpu_util+uclamp)。

group_classify→ group_has_capacity/group_is_overloaded直接比较 group_capacity vs group_util/group_runnable(PELT 信号 vs 容量)。

7.2 PELT 如何修改均衡决策(决策矩阵)

find_busiest_group决策顺序:

  1. sched_energy_enabled() && !READ_ONCE(rd->overutilized)
     → out_balancedoverutilized(PELT util 判定)直接关闭负载均衡,把布置权交给 EAS
  2. busiest group_type == group_misfit_task → 强制均衡,calculate_imbalance设 env->migration_type = migrate_misfit; env->imbalance = 1
  3. group_imbalanced
    /group_asym_packing → 强制搬 1 个/全部任务。
  4. local 有 spare:busiest 超载时 migrate_utilimbalance = max(local_capacity, local_util) - local_util——直接拿 PELT 利用率计算要搬的"量"migrate_task 时按 idle_cpus 差搬。
  5. 都满载/超载:migrate_load,按 avg_load(PELT load_avg/容量)差额求 min imbalance。

detach_tasks按 migration_type 扣减:

  • migrate_load
    load = task_h_load(p)(PELT),shr_bound(load, nr_balance_failed) > env->imbalance 则跳过。
  • migrate_util
    util = task_util_est(p)(PELT+util_est),同样带 shr_bound 判定。
  • migrate_misfit
    task_fits_cpu(p, src_cpu) 才搬。

7.3 唤醒路径(fast/slow/EAS)里的 PELT

select_task_rq_fair(p, prev_cpu, sd_flag, wake_flags)  ├─ EAS(sched_energy_enabled): find_energy_efficient_cpu(p, prev_cpu)  │     sync_entity_load_avg(p->se);  util = cpu_util_next(cpu,p,cpu);  spare_cap = capacity_of - util  │     compute_energy() 底层走 schedutil_cpu_util(ENERGY_UTIL) → schedutil_cpu_util  │     条件: rd->overutilized 则 fail(PELT 信号是 EAS 的开关)  ├─ fast path: wake_affine(WA_WEIGHT 用 cpu_load,即 PELT load_avg)  │     └─ 失败 → select_idle_sibling → SIS_AVG_CPU/SIS_PROP 扫描  └─ slow path: find_idlest_cpu → find_idlest_group        → update_sg_wakeup_stats:  sgs->group_util += cpu_util_without(i,p)              sgs->group_runnable += cpu_runnable_without(i,p);  group_load += cpu_load_without        → group_classify + update_pick_idlest 按 group_type/avg_load/idle_cpus/group_util 挑最闲组        → find_idlest_group_cpu(idle 优先,否则按 cpu_load 挑最轻)

7.4 nohz / 周期均衡触发(PELT 是触发器之一)

scheduler_tick  ├─ update_rq_clock → (PELT 时间推进)  ├─ update_thermal_load_avg  ├─ task_tick_fair → entity_tick → update_load_avg   [运行实体 PELT 更新]  ├─ update_misfit_status / update_overutilized_status [PELT 驱动 rq->misfit_task_load / rd->overutilized]  └─ trigger_load_balance(rq)       ├─ time_after_eq(jiffies, rq->next_balance) → raise_softirq(SCHED_SOFTIRQ)       └─ nohz_balancer_kick(rq)             ├─ nohz.has_blocked && 到点 → NOHZ_STATS_KICK             ├─ rq->nr_running>=2 → NOHZ_BALANCE_KICK             ├─ check_cpu_capacity(rq,sd)(PELT util vs 容量)→ NOHZ_BALANCE_KICK             ├─ check_misfit_status(rq,sd)(PELT misfit)→ NOHZ_BALANCE_KICK             └─ sds->nr_busy_cpus>1 → NOHZ_BALANCE_KICK       → kick_ilb → 目标 ILB CPU 的 run_rebalance_domains             ├─ nohz_idle_balance             └─ update_blocked_averages + rebalance_domains → load_balance

7.5 全部挂钩调用链(PELT → 负载均衡)

  1. 统计load_balance → find_busiest_group → update_sd_lb_stats → update_sg_lb_stats→ {cpu_load, cpu_util, cpu_runnable, misfit_task_load}
  2. 决策group_classify → group_is_overloaded/group_has_capacity(group_util/group_runnable)→ update_sd_pick_busiest → calculate_imbalance(migration_type + imbalance)。
  3. 执行load_balance → detach_tasks(task_h_load / task_util_est / task_fits_cpu)→ detach_task → deactivate_task → dequeue_task_fair → update_load_avg → attach_tasks → enqueue_task_fair → update_load_avg(DO_ATTACH)
  4. 阻塞衰减rebalance_domains / sched_balance_newidle → update_blocked_averages→ __update_blocked_fair → update_cfs_rq_load_avg
  5. 门控cpu_overutilized → rd->overutilizedupdate_misfit_status → rq->misfit_task_loadfind_busiest_group/find_energy_efficient_cpu
  6. nohz 触发nohz_balancer_kick → check_cpu_capacity/check_misfit_status → kick_ilb

8. 编译配置与开关

开关
位置
作用
CONFIG_SMP
Kconfig(架构)
PELT 使能必要条件
debugfs sched_features
/sys/kernel/debug/sched_features
(需 CONFIG_SCHED_DEBUG)
动态开关 UTIL_EST/UTIL_EST_FASTUP/ATTACH_AGE_LOAD/WA_IDLE/WA_WEIGHT/LB_MIN/SIS_PROP/NONTASK_CAPACITY 等(kernel/sched/features.h)
kernel.sched_energy_aware/proc/sys/kernel/sched_energy_aware
( 默认 1)
全局 EAS 使能,间接控制 PELT 在均衡/EAS 间的门控
kernel.sched_util_clamp_min/max/proc/sys/kernel/sched_util_clamp_min
/sched_util_clamp_max
uclamp,叠加在 PELT util 上参与 util_fits_cpu/overutilized
kernel.sched_migration_cost_ns
kernel.sched_nr_migrate
/proc/sys/kernel/
均衡代价与单轮迁移上限(间接影响 blocked 衰减频率)
kernel.sched_schedstats/proc/sys/kernel/sched_schedstats
schedstat 开关

8.1 观测手段

# 1) tracepoint:PELT 每次更新打点(需定义 trace 或用 ftrace events 动态挂载)# pelt_*_tp 是 DECLARE_TRACE 空钩子(include/trace/events/sched.h),可被# tracepoint_probe_register 挂接,不直接在 tracefs 暴露;# 常规观测用已定义的 trace 事件:cat /sys/kernel/fs/tracing/available_events | grep sched# sched:sched_switch / sched_stat_* 等# 2) debugfs sched_features 开关 UTIL_EST(观察对均衡行为的影响)echo ”NO_UTIL_EST” > /sys/kernel/debug/sched_featuresecho ”UTIL_EST”    > /sys/kernel/debug/sched_features# 3) 各 CPU 的 PELT 聚合值(每 CPU debug 文件,需 CONFIG_SCHED_DEBUG)# /sys/kernel/debug/sched/debug 输出每 rq 的 .avg.load_avg / .avg.util_avg / .avg.runnable_avg# 4) 负载均衡统计计数(schedstat)grep -E ”lb_|group_” /proc/schedstat# 5) 每任务 util:/proc//sched 的 se.util_avg / se.runnable_avg / se.avg.load_avggrep -E ”util_avg|load_avg|runnable” /proc//sched# 6) perf:观测 wakeup 选核与均衡perf sched record -- sleep 5 && perf sched latencyperf trace -e sched:sched_wakeup,sched:sched_switch -- sleep 1# 7) 查看 overutilized / nohz 状态cat /sys/kernel/debug/sched/debug | grep -i -E ”overutil|has_blocked|nohz”

最新文章

随机文章

基本 文件 流程 错误 SQL 调试
  1. 请求信息 : 2026-08-21 13:34:27 HTTP/2.0 GET : https://f.mffb.com.cn/a/509506.html
  2. 运行时间 : 0.223664s [ 吞吐率:4.47req/s ] 内存消耗:4,570.28kb 文件加载:140
  3. 缓存信息 : 0 reads,0 writes
  4. 会话信息 : SESSION_ID=349f903afa0fb577c54bf1db65556e66
  1. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/public/index.php ( 0.79 KB )
  2. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/autoload.php ( 0.17 KB )
  3. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/composer/autoload_real.php ( 2.49 KB )
  4. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/composer/platform_check.php ( 0.90 KB )
  5. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/composer/ClassLoader.php ( 14.03 KB )
  6. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/composer/autoload_static.php ( 4.90 KB )
  7. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-helper/src/helper.php ( 8.34 KB )
  8. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-validate/src/helper.php ( 2.19 KB )
  9. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/helper.php ( 1.47 KB )
  10. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/stubs/load_stubs.php ( 0.16 KB )
  11. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Exception.php ( 1.69 KB )
  12. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-container/src/Facade.php ( 2.71 KB )
  13. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/symfony/deprecation-contracts/function.php ( 0.99 KB )
  14. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/symfony/polyfill-mbstring/bootstrap.php ( 8.26 KB )
  15. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/symfony/polyfill-mbstring/bootstrap80.php ( 9.78 KB )
  16. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/symfony/var-dumper/Resources/functions/dump.php ( 1.49 KB )
  17. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-dumper/src/helper.php ( 0.18 KB )
  18. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/symfony/var-dumper/VarDumper.php ( 4.30 KB )
  19. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/App.php ( 15.30 KB )
  20. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-container/src/Container.php ( 15.76 KB )
  21. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/psr/container/src/ContainerInterface.php ( 1.02 KB )
  22. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/app/provider.php ( 0.19 KB )
  23. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Http.php ( 6.04 KB )
  24. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-helper/src/helper/Str.php ( 7.29 KB )
  25. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Env.php ( 4.68 KB )
  26. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/app/common.php ( 0.03 KB )
  27. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/helper.php ( 18.78 KB )
  28. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Config.php ( 5.54 KB )
  29. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/config/app.php ( 0.95 KB )
  30. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/config/cache.php ( 0.78 KB )
  31. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/config/console.php ( 0.23 KB )
  32. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/config/cookie.php ( 0.56 KB )
  33. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/config/database.php ( 2.48 KB )
  34. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/facade/Env.php ( 1.67 KB )
  35. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/config/filesystem.php ( 0.61 KB )
  36. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/config/lang.php ( 0.91 KB )
  37. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/config/log.php ( 1.35 KB )
  38. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/config/middleware.php ( 0.19 KB )
  39. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/config/route.php ( 1.89 KB )
  40. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/config/session.php ( 0.57 KB )
  41. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/config/trace.php ( 0.34 KB )
  42. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/config/view.php ( 0.82 KB )
  43. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/app/event.php ( 0.25 KB )
  44. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Event.php ( 7.67 KB )
  45. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/app/service.php ( 0.13 KB )
  46. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/app/AppService.php ( 0.26 KB )
  47. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Service.php ( 1.64 KB )
  48. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Lang.php ( 7.35 KB )
  49. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/lang/zh-cn.php ( 13.70 KB )
  50. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/initializer/Error.php ( 3.31 KB )
  51. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/initializer/RegisterService.php ( 1.33 KB )
  52. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/services.php ( 0.14 KB )
  53. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/service/PaginatorService.php ( 1.52 KB )
  54. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/service/ValidateService.php ( 0.99 KB )
  55. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/service/ModelService.php ( 2.04 KB )
  56. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-trace/src/Service.php ( 0.77 KB )
  57. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Middleware.php ( 6.72 KB )
  58. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/initializer/BootService.php ( 0.77 KB )
  59. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/Paginator.php ( 11.86 KB )
  60. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-validate/src/Validate.php ( 63.20 KB )
  61. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/Model.php ( 23.55 KB )
  62. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/model/concern/Attribute.php ( 21.05 KB )
  63. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/model/concern/AutoWriteData.php ( 4.21 KB )
  64. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/model/concern/Conversion.php ( 6.44 KB )
  65. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/model/concern/DbConnect.php ( 5.16 KB )
  66. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/model/concern/ModelEvent.php ( 2.33 KB )
  67. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/model/concern/RelationShip.php ( 28.29 KB )
  68. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-helper/src/contract/Arrayable.php ( 0.09 KB )
  69. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-helper/src/contract/Jsonable.php ( 0.13 KB )
  70. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/model/contract/Modelable.php ( 0.09 KB )
  71. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Db.php ( 2.88 KB )
  72. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/DbManager.php ( 8.52 KB )
  73. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Log.php ( 6.28 KB )
  74. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Manager.php ( 3.92 KB )
  75. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/psr/log/src/LoggerTrait.php ( 2.69 KB )
  76. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/psr/log/src/LoggerInterface.php ( 2.71 KB )
  77. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Cache.php ( 4.92 KB )
  78. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/psr/simple-cache/src/CacheInterface.php ( 4.71 KB )
  79. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-helper/src/helper/Arr.php ( 16.63 KB )
  80. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/cache/driver/File.php ( 7.84 KB )
  81. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/cache/Driver.php ( 9.03 KB )
  82. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/contract/CacheHandlerInterface.php ( 1.99 KB )
  83. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/app/Request.php ( 0.09 KB )
  84. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Request.php ( 55.78 KB )
  85. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/app/middleware.php ( 0.25 KB )
  86. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Pipeline.php ( 2.61 KB )
  87. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-trace/src/TraceDebug.php ( 3.40 KB )
  88. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/middleware/SessionInit.php ( 1.94 KB )
  89. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Session.php ( 1.80 KB )
  90. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/session/driver/File.php ( 6.27 KB )
  91. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/contract/SessionHandlerInterface.php ( 0.87 KB )
  92. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/session/Store.php ( 7.12 KB )
  93. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Route.php ( 23.73 KB )
  94. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/route/RuleName.php ( 5.75 KB )
  95. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/route/Domain.php ( 2.53 KB )
  96. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/route/RuleGroup.php ( 22.43 KB )
  97. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/route/Rule.php ( 26.95 KB )
  98. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/route/RuleItem.php ( 9.78 KB )
  99. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/route/app.php ( 1.72 KB )
  100. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/facade/Route.php ( 4.70 KB )
  101. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/route/dispatch/Controller.php ( 4.74 KB )
  102. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/route/Dispatch.php ( 10.44 KB )
  103. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/app/controller/Index.php ( 4.81 KB )
  104. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/app/BaseController.php ( 2.05 KB )
  105. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/facade/Db.php ( 0.93 KB )
  106. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/connector/Mysql.php ( 5.44 KB )
  107. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/PDOConnection.php ( 52.47 KB )
  108. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/Connection.php ( 8.39 KB )
  109. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/ConnectionInterface.php ( 4.57 KB )
  110. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/builder/Mysql.php ( 16.58 KB )
  111. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/Builder.php ( 24.06 KB )
  112. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/BaseBuilder.php ( 27.50 KB )
  113. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/Query.php ( 15.71 KB )
  114. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/BaseQuery.php ( 45.13 KB )
  115. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/concern/TimeFieldQuery.php ( 7.43 KB )
  116. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/concern/AggregateQuery.php ( 3.26 KB )
  117. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/concern/ModelRelationQuery.php ( 20.07 KB )
  118. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/concern/ParamsBind.php ( 3.66 KB )
  119. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/concern/ResultOperation.php ( 7.01 KB )
  120. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/concern/WhereQuery.php ( 19.37 KB )
  121. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/concern/JoinAndViewQuery.php ( 7.11 KB )
  122. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/concern/TableFieldInfo.php ( 2.63 KB )
  123. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/concern/Transaction.php ( 2.77 KB )
  124. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/log/driver/File.php ( 5.96 KB )
  125. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/contract/LogHandlerInterface.php ( 0.86 KB )
  126. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/log/Channel.php ( 3.89 KB )
  127. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/event/LogRecord.php ( 1.02 KB )
  128. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-helper/src/Collection.php ( 16.47 KB )
  129. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/facade/View.php ( 1.70 KB )
  130. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/View.php ( 4.39 KB )
  131. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Response.php ( 8.81 KB )
  132. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/response/View.php ( 3.29 KB )
  133. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Cookie.php ( 6.06 KB )
  134. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-view/src/Think.php ( 8.38 KB )
  135. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/contract/TemplateHandlerInterface.php ( 1.60 KB )
  136. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-template/src/Template.php ( 46.61 KB )
  137. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-template/src/template/driver/File.php ( 2.41 KB )
  138. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-template/src/template/contract/DriverInterface.php ( 0.86 KB )
  139. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/runtime/temp/067d451b9a0c665040f3f1bdd3293d68.php ( 11.98 KB )
  140. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-trace/src/Html.php ( 4.42 KB )
  1. CONNECT:[ UseTime:0.000793s ] mysql:host=127.0.0.1;port=3306;dbname=f_mffb;charset=utf8mb4
  2. SHOW FULL COLUMNS FROM `fenlei` [ RunTime:0.000576s ]
  3. SELECT * FROM `fenlei` WHERE `fid` = 0 [ RunTime:0.000291s ]
  4. SELECT * FROM `fenlei` WHERE `fid` = 63 [ RunTime:0.000337s ]
  5. SHOW FULL COLUMNS FROM `set` [ RunTime:0.000563s ]
  6. SELECT * FROM `set` [ RunTime:0.015270s ]
  7. SHOW FULL COLUMNS FROM `article` [ RunTime:0.000871s ]
  8. SELECT * FROM `article` WHERE `id` = 509506 LIMIT 1 [ RunTime:0.027765s ]
  9. UPDATE `article` SET `lasttime` = 1787290467 WHERE `id` = 509506 [ RunTime:0.035141s ]
  10. SELECT * FROM `fenlei` WHERE `id` = 67 LIMIT 1 [ RunTime:0.005562s ]
  11. SELECT * FROM `article` WHERE `id` < 509506 ORDER BY `id` DESC LIMIT 1 [ RunTime:0.010105s ]
  12. SELECT * FROM `article` WHERE `id` > 509506 ORDER BY `id` ASC LIMIT 1 [ RunTime:0.000467s ]
  13. SELECT * FROM `article` WHERE `id` < 509506 ORDER BY `id` DESC LIMIT 10 [ RunTime:0.031055s ]
  14. SELECT * FROM `article` WHERE `id` < 509506 ORDER BY `id` DESC LIMIT 10,10 [ RunTime:0.002260s ]
  15. SELECT * FROM `article` WHERE `id` < 509506 ORDER BY `id` DESC LIMIT 20,10 [ RunTime:0.024488s ]
0.225235s