<div dir="ltr"><p style="margin:0px 0px 1em;padding:0px;border:0px;font-variant-numeric:inherit;font-variant-east-asian:inherit;font-stretch:inherit;line-height:inherit;font-family:Arial,"Helvetica Neue",Helvetica,sans-serif;font-size:15px;vertical-align:baseline;box-sizing:inherit;clear:both;color:rgb(36,39,41)">I am reading Robert Love's Book Linux Kernel Development(<a href="https://rads.stackoverflow.com/amzn/click/com/B003V4ATI0">https://rads.stackoverflow.com/amzn/click/com/B003V4ATI0</a>).</p><p style="margin:0px 0px 1em;padding:0px;border:0px;font-variant-numeric:inherit;font-variant-east-asian:inherit;font-stretch:inherit;line-height:inherit;font-family:Arial,"Helvetica Neue",Helvetica,sans-serif;font-size:15px;vertical-align:baseline;box-sizing:inherit;clear:both;color:rgb(36,39,41)">It uses the 2.6.33 kernel for demonstration.</p><p style="margin:0px 0px 1em;padding:0px;border:0px;font-variant-numeric:inherit;font-variant-east-asian:inherit;font-stretch:inherit;line-height:inherit;font-family:Arial,"Helvetica Neue",Helvetica,sans-serif;font-size:15px;vertical-align:baseline;box-sizing:inherit;clear:both;color:rgb(36,39,41)">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.</p><p style="margin:0px 0px 1em;padding:0px;border:0px;font-variant-numeric:inherit;font-variant-east-asian:inherit;font-stretch:inherit;line-height:inherit;font-family:Arial,"Helvetica Neue",Helvetica,sans-serif;font-size:15px;vertical-align:baseline;box-sizing:inherit;clear:both;color:rgb(36,39,41)">One example:</p><p style="margin:0px 0px 1em;padding:0px;border:0px;font-variant-numeric:inherit;font-variant-east-asian:inherit;font-stretch:inherit;line-height:inherit;font-family:Arial,"Helvetica Neue",Helvetica,sans-serif;font-size:15px;vertical-align:baseline;box-sizing:inherit;clear:both;color:rgb(36,39,41)">static struct sched_entity *__pick_next_entity(struct cfs_rq *cfs_rq)<br>{<br>       struct rb_node *left = cfs_rq->rb_leftmost;<br><br>      if (!left)<br>            return NULL;<br><br>        return rb_entry(left, struct sched_entity, run_node);<br>}<br><br>static struct sched_entity *__pick_last_entity(struct cfs_rq *cfs_rq)<br>{<br>  struct rb_node *last = rb_last(&cfs_rq->tasks_timeline);<br><br>     if (!last)<br>            return NULL;<br><br>        return rb_entry(last, struct sched_entity, run_node);<br>}<br></p><div><br></div><div>This in kernel/sched_fair.c lines 384 and 394 in 2.6.33 kernel.<br><br>Where is the run_node coming from ?<br><br>I have grep ed(<a href="https://livegrep.com/search/linux?q=run_node&fold_case=auto&regex=false&context=true">https://livegrep.com/search/linuxq=run_node&fold_case=auto&regex=false&context=true</a>) the entire source base over here, and I have not found any definition of run_node that would allow it to be used like this.</div><div><br>There is a declaration(<a href="https://github.com/torvalds/linux/blob/219d54332a09e8d8741c1e1982f5eae56099de85/include/linux/sched.h#L448">https://github.com/torvalds/linux/blob/219d54332a09e8d8741c1e1982f5eae56099de85/include/linux/sched.h#L448</a>) in the sched_entity structure, but nothing outside of it that would allow it to be used like this.<br><br>I cannot understand how things are organized, its really confusing.<br><br>What is going on ?<br></div>-- <br><div dir="ltr" class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr">Regards,<div>Sreyan Chakravarty</div></div></div></div>