[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAHGf_=qdow5GNHG+AQyfoKgga=Bqf5-x8ir4JmHrzaJs9pX2NQ@mail.gmail.com>
Date: Thu, 30 May 2013 15:59:53 -0400
From: KOSAKI Motohiro <kosaki.motohiro@...fujitsu.com>
To: Rafael Aquini <aquini@...hat.com>
Cc: LKML <linux-kernel@...r.kernel.org>,
"linux-mm@...ck.org" <linux-mm@...ck.org>,
Andrew Morton <akpm@...ux-foundation.org>,
Hugh Dickins <hughd@...gle.com>, shli@...nel.org,
"riel@...hat.com" <riel@...hat.com>,
Larry Woodman <lwoodman@...hat.com>,
KAMEZAWA Hiroyuki <kamezawa.hiroyu@...fujitsu.com>,
stable@...r.kernel.org
Subject: Re: [PATCH] swap: avoid read_swap_cache_async() race to deadlock
while waiting on discard I/O compeletion
On Thu, May 30, 2013 at 2:05 PM, Rafael Aquini <aquini@...hat.com> wrote:
> read_swap_cache_async() can race against get_swap_page(), and stumble across
> a SWAP_HAS_CACHE entry in the swap map whose page wasn't brought into the
> swapcache yet. This transient swap_map state is expected to be transitory,
> but the actual placement of discard at scan_swap_map() inserts a wait for
> I/O completion thus making the thread at read_swap_cache_async() to loop
> around its -EEXIST case, while the other end at get_swap_page()
> is scheduled away at scan_swap_map(). This can leave the system deadlocked
> if the I/O completion happens to be waiting on the CPU workqueue where
> read_swap_cache_async() is busy looping and !CONFIG_PREEMPT.
>
> This patch introduces a cond_resched() call to make the aforementioned
> read_swap_cache_async() busy loop condition to bail out when necessary,
> thus avoiding the subtle race window.
>
> Signed-off-by: Rafael Aquini <aquini@...hat.com>
Acked-by: KOSAKI Motohiro <kosaki.motohiro@...fujitsu.com>
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists