Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1739652

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

From Xishi Qiu <qiuxishi@huawei.com>
Newsgroups linux.kernel
Subject [RFC] a question about mlockall() and mprotect()
Date 2017-09-26 10:00 +0200
Message-ID <utSWD-1N5-43@gated-at.bofh.it> (permalink)
Organization linux.* mail to news gateway

Show all headers | View raw


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 */
	(void) __mm_populate(addr, len, 1);
}

And later we call mprotect() to change the prot, then it is
still not alloc memory for the mlocked vma.

My question is that, shall we alloc memory if the prot changed,
and who(kernel, glibc, user) should alloc the memory?

Thanks,
Xishi Qiu

Back to linux.kernel | Previous | NextNext in thread | Find similar | Unroll thread


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