Re: [RFC] a question about mlockall() and mprotect()

2017-10-09 Thread Michal Hocko
On Tue 10-10-17 09:22:20, Xishi Qiu wrote: > On 2017/10/10 2:26, Michal Hocko wrote: > > > On Wed 27-09-17 13:51:09, Xishi Qiu wrote: > >> On 2017/9/26 19:00, Michal Hocko wrote: > >> > >>> On Tue 26-09-17 11:45:16, Vlastimil Babka wrote: > On 09/26/2017 11:22 AM, Xishi Qiu wrote: > > On

Re: [RFC] a question about mlockall() and mprotect()

2017-10-09 Thread Michal Hocko
On Tue 10-10-17 09:22:20, Xishi Qiu wrote: > On 2017/10/10 2:26, Michal Hocko wrote: > > > On Wed 27-09-17 13:51:09, Xishi Qiu wrote: > >> On 2017/9/26 19:00, Michal Hocko wrote: > >> > >>> On Tue 26-09-17 11:45:16, Vlastimil Babka wrote: > On 09/26/2017 11:22 AM, Xishi Qiu wrote: > > On

Re: [RFC] a question about mlockall() and mprotect()

2017-10-09 Thread Xishi Qiu
On 2017/10/10 2:26, Michal Hocko wrote: > On Wed 27-09-17 13:51:09, Xishi Qiu wrote: >> On 2017/9/26 19:00, Michal Hocko wrote: >> >>> 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

Re: [RFC] a question about mlockall() and mprotect()

2017-10-09 Thread Xishi Qiu
On 2017/10/10 2:26, Michal Hocko wrote: > On Wed 27-09-17 13:51:09, Xishi Qiu wrote: >> On 2017/9/26 19:00, Michal Hocko wrote: >> >>> 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

Re: [RFC] a question about mlockall() and mprotect()

2017-10-09 Thread Michal Hocko
On Wed 27-09-17 13:51:09, Xishi Qiu wrote: > On 2017/9/26 19:00, Michal Hocko wrote: > > > 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

Re: [RFC] a question about mlockall() and mprotect()

2017-10-09 Thread Michal Hocko
On Wed 27-09-17 13:51:09, Xishi Qiu wrote: > On 2017/9/26 19:00, Michal Hocko wrote: > > > 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

Re: [RFC] a question about mlockall() and mprotect()

2017-09-26 Thread Xishi Qiu
On 2017/9/26 19:00, Michal Hocko wrote: > 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

Re: [RFC] a question about mlockall() and mprotect()

2017-09-26 Thread Xishi Qiu
On 2017/9/26 19:00, Michal Hocko wrote: > 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

Re: [RFC] a question about mlockall() and mprotect()

2017-09-26 Thread Michal Hocko
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

Re: [RFC] a question about mlockall() and mprotect()

2017-09-26 Thread Michal Hocko
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

Re: [RFC] a question about mlockall() and mprotect()

2017-09-26 Thread Vlastimil Babka
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.

Re: [RFC] a question about mlockall() and mprotect()

2017-09-26 Thread Vlastimil Babka
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.

Re: [RFC] a question about mlockall() and mprotect()

2017-09-26 Thread Xishi Qiu
On 2017/9/26 17:13, Xishi Qiu wrote: > On 2017/9/26 17:02, Michal Hocko wrote: > >> On Tue 26-09-17 16:39:56, Xishi Qiu wrote: >>> On 2017/9/26 16:17, Michal Hocko wrote: >>> On Tue 26-09-17 15:56:55, Xishi Qiu wrote: > When we call mlockall(), we will add VM_LOCKED to the vma, > if

Re: [RFC] a question about mlockall() and mprotect()

2017-09-26 Thread Xishi Qiu
On 2017/9/26 17:13, Xishi Qiu wrote: > On 2017/9/26 17:02, Michal Hocko wrote: > >> On Tue 26-09-17 16:39:56, Xishi Qiu wrote: >>> On 2017/9/26 16:17, Michal Hocko wrote: >>> On Tue 26-09-17 15:56:55, Xishi Qiu wrote: > When we call mlockall(), we will add VM_LOCKED to the vma, > if

Re: [RFC] a question about mlockall() and mprotect()

2017-09-26 Thread Michal Hocko
On Tue 26-09-17 17:13:59, Xishi Qiu wrote: > On 2017/9/26 17:02, Michal Hocko wrote: [...] > > This is still very fuzzy. What are you actually trying to achieve? > > I don't expect page fault any more after mlock. This should be the case normally. Except when mm_populate fails which can happen

Re: [RFC] a question about mlockall() and mprotect()

