Re: [PATCH 2/3] Fix fsync livelock

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Mikulas Patocka
Date: Sunday, October 5, 2008 - 4:18 pm

On Sun, 5 Oct 2008, Arjan van de Ven wrote:


The problem here is that you have two processes --- one is writing, the 
other is simultaneously syncing. The syncing process can't distinguish the 
pages that were created before fsync() was invoked (it has to wait on 
them) and the pages that were created while fsync() was running (it 
doesn't have to wait on them) --- so it waits on them all. The result is 
livelock, it waits indefinitely, because more and more pages are being 
created.

The patch changes it so that if it waits long enough, it stops the other 
writers creating dirty pages.

Or, how otherwise would you implement "Submit them all in one go, then 
wait"? The current code is:
you grab page 0, see it is under writeback, wait on it
you grab page 1, see it is under writeback, wait on it
you grab page 2, see it is under writeback, wait on it
you grab page 3, see it is under writeback, wait on it
...
--- and the other process is just making more and more writeback pages 
while your waiting routine run. So the waiting is indefinite.

Mikulas
--
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[PATCH] Memory management livelock, Mikulas Patocka, (Mon Sep 22, 2:10 pm)
Re: [PATCH] Memory management livelock, Andrew Morton, (Mon Sep 22, 5:48 pm)
Re: [PATCH] Memory management livelock, Mikulas Patocka, (Tue Sep 23, 3:34 pm)
Re: [PATCH] Memory management livelock, Andrew Morton, (Tue Sep 23, 3:49 pm)
Re: [PATCH] Memory management livelock, Mikulas Patocka, (Tue Sep 23, 4:11 pm)
Re: [PATCH] Memory management livelock, Andrew Morton, (Tue Sep 23, 4:46 pm)
Re: [PATCH] Memory management livelock, Mikulas Patocka, (Wed Sep 24, 11:50 am)
[PATCH 1/3] Memory management livelock, Mikulas Patocka, (Wed Sep 24, 11:51 am)
[PATCH 2/3] Memory management livelock, Mikulas Patocka, (Wed Sep 24, 11:52 am)
[PATCH 3/3] Memory management livelock, Mikulas Patocka, (Wed Sep 24, 11:53 am)
Re: [PATCH 2/3] Memory management livelock, Andrew Morton, (Wed Oct 1, 10:54 pm)
Re: [PATCH] Memory management livelock, Nick Piggin, (Thu Oct 2, 7:32 pm)
Re: [PATCH] Memory management livelock, Andrew Morton, (Thu Oct 2, 7:40 pm)
Re: [PATCH] Memory management livelock, Nick Piggin, (Thu Oct 2, 7:54 pm)
Re: [PATCH] Memory management livelock, Nick Piggin, (Thu Oct 2, 7:59 pm)
Re: [PATCH] Memory management livelock, Andrew Morton, (Thu Oct 2, 8:14 pm)
Re: [PATCH] Memory management livelock, Nick Piggin, (Thu Oct 2, 8:47 pm)
Re: [PATCH] Memory management livelock, Andrew Morton, (Thu Oct 2, 8:56 pm)
Re: [PATCH] Memory management livelock, Nick Piggin, (Thu Oct 2, 9:07 pm)
Re: [PATCH] Memory management livelock, Andrew Morton, (Thu Oct 2, 9:17 pm)
Re: [PATCH] Memory management livelock, Nick Piggin, (Thu Oct 2, 9:29 pm)
Re: [PATCH] Memory management livelock, Mikulas Patocka, (Fri Oct 3, 4:26 am)
Re: [PATCH] Memory management livelock, Mikulas Patocka, (Fri Oct 3, 4:43 am)
Re: [PATCH] Memory management livelock, Nick Piggin, (Fri Oct 3, 5:27 am)
Re: [PATCH] Memory management livelock, Nick Piggin, (Fri Oct 3, 5:31 am)
Re: [PATCH] Memory management livelock, Mikulas Patocka, (Fri Oct 3, 6:50 am)
Re: [PATCH] Memory management livelock, Mikulas Patocka, (Fri Oct 3, 6:53 am)
Re: [PATCH] Memory management livelock, Alasdair G Kergon, (Fri Oct 3, 7:36 am)
Re: [PATCH] Memory management livelock, Alasdair G Kergon, (Fri Oct 3, 7:50 am)
[PATCH 1/3] bit mutexes, Mikulas Patocka, (Sun Oct 5, 3:14 pm)
[PATCH 2/3] Fix fsync livelock, Mikulas Patocka, (Sun Oct 5, 3:14 pm)
[PATCH 3/3] Fix fsync-vs-write misbehavior, Mikulas Patocka, (Sun Oct 5, 3:16 pm)
Re: [PATCH 2/3] Fix fsync livelock, Arjan van de Ven, (Sun Oct 5, 3:33 pm)
Re: [PATCH 2/3] Fix fsync livelock, Mikulas Patocka, (Sun Oct 5, 4:02 pm)
Re: [PATCH 2/3] Fix fsync livelock, Arjan van de Ven, (Sun Oct 5, 4:07 pm)
Re: [PATCH 2/3] Fix fsync livelock, Mikulas Patocka, (Sun Oct 5, 4:18 pm)
Re: [PATCH 2/3] Fix fsync livelock, Arjan van de Ven, (Sun Oct 5, 4:28 pm)
Re: [PATCH 2/3] Fix fsync livelock, Mikulas Patocka, (Sun Oct 5, 5:01 pm)
Re: [PATCH 2/3] Fix fsync livelock, Arjan van de Ven, (Sun Oct 5, 5:30 pm)
Re: [PATCH 2/3] Fix fsync livelock, Dave Chinner, (Sun Oct 5, 7:51 pm)
Re: [PATCH 2/3] Fix fsync livelock, Mikulas Patocka, (Sun Oct 5, 8:30 pm)
Re: [PATCH 2/3] Fix fsync livelock, Arjan van de Ven, (Sun Oct 5, 9:20 pm)
Re: [PATCH 2/3] Fix fsync livelock, Mikulas Patocka, (Mon Oct 6, 6:00 am)
Re: [PATCH 2/3] Fix fsync livelock, Arjan van de Ven, (Mon Oct 6, 6:50 am)
Re: [PATCH 2/3] Fix fsync livelock, Mikulas Patocka, (Mon Oct 6, 1:44 pm)
Re: [PATCH 2/3] Fix fsync livelock, Pavel Machek, (Wed Oct 8, 3:56 am)
[PATCH] documentation: explain memory barriers, Randy Dunlap, (Wed Oct 8, 6:12 pm)
Re: [PATCH] documentation: explain memory barriers, Chris Snook, (Wed Oct 8, 6:17 pm)
Re: [PATCH] documentation: explain memory barriers, Andrew Morton, (Wed Oct 8, 6:31 pm)
Re: [PATCH] documentation: explain memory barriers, Valdis.Kletnieks, (Wed Oct 8, 6:50 pm)
Re: [PATCH] documentation: explain memory barriers, Chris Snook, (Wed Oct 8, 10:51 pm)
Re: [PATCH] documentation: explain memory barriers, Valdis.Kletnieks, (Wed Oct 8, 11:52 pm)
Re: [PATCH] documentation: explain memory barriers, Ben Hutchings, (Thu Oct 9, 2:58 am)
Re: [PATCH] documentation: explain memory barriers, Nick Piggin, (Thu Oct 9, 10:29 am)
Re: [PATCH] documentation: explain memory barriers, Nick Piggin, (Thu Oct 9, 10:35 am)
Re: [PATCH] documentation: explain memory barriers, Nick Piggin, (Thu Oct 9, 2:27 pm)