Commit a0e136e5 authored by Linus Torvalds's avatar Linus Torvalds
Browse files

Merge branch 'work.get_user_pages_fast' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs

Pull get_user_pages_fast() conversion from Al Viro:
 "A bunch of places switched to get_user_pages_fast()"

* 'work.get_user_pages_fast' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs:
  ceph: use get_user_pages_fast()
  pvr2fs: use get_user_pages_fast()
  atomisp: use get_user_pages_fast()
  st: use get_user_pages_fast()
  via_dmablit(): use get_user_pages_fast()
  fsl_hypervisor: switch to get_user_pages_fast()
  rapidio: switch to get_user_pages_fast()
  vchiq_2835_arm: switch to get_user_pages_fast()
parents 16382e17 77478715
Loading
Loading
Loading
Loading
+3 −3
Original line number Original line Diff line number Diff line
@@ -238,9 +238,9 @@ via_lock_all_dma_pages(drm_via_sg_info_t *vsg, drm_via_dmablit_t *xfer)
	vsg->pages = vzalloc(sizeof(struct page *) * vsg->num_pages);
	vsg->pages = vzalloc(sizeof(struct page *) * vsg->num_pages);
	if (NULL == vsg->pages)
	if (NULL == vsg->pages)
		return -ENOMEM;
		return -ENOMEM;
	ret = get_user_pages_unlocked((unsigned long)xfer->mem_addr,
	ret = get_user_pages_fast((unsigned long)xfer->mem_addr,
			vsg->num_pages, vsg->pages,
			vsg->num_pages, vsg->direction == DMA_FROM_DEVICE,
			(vsg->direction == DMA_FROM_DEVICE) ? FOLL_WRITE : 0);
			vsg->pages);
	if (ret != vsg->num_pages) {
	if (ret != vsg->num_pages) {
		if (ret < 0)
		if (ret < 0)
			return ret;
			return ret;
+2 −4
Original line number Original line Diff line number Diff line
@@ -889,11 +889,9 @@ rio_dma_transfer(struct file *filp, u32 transfer_mode,
			goto err_req;
			goto err_req;
		}
		}


		pinned = get_user_pages_unlocked(
		pinned = get_user_pages_fast(
				(unsigned long)xfer->loc_addr & PAGE_MASK,
				(unsigned long)xfer->loc_addr & PAGE_MASK,
				nr_pages,
				nr_pages, dir == DMA_FROM_DEVICE, page_list);
				page_list,
				dir == DMA_FROM_DEVICE ? FOLL_WRITE : 0);


		if (pinned != nr_pages) {
		if (pinned != nr_pages) {
			if (pinned < 0) {
			if (pinned < 0) {
+1 −5
Original line number Original line Diff line number Diff line
@@ -4920,11 +4920,7 @@ static int sgl_map_user_pages(struct st_buffer *STbp,


        /* Try to fault in all of the necessary pages */
        /* Try to fault in all of the necessary pages */
        /* rw==READ means read from drive, write into memory area */
        /* rw==READ means read from drive, write into memory area */
	res = get_user_pages_unlocked(
	res = get_user_pages_fast(uaddr, nr_pages, rw == READ, pages);
		uaddr,
		nr_pages,
		pages,
		rw == READ ? FOLL_WRITE : 0); /* don't force */


	/* Errors and no page mapped should return here */
	/* Errors and no page mapped should return here */
	if (res < nr_pages)
	if (res < nr_pages)
+2 −4
Original line number Original line Diff line number Diff line
@@ -1020,10 +1020,8 @@ static int alloc_user_pages(struct hmm_buffer_object *bo,
	} else {
	} else {
		/*Handle frame buffer allocated in user space*/
		/*Handle frame buffer allocated in user space*/
		mutex_unlock(&bo->mutex);
		mutex_unlock(&bo->mutex);
		down_read(&current->mm->mmap_sem);
		page_nr = get_user_pages_fast((unsigned long)userptr,
		page_nr = get_user_pages((unsigned long)userptr,
					 (int)(bo->pgnr), 1, pages);
					 (int)(bo->pgnr), 1, pages, NULL);
		up_read(&current->mm->mmap_sem);
		mutex_lock(&bo->mutex);
		mutex_lock(&bo->mutex);
		bo->mem_type = HMM_BO_MEM_TYPE_USER;
		bo->mem_type = HMM_BO_MEM_TYPE_USER;
	}
	}
+7 −13
Original line number Original line Diff line number Diff line
@@ -90,8 +90,7 @@ static irqreturn_t
vchiq_doorbell_irq(int irq, void *dev_id);
vchiq_doorbell_irq(int irq, void *dev_id);


static struct vchiq_pagelist_info *
static struct vchiq_pagelist_info *
create_pagelist(char __user *buf, size_t count, unsigned short type,
create_pagelist(char __user *buf, size_t count, unsigned short type);
		struct task_struct *task);


static void
static void
free_pagelist(struct vchiq_pagelist_info *pagelistinfo,
free_pagelist(struct vchiq_pagelist_info *pagelistinfo,
@@ -255,8 +254,7 @@ vchiq_prepare_bulk_data(VCHIQ_BULK_T *bulk, VCHI_MEM_HANDLE_T memhandle,
	pagelistinfo = create_pagelist((char __user *)offset, size,
	pagelistinfo = create_pagelist((char __user *)offset, size,
				       (dir == VCHIQ_BULK_RECEIVE)
				       (dir == VCHIQ_BULK_RECEIVE)
				       ? PAGELIST_READ
				       ? PAGELIST_READ
				       : PAGELIST_WRITE,
				       : PAGELIST_WRITE);
				       current);


	if (!pagelistinfo)
	if (!pagelistinfo)
		return VCHIQ_ERROR;
		return VCHIQ_ERROR;
@@ -395,8 +393,7 @@ cleanup_pagelistinfo(struct vchiq_pagelist_info *pagelistinfo)
 */
 */


static struct vchiq_pagelist_info *
static struct vchiq_pagelist_info *
create_pagelist(char __user *buf, size_t count, unsigned short type,
create_pagelist(char __user *buf, size_t count, unsigned short type)
		struct task_struct *task)
{
{
	PAGELIST_T *pagelist;
	PAGELIST_T *pagelist;
	struct vchiq_pagelist_info *pagelistinfo;
	struct vchiq_pagelist_info *pagelistinfo;
@@ -476,14 +473,11 @@ create_pagelist(char __user *buf, size_t count, unsigned short type,
		}
		}
		/* do not try and release vmalloc pages */
		/* do not try and release vmalloc pages */
	} else {
	} else {
		down_read(&task->mm->mmap_sem);
		actual_pages = get_user_pages_fast(
		actual_pages = get_user_pages(
				          (unsigned long)buf & PAGE_MASK,
				          (unsigned long)buf & PAGE_MASK,
					  num_pages,
					  num_pages,
					  (type == PAGELIST_READ) ? FOLL_WRITE : 0,
					  type == PAGELIST_READ,
					  pages,
					  pages);
					  NULL /*vmas */);
		up_read(&task->mm->mmap_sem);


		if (actual_pages != num_pages) {
		if (actual_pages != num_pages) {
			vchiq_log_info(vchiq_arm_log_level,
			vchiq_log_info(vchiq_arm_log_level,
Loading