title: how to add nodes to kernel linkedlist
body: <p>I have a struct like:</p>
  
  <pre><code>struct test
  {
     int a;
     struct* page p;
     struct list_head l;
  };
  </code></pre>
  
  <p>I have checked <code>include/linux/list.h</code> but I am not sure how should I add to my list. what I do is :</p>
  
  <pre><code>test* node_1 = (struct test*)malloc(sizeof(test));
  node_1-&gt;a = 10;
  node_1-&gt;p = alloc_page();
  LIST_HEAD(node_1-&gt;l);
  // for the rest nodes
  test* node_2 = (struct test*)malloc(sizeof(test));
  node_2-&gt;a = 20;
  node_2-&gt;p = alloc_page();
  //can I use list_add or should I write a custom add? 
  list_add(node_2,node_1); //???
  </code></pre>
  
  <p>For adding each node the second argument of <code>list_add</code> should be <code>node_1</code>? </p>