Commit 399d7921 authored by Roland Dreier's avatar Roland Dreier

IB/mthca: Get rid of might_sleep() annotations

The might_sleep() annotations in mthca are silly -- they all occur
shortly before calls that will end up in core functions like kmalloc()
that will print the same warning in an unsafe context anyway.  In
fact, beyond cluttering the source, we're actually bloating text with
CONFIG_DEBUG_SPINLOCK_SLEEP and/or CONFIG_PREEMPT_VOLUNTARY set.

With both options set, getting rid of the might_sleep()s saves a lot:
add/remove: 0/0 grow/shrink: 0/7 up/down: 0/-171 (-171)
function                                     old     new   delta
mthca_pd_alloc                               132     109     -23
mthca_init_cq                                969     946     -23
mthca_mr_alloc                               592     568     -24
mthca_pd_free                                 67      42     -25
mthca_free_mr                                219     194     -25
mthca_free_cq                                570     545     -25
mthca_fmr_alloc                              742     716     -26
Signed-off-by: default avatarRoland Dreier <rolandd@cisco.com>
parent d9b98b0f
...@@ -696,8 +696,6 @@ int mthca_init_cq(struct mthca_dev *dev, int nent, ...@@ -696,8 +696,6 @@ int mthca_init_cq(struct mthca_dev *dev, int nent,
u8 status; u8 status;
int i; int i;
might_sleep();
cq->ibcq.cqe = nent - 1; cq->ibcq.cqe = nent - 1;
cq->is_kernel = !ctx; cq->is_kernel = !ctx;
...@@ -827,8 +825,6 @@ void mthca_free_cq(struct mthca_dev *dev, ...@@ -827,8 +825,6 @@ void mthca_free_cq(struct mthca_dev *dev,
int err; int err;
u8 status; u8 status;
might_sleep();
mailbox = mthca_alloc_mailbox(dev, GFP_KERNEL); mailbox = mthca_alloc_mailbox(dev, GFP_KERNEL);
if (IS_ERR(mailbox)) { if (IS_ERR(mailbox)) {
mthca_warn(dev, "No memory for mailbox to free CQ.\n"); mthca_warn(dev, "No memory for mailbox to free CQ.\n");
......
...@@ -340,8 +340,6 @@ int mthca_mr_alloc(struct mthca_dev *dev, u32 pd, int buffer_size_shift, ...@@ -340,8 +340,6 @@ int mthca_mr_alloc(struct mthca_dev *dev, u32 pd, int buffer_size_shift,
int err; int err;
u8 status; u8 status;
might_sleep();
WARN_ON(buffer_size_shift >= 32); WARN_ON(buffer_size_shift >= 32);
key = mthca_alloc(&dev->mr_table.mpt_alloc); key = mthca_alloc(&dev->mr_table.mpt_alloc);
...@@ -467,8 +465,6 @@ void mthca_free_mr(struct mthca_dev *dev, struct mthca_mr *mr) ...@@ -467,8 +465,6 @@ void mthca_free_mr(struct mthca_dev *dev, struct mthca_mr *mr)
int err; int err;
u8 status; u8 status;
might_sleep();
err = mthca_HW2SW_MPT(dev, NULL, err = mthca_HW2SW_MPT(dev, NULL,
key_to_hw_index(dev, mr->ibmr.lkey) & key_to_hw_index(dev, mr->ibmr.lkey) &
(dev->limits.num_mpts - 1), (dev->limits.num_mpts - 1),
...@@ -495,8 +491,6 @@ int mthca_fmr_alloc(struct mthca_dev *dev, u32 pd, ...@@ -495,8 +491,6 @@ int mthca_fmr_alloc(struct mthca_dev *dev, u32 pd,
int err = -ENOMEM; int err = -ENOMEM;
int i; int i;
might_sleep();
if (mr->attr.page_size < 12 || mr->attr.page_size >= 32) if (mr->attr.page_size < 12 || mr->attr.page_size >= 32)
return -EINVAL; return -EINVAL;
......
...@@ -43,8 +43,6 @@ int mthca_pd_alloc(struct mthca_dev *dev, int privileged, struct mthca_pd *pd) ...@@ -43,8 +43,6 @@ int mthca_pd_alloc(struct mthca_dev *dev, int privileged, struct mthca_pd *pd)
{ {
int err = 0; int err = 0;
might_sleep();
pd->privileged = privileged; pd->privileged = privileged;
atomic_set(&pd->sqp_count, 0); atomic_set(&pd->sqp_count, 0);
...@@ -66,7 +64,6 @@ int mthca_pd_alloc(struct mthca_dev *dev, int privileged, struct mthca_pd *pd) ...@@ -66,7 +64,6 @@ int mthca_pd_alloc(struct mthca_dev *dev, int privileged, struct mthca_pd *pd)
void mthca_pd_free(struct mthca_dev *dev, struct mthca_pd *pd) void mthca_pd_free(struct mthca_dev *dev, struct mthca_pd *pd)
{ {
might_sleep();
if (pd->privileged) if (pd->privileged)
mthca_free_mr(dev, &pd->ntmr); mthca_free_mr(dev, &pd->ntmr);
mthca_free(&dev->pd_table.alloc, pd->pd_num); mthca_free(&dev->pd_table.alloc, pd->pd_num);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment