mirror of
https://github.com/gatieme/LDD-LinuxDeviceDrivers.git
synced 2026-08-18 17:17:39 +08:00
scheduler/load_balance: update mermaid
This commit is contained in:
@@ -0,0 +1,56 @@
|
||||
flowchart TB
|
||||
subgraph DoLoadBalance [触发负载均衡]
|
||||
direction TB
|
||||
%% 周期性负载均衡器 run_rebalance_domains
|
||||
rebalance_domains --> load_balance;
|
||||
|
||||
%% IDLE 负载均衡器
|
||||
newidle_balance --> load_balance;
|
||||
end
|
||||
|
||||
%% 负载均衡核心逻辑
|
||||
subgraph LoadBalance [负载均衡核心逻辑]
|
||||
direction TB
|
||||
load_balance --> should_we_balance;
|
||||
load_balance --> find_busiest_group;
|
||||
load_balance --> find_busiest_queue;
|
||||
load_balance --> detach_tasks;
|
||||
load_balance --> attach_tasks;
|
||||
load_balance --> need_active_balance;
|
||||
load_balance --> stop_one_cpu_nowait;
|
||||
|
||||
subgraph ShowWeBalance [寻找 dst CPU];
|
||||
direction TB
|
||||
should_we_balance --> group_balance_mask;
|
||||
should_we_balance --> group_balance_cpu;
|
||||
end
|
||||
|
||||
subgraph FindBusiestQueue [寻找 src CPU]
|
||||
direction TB
|
||||
find_busiest_group --> init_sd_lb_stats;
|
||||
find_busiest_group --> update_sd_lb_stats;
|
||||
find_busiest_group --> sched_energy_enabled;
|
||||
find_busiest_group --> compare_local_busiest_group_type;
|
||||
find_busiest_group --> calculate_imbalance;
|
||||
find_busiest_queue --> for_each_sched_group_span;
|
||||
|
||||
for_each_sched_group_span --> fbq_classify_rq;
|
||||
for_each_sched_group_span --> switch_env_migration_type_FBQ;
|
||||
end
|
||||
|
||||
subgraph NormalMigrate [Normal Migration]
|
||||
direction TB
|
||||
detach_tasks --> can_migrate_task;
|
||||
detach_tasks --> switch_env_migration_type_DT
|
||||
detach_tasks --> detach_task;
|
||||
|
||||
attach_tasks --> attach_task;
|
||||
end
|
||||
|
||||
subgraph ActiveMigration [Active Migration]
|
||||
direction TB
|
||||
need_active_balance --> stop_one_cpu_nowait --> active_load_balance_cpu_stop;
|
||||
active_load_balance_cpu_stop --> detach_one_task;
|
||||
active_load_balance_cpu_stop --> attach_one_task;
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,40 @@
|
||||
flowchart TB
|
||||
%% IDLE 负载均衡器
|
||||
subgraph TriggerILB [触发 New Idle Load Balance]
|
||||
direction TB
|
||||
__schedule --> pick_next_task;
|
||||
|
||||
pick_next_task --! sched_core_enabled--> __pick_next_task;
|
||||
pick_next_task --sched_core_enabled--> put_prev_task_balance;
|
||||
|
||||
__pick_next_task --> pick_next_task_fair;
|
||||
__pick_next_task --> pick_next_task_idle;
|
||||
__pick_next_task --> put_prev_task_balance;
|
||||
__pick_next_task --> class_pick_next_task("class->pick_next_task");
|
||||
|
||||
class_pick_next_task -...-> pick_next_task_fair
|
||||
put_prev_task_balance --> for_class_range_prev_to_idle --> class_balance("class->balance") --> balance_fair --> newidle_balance;
|
||||
pick_next_task_fair --> newidle_balance;
|
||||
|
||||
style pick_next_task_fair fill:#bbf,stroke:#f66,stroke-width:2px,color:#fff,stroke-dasharray: 5 5
|
||||
style balance_fair fill:#bbf,stroke:#f66,stroke-width:2px,color:#fff,stroke-dasharray: 5 5
|
||||
|
||||
end
|
||||
|
||||
subgraph DoILB [执行 New Idle Load Balance]
|
||||
direction TB
|
||||
newidle_balance --> update_misfit_status --> nohz_newidle_balance;
|
||||
newidle_balance --> update_next_balance--> nohz_newidle_balance;
|
||||
newidle_balance --> update_blocked_averages --> nohz_newidle_balance;
|
||||
newidle_balance --> for_each_domain_ILB --> nohz_newidle_balance;
|
||||
|
||||
for_each_domain_ILB --> update_next_balance;
|
||||
for_each_domain_ILB --> load_balance;
|
||||
for_each_domain_ILB --> update_newidle_cost;
|
||||
|
||||
nohz_newidle_balance --> set_NOHZ_NEWILB_KICK
|
||||
|
||||
style newidle_balance fill:#f9f,stroke:#333,stroke-width:4px
|
||||
style load_balance fill:#bbf,stroke:#f66,stroke-width:2px,color:#fff,stroke-dasharray: 5 5
|
||||
|
||||
end
|
||||
@@ -0,0 +1,38 @@
|
||||
flowchart TB
|
||||
%% 周期性负载均衡器 run_rebalance_domains
|
||||
run_rebalance_domains --> update_blocked_averages;
|
||||
run_rebalance_domains --> rebalance_domains;
|
||||
|
||||
subgraph TriggerNOHZLB [触发 NOHZ Load Balance]
|
||||
direction TB
|
||||
%% KICK
|
||||
scheduler_tick --> trigger_load_balance --> nohz_balancer_kick;
|
||||
trigger_load_balance --> raise_softirq_SCHED_SOFTIRQ;
|
||||
nohz_balancer_kick --> SetNOHZ --> kick_ilb --> find_new_ilb --> KICK_CPU_BY_IPI -...-> nohz_csd_func -...-> raise_softirq_SCHED_SOFTIRQ;
|
||||
|
||||
subgraph SetNOHZ [设置 NOHZ Load Balance 标记]
|
||||
direction TB
|
||||
set_NOHZ_STATS_KICK
|
||||
set_NOHZ_BALANCE_KICK
|
||||
set_NOHZ_NEXT_KICK
|
||||
end
|
||||
end
|
||||
|
||||
subgraph DoNOHZLB [执行 NOHZ Load Balance]
|
||||
direction TB
|
||||
|
||||
raise_softirq_SCHED_SOFTIRQ --> run_rebalance_domains;
|
||||
|
||||
%% NOHZ 负载均衡器 nohz_idle_balance
|
||||
run_rebalance_domains --has NOHZ_BALANCE_KICK--> nohz_idle_balance;
|
||||
nohz_idle_balance --> clear_nohz_idle_balance;
|
||||
nohz_idle_balance --> _nohz_idle_balance;
|
||||
|
||||
_nohz_idle_balance --> for_each_nohz_idle_cpus_mask;
|
||||
for_each_nohz_idle_cpus_mask --has NOHZ_STATS_KICK--> update_nohz_stats --> update_blocked_averages;
|
||||
for_each_nohz_idle_cpus_mask --has NOHZ_BALANCE_KICK --> rebalance_domains;
|
||||
end
|
||||
|
||||
%% IDLE 负载均衡器
|
||||
newidle_balance --> nohz_newidle_balance;
|
||||
nohz_newidle_balance --> set_NOHZ_NEWILB_KICK
|
||||
@@ -1,5 +1,4 @@
|
||||
flowchart TB
|
||||
|
||||
subgraph SelectRQ [触发选核--被动负载均衡]
|
||||
direction TB
|
||||
FORK[__do_fork] --> wake_up_new_task(wake_up_new_task)
|
||||
|
||||
@@ -0,0 +1,33 @@
|
||||
flowchart TB
|
||||
%% 周期性负载均衡器 run_rebalance_domains
|
||||
subgraph TriggerPeriodicLoadBalance [触发 Periodic Load Balance]
|
||||
direction TB
|
||||
scheduler_tick --> trigger_load_balance --> raise_softirq_SCHED_SOFTIRQ("raise_softirq(SCHED_SOFTIRQ)") -...-> run_rebalance_domains;
|
||||
trigger_load_balance --> nohz_balancer_kick
|
||||
run_rebalance_domains --> RunRebalanceDomains("run_rebalance_domains");
|
||||
|
||||
subgraph RunRebalanceDomains [run_rebalance_domains]
|
||||
direction TB
|
||||
nohz_idle_balance;
|
||||
update_blocked_averages;
|
||||
rebalance_domains
|
||||
|
||||
style rebalance_domains fill:#f9f,stroke:#333,stroke-width:4px
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
subgraph DoPeriodicLoadBalance [执行 Periodic Load Balance]
|
||||
direction TB
|
||||
rebalance_domains --> for_each_domain_LB(自底向上遍历所有的调度域) --> DoLoadBalance;
|
||||
|
||||
subgraph DoLoadBalance
|
||||
direction TB
|
||||
update_newidle_cost;
|
||||
get_sd_balance_interval;
|
||||
load_balance;
|
||||
update_next_balance;
|
||||
|
||||
style load_balance fill:#f9f,stroke:#333,stroke-width:4px
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user