From 636ed5fc72b06afbfbb13cad247b7e407b78d1d4 Mon Sep 17 00:00:00 2001 From: Daniel Mentz Date: Wed, 7 Mar 2018 20:54:47 -0800 Subject: [PATCH] ueventd: Increase uevent buffer size to 2MB Let's increase the receive buffer size for the NETLINK_KOBJECT_UEVENT socket to 2MB. Unless a large number of uevents queue up, that memory is not allocated anyways. The receive buffer size serves only as an upper limit for the total amount of memory consumed by all skbs queued to a specific socket. We experienced situations where ueventd got blocked for multiple seconds while writing to /dev/kmsg, and the receive buffer overflowed in the meantime. Test: compile Bug: 72648767 Change-Id: Ice6d7b9c5ed9c83efbad6111086ce95ac6432561 --- init/uevent_listener.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/init/uevent_listener.cpp b/init/uevent_listener.cpp index ac1d7c7ed..24b14c44d 100644 --- a/init/uevent_listener.cpp +++ b/init/uevent_listener.cpp @@ -83,8 +83,8 @@ static void ParseEvent(const char* msg, Uevent* uevent) { } UeventListener::UeventListener() { - // is 256K enough? udev uses 16MB! - device_fd_.reset(uevent_open_socket(256 * 1024, true)); + // is 2MB enough? udev uses 128MB! + device_fd_.reset(uevent_open_socket(2 * 1024 * 1024, true)); if (device_fd_ == -1) { LOG(FATAL) << "Could not open uevent socket"; }