From: Matthew Wilcox <willy@infradead.org>
To: Hugh Dickins <hughd@google.com>
Cc: "Huang, Ying" <ying.huang@intel.com>,
Andrew Morton <akpm@linux-foundation.org>,
Jan Kara <jack@suse.cz>,
linux-mm@kvack.org, linux-kernel@vger.kernel.org,
linux-fsdevel@vger.kernel.org, Zi Yan <ziy@nvidia.com>,
Yang Shi <shy828301@gmail.com>,
Baolin Wang <baolin.wang@linux.alibaba.com>,
Oscar Salvador <osalvador@suse.de>,
Bharata B Rao <bharata@amd.com>,
Alistair Popple <apopple@nvidia.com>,
Xin Hao <xhao@linux.alibaba.com>,
Minchan Kim <minchan@kernel.org>,
Mike Kravetz <mike.kravetz@oracle.com>,
Hyeonggon Yoo <42.hyeyoo@gmail.com>,
"Xu, Pengfei" <pengfei.xu@intel.com>,
Christoph Hellwig <hch@lst.de>, Stefan Roesch <shr@devkernel.io>,
Tejun Heo <tj@kernel.org>
Subject: Re: [PATCH -v5 0/9] migrate_pages(): batch TLB flushing
Date: Tue, 21 Feb 2023 04:30:26 +0000 [thread overview]
Message-ID: <Y/RI4s45PZ6Bv2ZR@casper.infradead.org> (raw)
In-Reply-To: <2ab4b33e-f570-a6ff-6315-7d5a4614a7bd@google.com>
On Mon, Feb 20, 2023 at 06:48:38PM -0800, Hugh Dickins wrote:
> Yes, that's a good principle, that we should avoid to lock/wait
> synchronously once we have locked one folio (hmm, above you say
> "more than one": I think we mean the same thing, we're just
> stating it differently, given how the code runs at present).
I suspect the migrate page code is disobeying the locking ordering
rules for multiple folios. if two folios belong to the same file,
they must be locked by folio->index order, low to high. If two folios
belong to different files, they must be ordered by folio->mapping, the
mapping lowest in memory first. You can see this locking rule embedded
in vfs_lock_two_folios() in fs/remap_range.c.
I don't know what the locking rules are for two folios which are not file
folios, or for two folios when one is anonymous and the other belongs
to a file. Maybe it's the same; you can lock them ordered by ->mapping
first, then by ->index.
Or you can just trylock multiple folios and skip the ones that don't work.
next prev parent reply other threads:[~2023-02-21 4:30 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-02-13 12:34 [PATCH -v5 0/9] migrate_pages(): batch TLB flushing Huang Ying
2023-02-13 12:34 ` [PATCH -v5 1/9] migrate_pages: organize stats with struct migrate_pages_stats Huang Ying
2023-02-13 12:34 ` [PATCH -v5 2/9] migrate_pages: separate hugetlb folios migration Huang Ying
2023-02-13 12:34 ` [PATCH -v5 3/9] migrate_pages: restrict number of pages to migrate in batch Huang Ying
2023-02-13 12:34 ` [PATCH -v5 4/9] migrate_pages: split unmap_and_move() to _unmap() and _move() Huang Ying
2023-02-13 12:34 ` [PATCH -v5 5/9] migrate_pages: batch _unmap and _move Huang Ying
2023-02-13 12:34 ` [PATCH -v5 6/9] migrate_pages: move migrate_folio_unmap() Huang Ying
2023-02-13 12:34 ` [PATCH -v5 7/9] migrate_pages: share more code between _unmap and _move Huang Ying
2023-02-13 12:34 ` [PATCH -v5 8/9] migrate_pages: batch flushing TLB Huang Ying
2023-02-13 12:34 ` [PATCH -v5 9/9] migrate_pages: move THP/hugetlb migration support check to simplify code Huang Ying
2023-02-17 21:47 ` [PATCH -v5 0/9] migrate_pages(): batch TLB flushing Hugh Dickins
2023-02-20 9:28 ` Huang, Ying
2023-02-21 2:48 ` Hugh Dickins
2023-02-21 3:34 ` Huang, Ying
2023-02-21 22:15 ` Hugh Dickins
2023-02-21 4:30 ` Matthew Wilcox [this message]
2023-02-21 4:38 ` Huang, Ying
2023-02-21 14:04 ` Huang, Ying
2023-02-21 22:25 ` Hugh Dickins
2023-02-22 1:02 ` Huang, Ying
2023-02-27 11:06 ` Jan Kara
2023-02-28 1:13 ` Huang, Ying
2023-02-28 5:59 ` Hugh Dickins
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=Y/RI4s45PZ6Bv2ZR@casper.infradead.org \
--to=willy@infradead.org \
--cc=42.hyeyoo@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=apopple@nvidia.com \
--cc=baolin.wang@linux.alibaba.com \
--cc=bharata@amd.com \
--cc=hch@lst.de \
--cc=hughd@google.com \
--cc=jack@suse.cz \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=mike.kravetz@oracle.com \
--cc=minchan@kernel.org \
--cc=osalvador@suse.de \
--cc=pengfei.xu@intel.com \
--cc=shr@devkernel.io \
--cc=shy828301@gmail.com \
--cc=tj@kernel.org \
--cc=xhao@linux.alibaba.com \
--cc=ying.huang@intel.com \
--cc=ziy@nvidia.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;
as well as URLs for NNTP newsgroup(s).