title: The task is removed from cgroup after the exit
body: <p>Here is my test code. I want to write current PID to the <code>tasks</code> file:</p>
  
  <pre><code>package subsystems
  
  import (
    "io/ioutil"
    "os"
    "path"
    "strconv"
    "testing"
  )
  
  func TestSubsystems(t *testing.T) {
    p := "/sys/fs/cgroup/memory/test1"
    f := "tasks"
  
    err := os.MkdirAll(p, 0644)
  
    if err != nil {
      t.Log(err.Error())
    }
  
    pid := os.Getpid()
  
    if err := ioutil.WriteFile(path.Join(p, f), []byte(strconv.Itoa(pid)), 0644); err != nil {
      t.Failed()
    }
  }
  </code></pre>
  
  <p>But when the program exits with code 0, I cannot see anything in <code>tasks</code>:</p>
  
  <pre><code>root@ubuntu:/sys/fs/cgroup/memory/test1# cat tasks
  root@ubuntu:/sys/fs/cgroup/memory/test1# cat tasks
  root@ubuntu:/sys/fs/cgroup/memory/test1# 
  </code></pre>
  
  <p>How to solve this problem?</p>