From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S967830AbdIZH5N (ORCPT ); Tue, 26 Sep 2017 03:57:13 -0400 Received: from szxga04-in.huawei.com ([45.249.212.190]:7000 "EHLO szxga04-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S965054AbdIZH5J (ORCPT ); Tue, 26 Sep 2017 03:57:09 -0400 Message-ID: <59CA0847.8000508@huawei.com> Date: Tue, 26 Sep 2017 15:56:55 +0800 From: Xishi Qiu User-Agent: Mozilla/5.0 (Windows NT 6.1; rv:12.0) Gecko/20120428 Thunderbird/12.0.1 MIME-Version: 1.0 To: Michal Hocko , Joonsoo Kim , Vlastimil Babka , Mel Gorman CC: Linux MM , LKML , "zhong jiang" , yeyunfeng , , "Zhoukang (A)" Subject: [RFC] a question about mlockall() and mprotect() Content-Type: text/plain; charset="ISO-8859-1" Content-Transfer-Encoding: 7bit X-Originating-IP: [10.177.25.179] X-CFilter-Loop: Reflected X-Mirapoint-Virus-RAPID-Raw: score=unknown(0), refid=str=0001.0A0B0201.59CA0852.00CE,ss=1,re=0.000,recu=0.000,reip=0.000,cl=1,cld=1,fgs=0, ip=0.0.0.0, so=2014-11-16 11:51:01, dmn=2013-03-21 17:37:32 X-Mirapoint-Loop-Id: 35cfd41902834122c240ba04c19bde73 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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