linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: "Huang, Ying" <ying.huang@intel.com>
To: "Yin, Fengwei" <fengwei.yin@intel.com>
Cc: Matthew Wilcox <willy@infradead.org>,
	 "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>,
	 <peterz@infradead.org>,  <mgorman@suse.de>, <mingo@redhat.com>,
	 <riel@redhat.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: Wed, 15 Nov 2023 09:46:03 +0800	[thread overview]
Message-ID: <87wmujeqlg.fsf@yhuang6-desk2.ccr.corp.intel.com> (raw)
In-Reply-To: <c331d19a-d467-4b9d-81b0-e3f727d17ace@intel.com> (Fengwei Yin's message of "Tue, 14 Nov 2023 19:23:25 +0800")

"Yin, Fengwei" <fengwei.yin@intel.com> writes:

> On 11/13/2023 10:02 AM, Huang, Ying wrote:
>>>> There are other places in the kernel where the PTE is cleared, for
>>>> example, move_ptes() in mremap.c.  IIUC, we need to audit all them.
>>>>
>>>> Another possible solution is to check PTE again with PTL held before
>>>> reading in file data.  This will increase the overhead of major fault
>>>> path.  Is it acceptable?
>>> What if we check the PTE without page table lock acquired?
>> The PTE is zeroed temporarily only with PTL held.  So, if we acquire the
>> PTL in filemap_fault() and check the PTE, the PTE which is zeroed in
>> do_numa_page() will be non-zero now.  So we can avoid the major fault.
> Yes.
>
>> 
>> But, if we don't acquire the PTL, the PTE may still be zero.
> For do_numa_page()/change_pte_range(), it does very limit thing during
> PTE is cleared. Considering the code path of do_read_fault(), it's likely
> the PTE is none-zero.

It's possible per my understanding, although it doesn't feel good to
depend on some "race" condition.

> My concern to acquiring lock is that it brings extra PTL lock acquire/release
> for other more common cases.

Yes.  It will bring some overhead to acquire the PTL.

Anyway, some performance test is needed to compare the solution.

--
Best Regards,
Huang, Ying


  reply	other threads:[~2023-11-15  1:48 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
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 [this message]
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=87wmujeqlg.fsf@yhuang6-desk2.ccr.corp.intel.com \
    --to=ying.huang@intel.com \
    --cc=akpm@linux-foundation.org \
    --cc=david@redhat.com \
    --cc=fengwei.yin@intel.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=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