From: Xishi Qiu <qiuxishi@huawei.com>
To: Michal Hocko <mhocko@kernel.org>
Cc: Vlastimil Babka <vbabka@suse.cz>,
Joonsoo Kim <iamjoonsoo.kim@lge.com>,
Mel Gorman <mgorman@techsingularity.net>,
Linux MM <linux-mm@kvack.org>,
LKML <linux-kernel@vger.kernel.org>,
zhong jiang <zhongjiang@huawei.com>,
yeyunfeng <yeyunfeng@huawei.com>,
wanghaitao12@huawei.com, "Zhoukang (A)" <zhoukang7@huawei.com>
Subject: Re: [RFC] a question about mlockall() and mprotect()
Date: Tue, 10 Oct 2017 09:22:20 +0800 [thread overview]
Message-ID: <59DC20CC.1030509@huawei.com> (raw)
In-Reply-To: <20171009182656.ynu7tdzb5uwp5xnr@dhcp22.suse.cz>
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 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);
>>> }
>>>
>>
>> Hi Michal,
>>
>> My kernel is v3.10, and I missed this code, thank you reminding me.
>
> I guess I didn't get your answer. Does the above diff resolves your
> problem?
Hi Michal,
This upstream patch 36f881883c57941bb32d25cea6524f9612ab5a2c has already
resolve my problem, thank you for your attention.
Thanks,
Xishi Qiu
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
WARNING: multiple messages have this Message-ID (diff)
From: Xishi Qiu <qiuxishi@huawei.com>
To: Michal Hocko <mhocko@kernel.org>
Cc: Vlastimil Babka <vbabka@suse.cz>,
Joonsoo Kim <iamjoonsoo.kim@lge.com>,
Mel Gorman <mgorman@techsingularity.net>,
Linux MM <linux-mm@kvack.org>,
LKML <linux-kernel@vger.kernel.org>,
zhong jiang <zhongjiang@huawei.com>,
yeyunfeng <yeyunfeng@huawei.com>, <wanghaitao12@huawei.com>,
"Zhoukang (A)" <zhoukang7@huawei.com>
Subject: Re: [RFC] a question about mlockall() and mprotect()
Date: Tue, 10 Oct 2017 09:22:20 +0800 [thread overview]
Message-ID: <59DC20CC.1030509@huawei.com> (raw)
In-Reply-To: <20171009182656.ynu7tdzb5uwp5xnr@dhcp22.suse.cz>
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 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);
>>> }
>>>
>>
>> Hi Michal,
>>
>> My kernel is v3.10, and I missed this code, thank you reminding me.
>
> I guess I didn't get your answer. Does the above diff resolves your
> problem?
Hi Michal,
This upstream patch 36f881883c57941bb32d25cea6524f9612ab5a2c has already
resolve my problem, thank you for your attention.
Thanks,
Xishi Qiu
next prev parent reply other threads:[~2017-10-10 1:24 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-09-26 7:56 [RFC] a question about mlockall() and mprotect() Xishi Qiu
2017-09-26 7:56 ` Xishi Qiu
2017-09-26 8:17 ` Michal Hocko
2017-09-26 8:17 ` Michal Hocko
2017-09-26 8:39 ` Xishi Qiu
2017-09-26 8:39 ` Xishi Qiu
2017-09-26 9:02 ` Michal Hocko
2017-09-26 9:02 ` Michal Hocko
2017-09-26 9:13 ` Xishi Qiu
2017-09-26 9:13 ` Xishi Qiu
2017-09-26 9:18 ` Michal Hocko
2017-09-26 9:18 ` Michal Hocko
2017-09-26 9:22 ` Xishi Qiu
2017-09-26 9:22 ` Xishi Qiu
2017-09-26 9:45 ` Vlastimil Babka
2017-09-26 9:45 ` Vlastimil Babka
2017-09-26 11:00 ` Michal Hocko
2017-09-26 11:00 ` Michal Hocko
2017-09-27 5:51 ` Xishi Qiu
2017-09-27 5:51 ` Xishi Qiu
2017-10-09 18:26 ` Michal Hocko
2017-10-09 18:26 ` Michal Hocko
2017-10-10 1:22 ` Xishi Qiu [this message]
2017-10-10 1:22 ` Xishi Qiu
2017-10-10 5:50 ` Michal Hocko
2017-10-10 5:50 ` Michal Hocko
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=59DC20CC.1030509@huawei.com \
--to=qiuxishi@huawei.com \
--cc=iamjoonsoo.kim@lge.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=mgorman@techsingularity.net \
--cc=mhocko@kernel.org \
--cc=vbabka@suse.cz \
--cc=wanghaitao12@huawei.com \
--cc=yeyunfeng@huawei.com \
--cc=zhongjiang@huawei.com \
--cc=zhoukang7@huawei.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.