linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: "Yin, Fengwei" <fengwei.yin@intel.com>
To: Matthew Wilcox <willy@infradead.org>,
	Peter Zijlstra <peterz@infradead.org>
Cc: "zhangpeng (AS)" <zhangpeng362@huawei.com>, <linux-mm@kvack.org>,
	<linux-kernel@vger.kernel.org>, <akpm@linux-foundation.org>,
	<lstoakes@gmail.com>, <hughd@google.com>, <david@redhat.com>,
	<vbabka@suse.cz>, <mgorman@suse.de>, <mingo@redhat.com>,
	<riel@redhat.com>, <ying.huang@intel.com>, <hannes@cmpxchg.org>,
	Nanyong Sun <sunnanyong@huawei.com>,
	Kefeng Wang <wangkefeng.wang@huawei.com>
Subject: Re: [Question]: major faults are still triggered after mlockall when numa balancing
Date: Thu, 9 Nov 2023 23:15:30 +0800	[thread overview]
Message-ID: <fbdf3664-b162-471d-82bb-58356cc4f7d2@intel.com> (raw)
In-Reply-To: <ZUzs2YfXY3zBKIx9@casper.infradead.org>



On 11/9/2023 10:29 PM, Matthew Wilcox wrote:
> On Thu, Nov 09, 2023 at 03:11:41PM +0100, Peter Zijlstra wrote:
>> On Thu, Nov 09, 2023 at 09:47:24PM +0800, zhangpeng (AS) wrote:
>>> Is there any way to avoid such a major fault?
>>
>> man madvise
> 
> but from the mlockall manpage:
> 
>        mlockall() locks all pages mapped into the address space of the calling
>        process.  This includes the pages of the code, data, and stack segment,
>        as well as shared libraries, user space kernel data, shared memory, and
>        memory-mapped files.  All mapped pages are guaranteed to be resident in
>        RAM  when  the  call  returns successfully; the pages are guaranteed to
>        stay in RAM until later unlocked.
> 
> https://pubs.opengroup.org/onlinepubs/9699919799/functions/mlockall.html
> isn't quite so explicit, but I do think that page cache should be locked
> into memory.

Here is my understanding. It's related with write to a mlocked private file
mapping. From Peng:
"For the data segment, the global variable area is a private mapping".
So it's data segment of ELF file and mapped privately by ELF loader.

For this case, even ELF loader is updated to mlock the data segment, a
write will trigger COW and a new anonymous page will be allocated and
mlocked. The original file mapped page will be munlocked in 
    do_wp_page()
        wp_page_copy()
            if (old_folio) {
                page_remove_rmap()
            }
So it's possible the original file mapped page is reclaimed and later
accessing will trigger major fault.


Regards
Yin, Fengwei


  reply	other threads:[~2023-11-09 15:15 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-11-09 13:47 zhangpeng (AS)
2023-11-09 14:11 ` Peter Zijlstra
2023-11-09 14:29   ` Matthew Wilcox
2023-11-09 15:15     ` Yin, Fengwei [this message]
2023-11-09 17:27 ` Matthew Wilcox
2023-11-10  5:32   ` Huang, Ying
2023-11-10  9:04     ` Yin, Fengwei
2023-11-13  2:02       ` Huang, Ying
2023-11-14 11:23         ` Yin, Fengwei
2023-11-15  1:46           ` Huang, Ying
2023-11-10  9:39   ` zhangpeng (AS)
2023-11-09 22:54 ` Yang Shi
2023-11-10  1:57   ` Yin, Fengwei
2023-11-10  3:39     ` Kefeng Wang
2023-11-10  3:50       ` Yin, Fengwei
2023-11-10  4:00         ` Aneesh Kumar K V
2023-11-14  1:41     ` Yang Shi
2023-11-14 11:10       ` Yin, Fengwei
2023-11-09 23:21 ` Matthew Wilcox
2023-11-10  5:04 ` Aneesh Kumar K.V
2023-11-10  8:36   ` zhangpeng (AS)
2023-11-10  8:17 ` Aneesh Kumar K.V
2023-11-10  9:50   ` zhangpeng (AS)

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=fbdf3664-b162-471d-82bb-58356cc4f7d2@intel.com \
    --to=fengwei.yin@intel.com \
    --cc=akpm@linux-foundation.org \
    --cc=david@redhat.com \
    --cc=hannes@cmpxchg.org \
    --cc=hughd@google.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=lstoakes@gmail.com \
    --cc=mgorman@suse.de \
    --cc=mingo@redhat.com \
    --cc=peterz@infradead.org \
    --cc=riel@redhat.com \
    --cc=sunnanyong@huawei.com \
    --cc=vbabka@suse.cz \
    --cc=wangkefeng.wang@huawei.com \
    --cc=willy@infradead.org \
    --cc=ying.huang@intel.com \
    --cc=zhangpeng362@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox