[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <ZgK91II_eSYY6D2F@casper.infradead.org>
Date: Tue, 26 Mar 2024 12:21:40 +0000
From: Matthew Wilcox <willy@...radead.org>
To: Zhaoyang Huang <huangzhaoyang@...il.com>
Cc: 黄朝阳 (Zhaoyang Huang) <zhaoyang.huang@...soc.com>,
Andrew Morton <akpm@...ux-foundation.org>,
"linux-mm@...ck.org" <linux-mm@...ck.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
康纪滨 (Steve Kang) <Steve.Kang@...soc.com>
Subject: Re: summarize all information again at bottom//reply: reply: [PATCH]
mm: fix a race scenario in folio_isolate_lru
On Tue, Mar 26, 2024 at 05:06:55PM +0800, Zhaoyang Huang wrote:
> 1. Thread_readahead remove the folio from page cache and drop 2 refcnt
> by readahead_folio & filemap_remove_folio(get rid of the folios which
> failed to launch IO during readahead)
> refcnt == 0, PG_lru == true, PG_lock == true
> read_pages
> ...
> folio = readahead_folio
> <one refcnt dropped here>
> ********For the folio which can not launch IO, we should NOT drop
> refcnt here??? replaced by __readahead_folio???**********
> folio_get
> filemap_remove_folio(folio)
> folio_unlock
> <one refcnt dropped here>
> folio_put
Ignoring any other thread, you're basically saying that there's a
refcount imbalance here. Which means we'd hit an assert (that folio
refcount went below zero) in the normal case where another thread wasn't
simultaneously trying to do anything.
Powered by blists - more mailing lists