Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1739780
| From | Michal Hocko <mhocko@kernel.org> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | Re: [RFC] a question about mlockall() and mprotect() |
| Date | 2017-09-26 13:10 +0200 |
| Message-ID | <utVUu-3YA-13@gated-at.bofh.it> (permalink) |
| References | (2 earlier) <utTJ0-2nL-27@gated-at.bofh.it> <utU2m-2KN-31@gated-at.bofh.it> <utUc3-2OD-31@gated-at.bofh.it> <utUlI-2Sr-17@gated-at.bofh.it> <utUF4-2ZV-11@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
On Tue 26-09-17 11:45:16, Vlastimil Babka wrote:
> On 09/26/2017 11:22 AM, Xishi Qiu wrote:
> > On 2017/9/26 17:13, Xishi Qiu wrote:
> >>> This is still very fuzzy. What are you actually trying to achieve?
> >>
> >> I don't expect page fault any more after mlock.
> >>
> >
> > Our apps is some thing like RT, and page-fault maybe cause a lot of time,
> > e.g. lock, mem reclaim ..., so I use mlock and don't want page fault
> > any more.
>
> Why does your app then have restricted mprotect when calling mlockall()
> and only later adjusts the mprotect?
Ahh, OK I see what is goging on. So you have PROT_NONE vma at the time
mlockall and then later mprotect it something else and want to fault all
that memory at the mprotect time?
So basically to do
---
diff --git a/mm/mprotect.c b/mm/mprotect.c
index 6d3e2f082290..b665b5d1c544 100644
--- a/mm/mprotect.c
+++ b/mm/mprotect.c
@@ -369,7 +369,7 @@ mprotect_fixup(struct vm_area_struct *vma, struct vm_area_struct **pprev,
* Private VM_LOCKED VMA becoming writable: trigger COW to avoid major
* fault on access.
*/
- if ((oldflags & (VM_WRITE | VM_SHARED | VM_LOCKED)) == VM_LOCKED &&
+ if ((oldflags & (VM_WRITE | VM_LOCKED)) == VM_LOCKED &&
(newflags & VM_WRITE)) {
populate_vma_page_range(vma, start, end, NULL);
}
--
Michal Hocko
SUSE Labs
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[RFC] a question about mlockall() and mprotect() Xishi Qiu <qiuxishi@huawei.com> - 2017-09-26 10:00 +0200
Re: [RFC] a question about mlockall() and mprotect() Michal Hocko <mhocko@kernel.org> - 2017-09-26 10:20 +0200
Re: [RFC] a question about mlockall() and mprotect() Xishi Qiu <qiuxishi@huawei.com> - 2017-09-26 10:50 +0200
Re: [RFC] a question about mlockall() and mprotect() Michal Hocko <mhocko@kernel.org> - 2017-09-26 11:10 +0200
Re: [RFC] a question about mlockall() and mprotect() Xishi Qiu <qiuxishi@huawei.com> - 2017-09-26 11:20 +0200
Re: [RFC] a question about mlockall() and mprotect() Michal Hocko <mhocko@kernel.org> - 2017-09-26 11:30 +0200
Re: [RFC] a question about mlockall() and mprotect() Xishi Qiu <qiuxishi@huawei.com> - 2017-09-26 11:30 +0200
Re: [RFC] a question about mlockall() and mprotect() Vlastimil Babka <vbabka@suse.cz> - 2017-09-26 11:50 +0200
Re: [RFC] a question about mlockall() and mprotect() Michal Hocko <mhocko@kernel.org> - 2017-09-26 13:10 +0200
Re: [RFC] a question about mlockall() and mprotect() Xishi Qiu <qiuxishi@huawei.com> - 2017-09-27 08:00 +0200
csiph-web