All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] staging: ion: make the pte default none PTE_RDONLY
@ 2016-01-15  2:42 Chen Feng
  2016-01-15  2:58 ` kbuild test robot
                   ` (2 more replies)
  0 siblings, 3 replies; 9+ messages in thread
From: Chen Feng @ 2016-01-15  2:42 UTC (permalink / raw)
  To: gregkh, arve, riandrews, paul.gortmaker, labbott, gioh.kim,
	tranmanphong, mitchelh, devel, linux-kernel, puck.chen, yudongbin,
	saberlily.xia, suzhuangluan, kong.kongxinwei, xuyiping,
	z.liuxinliang, weidong2, w.f, puck.chen, shimingxing, oliver.fu,
	albert.lubing, chenxiang9, liuzixing, haojian.zhuang
  Cc: qijiwen, peter.panshilin, dan.zhao, linuxarm, dev

The page is already alloc at ion_alloc function,
ion_mmap map the alloced pages to user-space.

The default prot can be PTE_RDONLY. Take a look at
here:
set_pte_at()
arch/arm64/include/asm:
		if (pte_dirty(pte) && pte_write(pte))
			pte_val(pte) &= ~PTE_RDONLY;
		else
			pte_val(pte) |= PTE_RDONLY;

So with the dirty bit,it can improve the efficiency
and donnot need to handle memory fault when use access.

Signed-off-by: Chen Feng <puck.chen@hisilicon.com>
Signed-off-by: Wei Dong <weidong2@hisilicon.com>
Reviewed-by: Zhuangluan Su <suzhuangluan@hisilicon.com>
---
 drivers/staging/android/ion/ion.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/staging/android/ion/ion.c b/drivers/staging/android/ion/ion.c
index e237e9f..dba5942 100644
--- a/drivers/staging/android/ion/ion.c
+++ b/drivers/staging/android/ion/ion.c
@@ -1026,6 +1026,9 @@ static int ion_mmap(struct dma_buf *dmabuf, struct vm_area_struct *vma)
 	if (!(buffer->flags & ION_FLAG_CACHED))
 		vma->vm_page_prot = pgprot_writecombine(vma->vm_page_prot);
 
+	/*Default writeable*/
+	vma->vm_page_prot = pte_mkdirty(vma->vm_page_prot);
+
 	mutex_lock(&buffer->lock);
 	/* now map it to userspace */
 	ret = buffer->heap->ops->map_user(buffer->heap, buffer, vma);
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2016-01-18  3:45 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-01-15  2:42 [PATCH] staging: ion: make the pte default none PTE_RDONLY Chen Feng
2016-01-15  2:58 ` kbuild test robot
2016-01-15  3:10 ` kbuild test robot
2016-01-15 23:03 ` Laura Abbott
2016-01-15 23:03   ` Laura Abbott
2016-01-15 23:23   ` Russell King - ARM Linux
2016-01-15 23:23     ` Russell King - ARM Linux
2016-01-18  3:44     ` chenfeng
2016-01-18  3:44       ` chenfeng

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.