linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Ryan Roberts <ryan.roberts@arm.com>
To: Barry Song <21cnbao@gmail.com>, "Huang, Ying" <ying.huang@intel.com>
Cc: akpm@linux-foundation.org, linux-mm@kvack.org, david@redhat.com,
	chrisl@kernel.org, yuzhao@google.com, hanchuanhua@oppo.com,
	linux-kernel@vger.kernel.org, willy@infradead.org,
	xiang@kernel.org, mhocko@suse.com, shy828301@gmail.com,
	wangkefeng.wang@huawei.com, Barry Song <v-songbaohua@oppo.com>,
	Hugh Dickins <hughd@google.com>
Subject: Re: [RFC PATCH] mm: hold PTL from the first PTE while reclaiming a large folio
Date: Tue, 5 Mar 2024 09:08:12 +0000	[thread overview]
Message-ID: <6c16c7c5-8cf4-4c30-b3a5-a9ab55b21114@arm.com> (raw)
In-Reply-To: <CAGsJ_4yKhoztyA1cuSjGEeVwJfNdhNPNidrX-D_dRazRL7D5hg@mail.gmail.com>

On 05/03/2024 08:56, Barry Song wrote:
> are writing pte to zero(break) before writing a new value(make). while

As an aside, "break-before-make" as defined in the Arm architecture would also
require a TLBI, which usually isn't done for these
write-0-modify-prots-write-back operations. Arm doesn't require
"break-before-make" in these situations so its legal (as long as only certain
bits are changed). To my understanding purpose of doing this is to avoid races
with HW access/dirty flag updates; if the MMU wants to set either flag and finds
the PTE is 0 (invalid) it will cause an exception which will be queued waiting
for the PTL.

So I don't think you really mean break-before-make here.

> this behavior is within PTL in another thread,  page_vma_mapped_walk()
> of try_to_unmap_one thread won't take PTL till it meets a present PTE.
> for example, if another threads are modifying nr_pages PTEs under PTL,
> but we don't hold PTL, we might skip one or two PTEs at the beginning of
> a large folio.
> For a large folio, after try_to_unmap_one(), we may result in PTE0 and PTE1
> untouched but PTE2~nr_pages-1 are set to swap entries.
> 
> by holding PTL from PTE0 for large folios, we won't get these intermediate
> values. At the moment we get PTL, other threads have done.



  parent reply	other threads:[~2024-03-05  9:08 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-04 10:37 Barry Song
2024-03-04 12:20 ` Ryan Roberts
2024-03-04 12:41   ` David Hildenbrand
2024-03-04 13:03     ` Ryan Roberts
2024-03-04 14:27       ` David Hildenbrand
2024-03-04 20:42         ` Barry Song
2024-03-04 21:02           ` David Hildenbrand
2024-03-04 21:41             ` Barry Song
2024-03-04 21:04     ` Barry Song
2024-03-04 21:15       ` David Hildenbrand
2024-03-04 22:29         ` Barry Song
2024-03-05  7:53           ` Huang, Ying
2024-03-05  9:02             ` Barry Song
2024-03-05  9:10               ` Huang, Ying
2024-03-05  9:21                 ` Barry Song
2024-03-05 10:28                   ` Barry Song
2024-03-04 22:02       ` Ryan Roberts
2024-03-05  7:50     ` Huang, Ying
2024-03-04 21:57   ` Barry Song
2024-03-05  8:54     ` Ryan Roberts
2024-03-05  9:08       ` Barry Song
2024-03-05  9:11         ` Ryan Roberts
2024-03-05  9:15           ` Barry Song
2024-03-05  7:28 ` Huang, Ying
2024-03-05  8:56   ` Barry Song
2024-03-05  9:04     ` Huang, Ying
2024-03-05  9:08     ` Ryan Roberts [this message]
2024-03-05  9:11       ` Barry Song

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=6c16c7c5-8cf4-4c30-b3a5-a9ab55b21114@arm.com \
    --to=ryan.roberts@arm.com \
    --cc=21cnbao@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=chrisl@kernel.org \
    --cc=david@redhat.com \
    --cc=hanchuanhua@oppo.com \
    --cc=hughd@google.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mhocko@suse.com \
    --cc=shy828301@gmail.com \
    --cc=v-songbaohua@oppo.com \
    --cc=wangkefeng.wang@huawei.com \
    --cc=willy@infradead.org \
    --cc=xiang@kernel.org \
    --cc=ying.huang@intel.com \
    --cc=yuzhao@google.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