[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <1452825753-36364-1-git-send-email-puck.chen@hisilicon.com>
Date: Fri, 15 Jan 2016 10:42:33 +0800
From: Chen Feng <puck.chen@...ilicon.com>
To: <gregkh@...uxfoundation.org>, <arve@...roid.com>,
<riandrews@...roid.com>, <paul.gortmaker@...driver.com>,
<labbott@...hat.com>, <gioh.kim@....com>, <tranmanphong@...il.com>,
<mitchelh@...eaurora.org>, <devel@...verdev.osuosl.org>,
<linux-kernel@...r.kernel.org>, <puck.chen@...ilicon.com>,
<yudongbin@...ilicon.com>, <saberlily.xia@...ilicon.com>,
<suzhuangluan@...ilicon.com>, <kong.kongxinwei@...ilicon.com>,
<xuyiping@...ilicon.com>, <z.liuxinliang@...ilicon.com>,
<weidong2@...ilicon.com>, <w.f@...wei.com>,
<puck.chen@...mail.com>, <shimingxing@...ilicon.com>,
<oliver.fu@...ilicon.com>, <albert.lubing@...ilicon.com>,
<chenxiang9@...wei.com>, <liuzixing@...wei.com>,
<haojian.zhuang@...aro.org>
CC: <qijiwen@...ilicon.com>, <peter.panshilin@...ilicon.com>,
<dan.zhao@...ilicon.com>, <linuxarm@...wei.com>,
<dev@...ts.96boards.org>
Subject: [PATCH] staging: ion: make the pte default none PTE_RDONLY
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@...ilicon.com>
Signed-off-by: Wei Dong <weidong2@...ilicon.com>
Reviewed-by: Zhuangluan Su <suzhuangluan@...ilicon.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
Powered by blists - more mailing lists