2017-09-26 Thread Michal Hocko
On Tue 26-09-17 17:13:59, Xishi Qiu wrote: > On 2017/9/26 17:02, Michal Hocko wrote: [...] > > This is still very fuzzy. What are you actually trying to achieve? > > I don't expect page fault any more after mlock. This should be the case normally. Except when mm_populate fails which can happen

Re: [RFC] a question about mlockall() and mprotect()

2017-09-26 Thread Xishi Qiu
On 2017/9/26 17:02, Michal Hocko wrote: > On Tue 26-09-17 16:39:56, Xishi Qiu wrote: >> On 2017/9/26 16:17, Michal Hocko wrote: >> >>> On Tue 26-09-17 15:56:55, Xishi Qiu wrote: When we call mlockall(), we will add VM_LOCKED to the vma, if the vma prot is ---p, >>> >>> not sure what you

Re: [RFC] a question about mlockall() and mprotect()

2017-09-26 Thread Xishi Qiu
On 2017/9/26 17:02, Michal Hocko wrote: > On Tue 26-09-17 16:39:56, Xishi Qiu wrote: >> On 2017/9/26 16:17, Michal Hocko wrote: >> >>> On Tue 26-09-17 15:56:55, Xishi Qiu wrote: When we call mlockall(), we will add VM_LOCKED to the vma, if the vma prot is ---p, >>> >>> not sure what you

Re: [RFC] a question about mlockall() and mprotect()

2017-09-26 Thread Michal Hocko
On Tue 26-09-17 16:39:56, Xishi Qiu wrote: > On 2017/9/26 16:17, Michal Hocko wrote: > > > On Tue 26-09-17 15:56:55, Xishi Qiu wrote: > >> When we call mlockall(), we will add VM_LOCKED to the vma, > >> if the vma prot is ---p, > > > > not sure what you mean here. apply_mlockall_flags will set

Re: [RFC] a question about mlockall() and mprotect()

2017-09-26 Thread Michal Hocko
On Tue 26-09-17 16:39:56, Xishi Qiu wrote: > On 2017/9/26 16:17, Michal Hocko wrote: > > > On Tue 26-09-17 15:56:55, Xishi Qiu wrote: > >> When we call mlockall(), we will add VM_LOCKED to the vma, > >> if the vma prot is ---p, > > > > not sure what you mean here. apply_mlockall_flags will set

Re: [RFC] a question about mlockall() and mprotect()

2017-09-26 Thread Xishi Qiu
On 2017/9/26 16:17, Michal Hocko wrote: > On Tue 26-09-17 15:56:55, Xishi Qiu wrote: >> When we call mlockall(), we will add VM_LOCKED to the vma, >> if the vma prot is ---p, > > not sure what you mean here. apply_mlockall_flags will set the flag on > all vmas except for special mappings

Re: [RFC] a question about mlockall() and mprotect()

2017-09-26 Thread Xishi Qiu
On 2017/9/26 16:17, Michal Hocko wrote: > On Tue 26-09-17 15:56:55, Xishi Qiu wrote: >> When we call mlockall(), we will add VM_LOCKED to the vma, >> if the vma prot is ---p, > > not sure what you mean here. apply_mlockall_flags will set the flag on > all vmas except for special mappings

Re: [RFC] a question about mlockall() and mprotect()

2017-09-26 Thread Michal Hocko
On Tue 26-09-17 15:56:55, Xishi Qiu wrote: > When we call mlockall(), we will add VM_LOCKED to the vma, > if the vma prot is ---p, not sure what you mean here. apply_mlockall_flags will set the flag on all vmas except for special mappings (mlock_fixup). This phase will cause that memory reclaim

Re: [RFC] a question about mlockall() and mprotect()

2017-09-26 Thread Michal Hocko
On Tue 26-09-17 15:56:55, Xishi Qiu wrote: > When we call mlockall(), we will add VM_LOCKED to the vma, > if the vma prot is ---p, not sure what you mean here. apply_mlockall_flags will set the flag on all vmas except for special mappings (mlock_fixup). This phase will cause that memory reclaim

[RFC] a question about mlockall() and mprotect()

2017-09-26 Thread Xishi Qiu
When we call mlockall(), we will add VM_LOCKED to the vma, if the vma prot is ---p, then mm_populate -> get_user_pages will not alloc memory. I find it said "ignore errors" in mm_populate() static inline void mm_populate(unsigned long addr, unsigned long len) { /* Ignore errors */

[RFC] a question about mlockall() and mprotect()

2017-09-26 Thread Xishi Qiu
When we call mlockall(), we will add VM_LOCKED to the vma, if the vma prot is ---p, then mm_populate -> get_user_pages will not alloc memory. I find it said "ignore errors" in mm_populate() static inline void mm_populate(unsigned long addr, unsigned long len) { /* Ignore errors */