Re: [PATCH] activation: set children oom_score_adj to 0
WaLyong Cho <[email protected]>
| Newsgroups | gmane.comp.freedesktop.dbus |
|---|---|
| Organization | Samsung Electronics |
| Message-ID | <[email protected]> |
On 06/07/2016 09:10 PM, Simon McVittie wrote: > On 07/06/16 12:53, WaLyong Cho wrote: >> If dbus is running as systemd service, dbus daemon is running with >> oom_score_adj -900 by OOMScoreAdjust=-900. And children will also have >> same value with dbus daemon. >> To avoid this, set the child itself values after fork () to 0. > > This looks like it might be intended to be a solution to the same issue > as <https://bugs.freedesktop.org/show_bug.cgi?id=32851>. Please see > Lennart's review comments on that bug: in particular, this should > probably be #ifdef __linux__, and the file descriptor should be marked > close-on-exec. Please attach any revised patches to that bug. I will prepare next patch with #ifdef __linux__. > > Is there any particular reason to have used buffered stdio here, and not > open() + write()? Buffered I/O seems undesirable when writing to the > /proc pseudo-filesystem. I'm also thinking open() + write() more appropriate. I will change it. > > I would normally suggest using _dbus_string_save_to_file(), but that > uses the tempfile + atomic overwrite pattern, which won't work in /proc. > I did not know this api. But to use _dbus_string_save_to_file(), new DBusString value has to be declared. And it seems to be initialized with _dbus_string_init() and filled with _dbus_string_copy() or _dbus_string_append() and also destroied with _dbus_string_free(). I'm not sure using _dbus_string_save_to_file() is good idea to set /proc/self/oom_score_adj to 0. But if you still suggest using _dbus_string_save_to_file(), I will use _dbus_string_save_to_file(). Thanks WaLyong _______________________________________________ dbus mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dbus