From: Ilya Dryomov Date: Mon, 14 Oct 2019 10:40:43 +0000 (+0200) Subject: krbd: increase udev netlink socket receive buffer to 2M X-Git-Tag: v13.2.7~7^2~4 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=717b2bd3538cb062e51f9ac8d28e9e9f4eeaf252;p=ceph.git krbd: increase udev netlink socket receive buffer to 2M Even though with the previous commit we no longer block between binding the socket and starting handling events, we still want a larger receive buffer to accommodate for scheduling delays. Since the filtering is done in the listener, an estimate focused on just rbd is not accurate, but anyway: a pair of "rbd" and "block" events for "rbd map" take 2048 bytes in the receive buffer. This allows for roughly a thousand of them ("rbd map" and "rbd unmap" require root and libudev makes use of SO_RCVBUFFORCE so rmem_max limit is ignored). Signed-off-by: Ilya Dryomov (cherry picked from commit 1c6cac1acaefdf59c3265d70c8d2191c59f14652) --- diff --git a/src/krbd.cc b/src/krbd.cc index edec61020c7..4fd4ced4416 100644 --- a/src/krbd.cc +++ b/src/krbd.cc @@ -44,6 +44,8 @@ #include #include +static const int UDEV_BUF_SIZE = 1 << 20; /* doubled to 2M (SO_RCVBUFFORCE) */ + struct krbd_ctx { CephContext *cct; struct udev *udev; @@ -345,6 +347,13 @@ static int do_map(struct udev *udev, const char *pool, const char *image, if (r < 0) goto out_mon; + r = udev_monitor_set_receive_buffer_size(mon, UDEV_BUF_SIZE); + if (r < 0) { + std::cerr << "rbd: failed to set udev buffer size: " << cpp_strerror(r) + << std::endl; + /* not fatal */ + } + r = udev_monitor_enable_receiving(mon); if (r < 0) goto out_mon; @@ -612,6 +621,13 @@ static int do_unmap(struct udev *udev, dev_t devno, const string& buf) if (r < 0) goto out_mon; + r = udev_monitor_set_receive_buffer_size(mon, UDEV_BUF_SIZE); + if (r < 0) { + std::cerr << "rbd: failed to set udev buffer size: " << cpp_strerror(r) + << std::endl; + /* not fatal */ + } + r = udev_monitor_enable_receiving(mon); if (r < 0) goto out_mon;