RDMA/rxe: Remove RXE_POOL_ATOMIC
authorBob Pearson <rpearsonhpe@gmail.com>
Mon, 25 Jan 2021 21:16:38 +0000 (15:16 -0600)
committerJason Gunthorpe <jgg@nvidia.com>
Thu, 28 Jan 2021 19:29:56 +0000 (15:29 -0400)
rxe_alloc() used the RXE_POOL_ATOMIC flag in rxe_type_info to select
GFP_ATOMIC in calls to kzalloc(). This was intended to handle cases where
an object could be created in interrupt context. This no longer occurs
since allocating those objects has moved into the core so this flag is not
necessary. An incorrect use of this flag was still present for rxe_mc_elem
objects and is removed.

Link: https://lore.kernel.org/r/20210125211641.2694-4-rpearson@hpe.com
Signed-off-by: Bob Pearson <rpearson@hpe.com>
Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
drivers/infiniband/sw/rxe/rxe_pool.c
drivers/infiniband/sw/rxe/rxe_pool.h

index 5ca54e09cd0e2ceea959dd9c0cc5092786e7f2d5..0ca46bd8be515a3a88bd595996a2e8a3dc26372d 100644 (file)
@@ -84,7 +84,6 @@ struct rxe_type_info rxe_type_info[RXE_NUM_TYPES] = {
                .name           = "rxe-mc_elem",
                .size           = sizeof(struct rxe_mc_elem),
                .elem_offset    = offsetof(struct rxe_mc_elem, pelem),
-               .flags          = RXE_POOL_ATOMIC,
        },
 };
 
@@ -380,8 +379,6 @@ void *rxe_alloc(struct rxe_pool *pool)
        struct rxe_pool_entry *elem;
        u8 *obj;
 
-       might_sleep_if(!(pool->flags & RXE_POOL_ATOMIC));
-
        read_lock_irqsave(&pool->pool_lock, flags);
        if (pool->state != RXE_POOL_STATE_VALID) {
                read_unlock_irqrestore(&pool->pool_lock, flags);
@@ -397,8 +394,7 @@ void *rxe_alloc(struct rxe_pool *pool)
        if (atomic_inc_return(&pool->num_elem) > pool->max_elem)
                goto out_cnt;
 
-       obj = kzalloc(info->size, (pool->flags & RXE_POOL_ATOMIC) ?
-                     GFP_ATOMIC : GFP_KERNEL);
+       obj = kzalloc(info->size, GFP_KERNEL);
        if (!obj)
                goto out_cnt;
 
index a75ac2d2847a1c9d2ebb4cd829daa051bdc97c20..22714dafe00d07c11603942364c9fddf55af63a4 100644 (file)
@@ -11,7 +11,6 @@
 #define RXE_POOL_CACHE_FLAGS   (0)
 
 enum rxe_pool_flags {
-       RXE_POOL_ATOMIC         = BIT(0),
        RXE_POOL_INDEX          = BIT(1),
        RXE_POOL_KEY            = BIT(2),
        RXE_POOL_NO_ALLOC       = BIT(4),