From: Jan Dakinevich <[email protected]> The allocator ib_alloc_device() is used to allocate both ib_device and device specific instance. This allocations sometimes quite big and takes tens KiB, causing high page orders.
Meanwhile, the memory is not intended for DMA and doesn't require to be physically contiguous. https://jira.sw.ru/browse/HCI-129 Signed-off-by: Jan Dakinevich <[email protected]> Rebased to vz8: - Change newly added kfree to kvfree in _ib_alloc_device - Since there is no kvfree_rcu, introduce new ib_device_reclaim function and change kfree_rcu to call_rcu(...) (cherry-picked from 7629b2cc58ee8d2ec0bac4ab19fa7e7c887d4d41) Signed-off-by: Andrey Zhadchenko <[email protected]> --- drivers/infiniband/core/device.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/drivers/infiniband/core/device.c b/drivers/infiniband/core/device.c index b0f7579..d649c5c 100644 --- a/drivers/infiniband/core/device.c +++ b/drivers/infiniband/core/device.c @@ -485,6 +485,11 @@ static int alloc_name(struct ib_device *ibdev, const char *name) return rc; } +static void ib_device_reclaim(struct rcu_head *head) +{ + kvfree(container_of(head, struct ib_device, rcu_head)); +} + static void ib_device_release(struct device *device) { struct ib_device *dev = container_of(device, struct ib_device, dev); @@ -505,7 +510,7 @@ static void ib_device_release(struct device *device) xa_destroy(&dev->compat_devs); xa_destroy(&dev->client_data); - kfree_rcu(dev, rcu_head); + call_rcu(&dev->rcu_head, ib_device_reclaim); } static int ib_device_uevent(struct device *device, @@ -574,12 +579,12 @@ struct ib_device *_ib_alloc_device(size_t size) if (WARN_ON(size < sizeof(struct ib_device))) return NULL; - device = kzalloc(size, GFP_KERNEL); + device = kvzalloc(size, GFP_KERNEL); if (!device) return NULL; if (rdma_restrack_init(device)) { - kfree(device); + kvfree(device); return NULL; } -- 1.8.3.1 _______________________________________________ Devel mailing list [email protected] https://lists.openvz.org/mailman/listinfo/devel
