title: Implementing a DFS for Linux Kernel Processes using list_for_each
body: <p>I am trying to implement a DFS to print out all the processes in the linux Kernel. The list_for_each function caught my interest as follows:</p>
  
  <pre><code>list_for_each(list, &amp;init_task-&gt;chidlren){
      task = list_entry(list, struct task_struct, sibling);
  }
  </code></pre>
  
  <p>Is it possible to do a DFS using the list_for_each function? Since list_for_each only prints out the first level of children it doesn't seem possible to go to the deepest level of a single children.</p>