[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <875ybveipn.fsf@yhuang6-desk2.ccr.corp.intel.com>
Date: Tue, 21 Feb 2023 12:38:28 +0800
From: "Huang, Ying" <ying.huang@...el.com>
To: Matthew Wilcox <willy@...radead.org>
Cc: Hugh Dickins <hughd@...gle.com>,
Andrew Morton <akpm@...ux-foundation.org>,
Jan Kara <jack@...e.cz>, linux-mm@...ck.org,
linux-kernel@...r.kernel.org, linux-fsdevel@...r.kernel.org,
Zi Yan <ziy@...dia.com>, Yang Shi <shy828301@...il.com>,
Baolin Wang <baolin.wang@...ux.alibaba.com>,
Oscar Salvador <osalvador@...e.de>,
Bharata B Rao <bharata@....com>,
Alistair Popple <apopple@...dia.com>,
Xin Hao <xhao@...ux.alibaba.com>,
Minchan Kim <minchan@...nel.org>,
Mike Kravetz <mike.kravetz@...cle.com>,
Hyeonggon Yoo <42.hyeyoo@...il.com>,
"Xu, Pengfei" <pengfei.xu@...el.com>,
Christoph Hellwig <hch@....de>,
Stefan Roesch <shr@...kernel.io>, Tejun Heo <tj@...nel.org>
Subject: Re: [PATCH -v5 0/9] migrate_pages(): batch TLB flushing
Matthew Wilcox <willy@...radead.org> writes:
> 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.
Yes. We will only trylock when we have locked some folios (including
one). And retry locking only after having processed and unlocked the
already locked folios.
Best Regards,
Huang, Ying
Powered by blists - more mailing lists