Re: [PATCH] RDMA/siw: Relax from kmap_atomic() use in TX path

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hey Bernard,  is the code below called directly from the driver’s post_send function?  If so it must use atomic...I think.

Stevo

> On Sep 6, 2019, at 6:18 AM, Bernard Metzler <bmt@xxxxxxxxxxxxxx> wrote:
> 
> Since the transmit path is never executed in an atomic
> context, we do not need kmap_atomic() and can always
> use less demanding kmap().
> 
> Signed-off-by: Bernard Metzler <bmt@xxxxxxxxxxxxxx>
> ---
> drivers/infiniband/sw/siw/siw_qp_tx.c | 12 +++++-------
> 1 file changed, 5 insertions(+), 7 deletions(-)
> 
> diff --git a/drivers/infiniband/sw/siw/siw_qp_tx.c b/drivers/infiniband/sw/siw/siw_qp_tx.c
> index 8e72f955921d..5d97bba0ce6d 100644
> --- a/drivers/infiniband/sw/siw/siw_qp_tx.c
> +++ b/drivers/infiniband/sw/siw/siw_qp_tx.c
> @@ -76,16 +76,15 @@ static int siw_try_1seg(struct siw_iwarp_tx *c_tx, void *paddr)
>            if (unlikely(!p))
>                return -EFAULT;
> 
> -            buffer = kmap_atomic(p);
> +            buffer = kmap(p);
> 
>            if (likely(PAGE_SIZE - off >= bytes)) {
>                memcpy(paddr, buffer + off, bytes);
> -                kunmap_atomic(buffer);
>            } else {
>                unsigned long part = bytes - (PAGE_SIZE - off);
> 
>                memcpy(paddr, buffer + off, part);
> -                kunmap_atomic(buffer);
> +                kunmap(p);
> 
>                if (!mem->is_pbl)
>                    p = siw_get_upage(mem->umem,
> @@ -97,11 +96,10 @@ static int siw_try_1seg(struct siw_iwarp_tx *c_tx, void *paddr)
>                if (unlikely(!p))
>                    return -EFAULT;
> 
> -                buffer = kmap_atomic(p);
> -                memcpy(paddr + part, buffer,
> -                       bytes - part);
> -                kunmap_atomic(buffer);
> +                buffer = kmap(p);
> +                memcpy(paddr + part, buffer, bytes - part);
>            }
> +            kunmap(p);
>        }
>    }
>    return (int)bytes;
> -- 
> 2.17.2
> 




[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Photo]     [Yosemite News]     [Yosemite Photos]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux