Skip to content
Advertisement

What is the for_each_sched_entity macro doing?

#define for_each_sched_rt_entity(rt_se) 
    for (; rt_se; rt_se = NULL)

I’m not familiar with what this for loop is actually doing. Would anyone be able to explain?

https://elixir.bootlin.com/linux/v5.10.75/source/kernel/sched/rt.c#L621

Advertisement

Answer

This macro is setting rt_se to NULL after the instructions block that follows has been executed. The use of such “access” macro is common in the kernel to make the code more clear and robust.

User contributions licensed under: CC BY-SA
6 People found this is helpful
Advertisement