[systemd-devel] [PATCH 0/2] RFC for avoid dynamic allocation in journald

Holger Freyther holger at freyther.de
Mon Apr 8 07:02:40 PDT 2013


Holger Hans Peter Freyther <holger <at> freyther.de> writes:

> 
> The following two patches are compile tested only. The first one is
> to avoid work when systemd is compiled without audit support. The
> second is starting to remove dynamic allocations from the
> dispatch_message_real method.


I just went ahead and added #if 0/#endif around the variables I do not
need for my usecase. The CPU usage is noticable down, still more than
the busybox syslog implementation.



> _COMM
> _EXE
> _CMDLINE
> _SYSTEMD_CGROUP

server_dispatch_message():
  1.  shortened_cgroup_path(ucred->pid);
        Open /proc/PID/cgroup and then the cgroup..
        Open /proc/1/cgroup and then the cgroup
  2. Eventually call server_driver_message which will
       1. call dispatch_message_real().. which will..
            1. call shorted_cgroup_path(ucred->pid);
                 Open /proc/pid...
                 Open /proc/1
  3. call dispatch_message_real()
       1. shorted_cgroup_path(ucred->pid);
         Open /proc/PID/cgroup and then the cgroup..
         Open /proc/1/cgroup ...
  

Just adding the path to the dispatch_message_real signature is a bit
tricky as the server_driver_message is creating a ucred with the pid,
gid,uid of the journald process...


Is it really needed to determine the cgroup of /proc/1 on every message?
Couldn't journald keep the variables for its identity around?



More information about the systemd-devel mailing list