[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <46f82df2-c925-e3f9-b185-69b3f0b6e366@google.com>
Date: Mon, 27 Feb 2023 21:59:17 -0800 (PST)
From: Hugh Dickins <hughd@...gle.com>
To: "Huang, Ying" <ying.huang@...el.com>
cc: Jan Kara <jack@...e.cz>, Hugh Dickins <hughd@...gle.com>,
Andrew Morton <akpm@...ux-foundation.org>, 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>,
Matthew Wilcox <willy@...radead.org>,
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>
Subject: Re: [PATCH -v5 0/9] migrate_pages(): batch TLB flushing
On Tue, 28 Feb 2023, Huang, Ying wrote:
> Jan Kara <jack@...e.cz> writes:
> > On Fri 17-02-23 13:47:48, Hugh Dickins wrote:
> >>
> >> Cc'ing Jan Kara, who knows buffer_migrate_folio_norefs() and jbd2
> >> very well, and I hope can assure us that there is an understandable
> >> deadlock here, from holding several random folio locks, then trying
> >> to lock buffers. Cc'ing fsdevel, because there's a risk that mm
> >> folk think something is safe, when it's not sufficient to cope with
> >> the diversity of filesystems. I hope nothing more than the below is
> >> needed (and I've had no other problems with the patchset: good job),
> >> but cannot be sure.
> >
> > I suspect it can indeed be caused by the presence of the loop device as
> > Huang Ying has suggested. What filesystems using buffer_heads do is a
> > pattern like:
> >
> > bh = page_buffers(loop device page cache page);
> > lock_buffer(bh);
> > submit_bh(bh);
> > - now on loop dev this ends up doing:
> > lo_write_bvec()
> > vfs_iter_write()
> > ...
> > folio_lock(backing file folio);
> >
> > So if migration code holds "backing file folio" lock and at the same time
> > waits for 'bh' lock (while trying to migrate loop device page cache page), it
> > is a deadlock.
> >
> > Proposed solution of never waiting for locks in batched mode looks like a
> > sensible one to me...
>
> Thank you very much for detail explanation!
Yes, thanks a lot, Jan, for elucidating the deadlocks.
I was running with the 1/3,2/3,3/3 series for 48 hours on two machines
at the weekend, and hit no problems with all of them on.
I did try to review them this evening, but there's too much for me to
take in there to give an Acked-by: but I'll ask a couple of questions.
Hugh
Powered by blists - more mailing lists