Re: [PATCH 1/7] cris: Convert cryptocop to use get_user_pages_fast()

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

 



Thank you! I will do the same change in our out-of-tree modules! Jesper will do the ack.



> 6 okt 2015 kl. 11:43 skrev Jan Kara <jack@xxxxxxxx>:
> 
> From: Jan Kara <jack@xxxxxxx>
> 
> CC: linux-cris-kernel@xxxxxxxx
> CC: Mikael Starvik <starvik@xxxxxxxx>
> CC: Jesper Nilsson <jesper.nilsson@xxxxxxxx>
> Signed-off-by: Jan Kara <jack@xxxxxxx>
> ---
> arch/cris/arch-v32/drivers/cryptocop.c | 35 ++++++++++------------------------
> 1 file changed, 10 insertions(+), 25 deletions(-)
> 
> diff --git a/arch/cris/arch-v32/drivers/cryptocop.c b/arch/cris/arch-v32/drivers/cryptocop.c
> index 877da1908234..df7ceeff1086 100644
> --- a/arch/cris/arch-v32/drivers/cryptocop.c
> +++ b/arch/cris/arch-v32/drivers/cryptocop.c
> @@ -2716,43 +2716,28 @@ static int cryptocop_ioctl_process(struct inode *inode, struct file *filp, unsig
>        }
>    }
> 
> -    /* Acquire the mm page semaphore. */
> -    down_read(&current->mm->mmap_sem);
> -
> -    err = get_user_pages(current,
> -                 current->mm,
> -                 (unsigned long int)(oper.indata + prev_ix),
> -                 noinpages,
> -                 0,  /* read access only for in data */
> -                 0, /* no force */
> -                 inpages,
> -                 NULL);
> +    err = get_user_pages_fast((unsigned long)(oper.indata + prev_ix),
> +                  noinpages,
> +                  0,  /* read access only for in data */
> +                  inpages);
> 
>    if (err < 0) {
> -        up_read(&current->mm->mmap_sem);
>        nooutpages = noinpages = 0;
> -        DEBUG_API(printk("cryptocop_ioctl_process: get_user_pages indata\n"));
> +        DEBUG_API(printk("cryptocop_ioctl_process: get_user_pages_fast indata\n"));
>        goto error_cleanup;
>    }
>    noinpages = err;
>    if (oper.do_cipher){
> -        err = get_user_pages(current,
> -                     current->mm,
> -                     (unsigned long int)oper.cipher_outdata,
> -                     nooutpages,
> -                     1, /* write access for out data */
> -                     0, /* no force */
> -                     outpages,
> -                     NULL);
> -        up_read(&current->mm->mmap_sem);
> +        err = get_user_pages_fast((unsigned long)oper.cipher_outdata,
> +                      nooutpages,
> +                      1, /* write access for out data */
> +                      outpages);
>        if (err < 0) {
>            nooutpages = 0;
> -            DEBUG_API(printk("cryptocop_ioctl_process: get_user_pages outdata\n"));
> +            DEBUG_API(printk("cryptocop_ioctl_process: get_user_pages_fast outdata\n"));
>            goto error_cleanup;
>        }
>        nooutpages = err;
> -    } else {
> -        up_read(&current->mm->mmap_sem);
>    }
> 
>    /* Add 6 to nooutpages to make room for possibly inserted buffers for storing digest and
> -- 
> 2.1.4
> 

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@xxxxxxxxx.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href



[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]