I am reading Robert Love's Book Linux Kernel Development(https://rads.stackoverflow.com/amzn/click/com/B003V4ATI0).
It uses the 2.6.33 kernel for demonstration.
I have been going through certain parts of the source and can't find out where is the initial definition of many things. A lot of things are just used, like "magic" without me finding the definition.
One example:
static struct sched_entity *__pick_next_entity(struct cfs_rq *cfs_rq)
{
struct rb_node *left = cfs_rq->rb_leftmost;
if (!left)
return NULL;
return rb_entry(left, struct sched_entity, run_node);
}
static struct sched_entity *__pick_last_entity(struct cfs_rq *cfs_rq)
{
struct rb_node *last = rb_last(&cfs_rq->tasks_timeline);
if (!last)
return NULL;
return rb_entry(last, struct sched_entity, run_node);
}