title: Can't understand the purpose of pid->tasks[] list
body: <p>I'm using CentOS7 3.10.0-1160.el7 kernel.</p>
  <p>I've added to the kernel the following code to analyze the <code>pid-&gt;tasks</code> of needed task whenever I want:</p>
  <pre><code>struct pid *pid = current-&gt;pids[PIDTYPE_PGID].pid;
  hlist_for_each_entry(task, &amp;pid-&gt;tasks[PIDTYPE_PGID], pids[PIDTYPE_PGID].node) {
          char buf_append[128] = {0}; 
  
          snprintf(buf_append, sizeof(buf_append), &quot; [task:%p|%s|%d|%d]&quot;,
                          task, task-&gt;comm, task-&gt;pid, task-&gt;tgid);
          strncat(buf, buf_append, sizeof(buf) - strlen(buf) - 1);
  }
  </code></pre>
  <p>I've also written a C program that creates few threads that trigger that output from kernel.</p>
  <p>When I run the program I get the following debug output:</p>
  <pre class="lang-none prettyprint-override"><code>[ 2327.780765] pid: [8856] tgid: [8853] [task:ffff9671b9dc0000|my_prog|8853|8853]
  [ 2327.790319] pid: [8853] tgid: [8853] [task:ffff9671b9dc0000|my_prog|8853|8853]
  [ 2327.793864] pid: [8857] tgid: [8853] [task:ffff9671b9dc0000|my_prog|8853|8853]
  [ 2327.798440] pid: [8854] tgid: [8853] [task:ffff9671b9dc0000|my_prog|8853|8853]
  [ 2327.803237] pid: [8858] tgid: [8853] [task:ffff9671b9dc0000|my_prog|8853|8853]
  [ 2327.808940] pid: [8855] tgid: [8853] [task:ffff9671b9dc0000|my_prog|8853|8853]
  [ 2328.792194] pid: [8856] tgid: [8853] [task:ffff9671b9dc0000|my_prog|8853|8853]
  [ 2328.797662] pid: [8857] tgid: [8853] [task:ffff9671b9dc0000|my_prog|8853|8853]
  [ 2328.802301] pid: [8854] tgid: [8853] [task:ffff9671b9dc0000|my_prog|8853|8853]
  [ 2328.808266] pid: [8858] tgid: [8853] [task:ffff9671b9dc0000|my_prog|8853|8853]
  [ 2328.813471] pid: [8855] tgid: [8853] [task:ffff9671b9dc0000|my_prog|8853|8853]
  </code></pre>
  <ul>
  <li>pid/tgid - IDs of a thread that triggers the output</li>
  </ul>
  <p>So, you can see that there are several tasks that share the same tgid (8853) but their <code>pid-&gt;tasks[PIDTYPE_PGID]</code> list contains only one task (group_leader). <strong>Why is that?</strong></p>
  <p>I expect that list should contain all those tasks-thread.</p>