[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Weekly report (12th week) - Debian GNU/Hurd Debianish initialization



.. link: 
.. description: 
.. tags: gsoc, debian, hurd
.. date: 2013/09/06 12:51:05
.. title: cgroupfs keeps track of processes
.. slug: cgroupfs-keeps-track-of-processes

Tl;dr!!elfel1 Screenshot (slightly edited and annotated shell trace)::

  + settrans -ca /cgroup /hurd/cgroupfs
  + mkdir /cgroup/init /cgroup/rootfs
  + echo $$ >> /cgroup/init/tasks  # $$ is 6
  + echo 3 >> /cgroup/rootfs/tasks # pid 3 is the root filesystem
  + sleep 1m & echo sleep has pid $!
  sleep has pid 16
  + cat /proc/cmdline > /dev/null
  + tail /cgroup/init/tasks /cgroup/rootfs/tasks
  ==> /cgroup/init/tasks <==
  6
  16
  20
  
  ==> /cgroup/rootfs/tasks <==
  3
  19
  17
  + pstree -p
  init(1)-+-auth(5)
          |-cgroupfs(14)
          |-ext2fs(3)-+-exec(4)
          |           |-null(17)
          |           |-pflocal(8)
          |           |-procfs(19)
          |           `-term(7)
          |-mach-defpager(10)
          |-root=device:hd0s1(2)
          `-sh(6)-+-pstree(21)
                  `-sleep(16)

Isn't she a beauty?

So we bind the `cgroupfs` translator to `/cgroup`, create two cgroups,
`init` and `rootfs`, move the currently executing shell script (that
later execs sysvinit) into the former and the root filesystem
translator into the latter cgroup. We then spawn a `sleep` process and
cat the content of `/proc/cmdline` into `/dev/null` which will make
the root filesystem start the `/hurd/procfs` and the `/hurd/null`
translator. We then inspect `/cgroup/{init,rootfs}/tasks` and find
indeed all the newly spawned processes in the cgroup their parent
process was in.

This is accomplished by:

* The cgroupfs translator:
  http://darnassus.sceen.net/gitweb/teythoon/cgroupfs.git/

* A way to request notifications about process changes from the
  `/hurd/proc` server:
  http://lists.gnu.org/archive/html/bug-hurd/2013-09/msg00029.html

I also filed a bug report containing my patches for the `sysvinit`
package (`#721917
<http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=721917>`_). This is
the second bug report I filed during my gsoc, the first one was for
the `ifupdown` package (`#720531
<http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=720531>`_) which
Andrew Shadura improved and merged on the very next day, thanks
Andrew!

Next week I'll continue to improve the `cgroupfs` translator, work on
the notification prototype (hopefully fixing non-root subhurds in the
process, this requires a similar notification mechanism for newly
created tasks and making `/hurd/proc` just a little subhurd aware) and
trying to get my `gnumach patch
<http://lists.gnu.org/archive/html/bug-hurd/2013-09/msg00023.html>`_
into a working shape (currently the parental relation of processes is
a Hurd-only concept and relies upon processes telling the `/hurd/proc`
server that a newly created process is their child. This is
automatically done if the process uses `fork(2)` of course, but not if
it uses `task_create
<http://www.gnu.org/software/hurd/gnumach-doc/Task-Creation.html>`_ to
start a new Mach task).


Reply to: