On Tue, 8 Jun 2010 10:02:24 +0100 Mel Gorman <mel@csn.ul.ie> wrote:
Buggy.
I did this, umm ~8 years ago and ended up reverting it because it was
complex and didn't seem to buy us anything. Of course, that was before
we broke the VM and started writing out lots of LRU pages. That code
was better than your code - it grabbed the address_space and did
writearound around the target page.
The reason this code is buggy is that under extreme memory pressure
(<oldfart>the sort of testing nobody does any more</oldfart>) it can be
the case that this iput() is the final iput() on this inode.
Now go take a look at iput_final(), which I bet has never been executed
on this path in your testing. It takes a large number of high-level
VFS locks. Locks which cannot be taken from deep within page reclaim
without causing various deadlocks.
I did solve that problem before reverting it all but I forget how. By
holding a page lock to pin the address_space rather than igrab(),
perhaps. Go take a look - it was somewhere between 2.5.1 and 2.5.10 if
I vaguely recall correctly.
Or don't take a look - we shouldn't need to do any of this anyway.
--