[systemd-devel] [PATCH] loopback setup in unprivileged containers

Martin Pitt martin.pitt at ubuntu.com
Sat Dec 27 10:27:57 PST 2014

Hello all,

I'm forwarding a patch for the loopback setup from Stéphane. I already
pushed one part of it as http://cgit.freedesktop.org/systemd/systemd/commit/?id=58a489c
which is trivial and obvious, but the other part isn't.



----- Forwarded message from Stéphane Graber <stgraber at ubuntu.com> -----

Date: Thu, 25 Dec 2014 22:17:52 +0100
From: Stéphane Graber <stgraber at ubuntu.com>
To: martin.pitt at ubuntu.com
Subject: systemd patch for unprivileged containers
X-Spam-Status: No, score=-1.9 required=3.4 tests=BAYES_00 autolearn=no version=3.3.2

Hey Martin,

Attached is a pretty simple patch/workaround to fix the massive CPU
usage of systemd in unprivileged containers.

LXC provides each containers with an already-UP loopback device. systemd
will attempt to bring it up regardless of its current state and doing so
gets it into a broken codepath somewhere deep in the netlink handling
code of systemd.

The fix is to always check whether the loopback is ready to use before
doing anything.

I then noticed that this code path in systemd was broken too due to it
checking against rather than so I added the missing
htonl and now it all works as expected and systemd fails on the next
problem about a minute faster than it used to :)

Stéphane Graber
Ubuntu developer

----- End forwarded message -----

Martin Pitt                        | http://www.piware.de
Ubuntu Developer (www.ubuntu.com)  | Debian Developer  (www.debian.org)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-core-Optimize-loopback-setup.patch
Type: text/x-diff
Size: 1189 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/systemd-devel/attachments/20141227/0e5055c9/attachment-0001.patch>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://lists.freedesktop.org/archives/systemd-devel/attachments/20141227/0e5055c9/attachment-0001.sig>

More information about the systemd-devel mailing list