Re: [Bug 9182] Critical memory leak (dirty pages)
From: Jan Kara
Date: Thu Dec 20 2007 - 12:26:10 EST
> On Thu, 20 Dec 2007, Bj?rn Steinbrink wrote:
> >
> > OK, so I looked for PG_dirty anyway.
> >
> > In 46d2277c796f9f4937bfa668c40b2e3f43e93dd0 you made try_to_free_buffers
> > bail out if the page is dirty.
> >
> > Then in 3e67c0987d7567ad666641164a153dca9a43b11d, Andrew fixed
> > truncate_complete_page, because it called cancel_dirty_page (and thus
> > cleared PG_dirty) after try_to_free_buffers was called via
> > do_invalidatepage.
> >
> > Now, if I'm not mistaken, we can end up as follows.
> >
> > truncate_complete_page()
> > cancel_dirty_page() // PG_dirty cleared, decr. dirty pages
> > do_invalidatepage()
> > ext3_invalidatepage()
> > journal_invalidatepage()
> > journal_unmap_buffer()
> > __dispose_buffer()
> > __journal_unfile_buffer()
> > __journal_temp_unlink_buffer()
> > mark_buffer_dirty(); // PG_dirty set, incr. dirty pages
>
> Good, this seems to be the exact path that actually triggers it. I got to
> journal_unmap_buffer(), but was too lazy to actually then bother to follow
> it all the way down - I decided that I didn't actually really even care
> what the low-level FS layer did, I had already convinced myself that it
> obviously must be dirtying the page some way, since that matched the
> symptoms exactly (ie only the journaling case was impacted, and this was
> all about the journal).
>
> But perhaps more importantly: regardless of what the low-level filesystem
> did at that point, the VM accounting shouldn't care, and should be robust
> in the face of a low-level filesystem doing strange and wonderful things.
> But thanks for bothering to go through the whole history and figure out
> what exactly is up.
As I wrote in my previous email, this solution works but hides the
fact that the page really *has* dirty data in it and *is* pinned in memory
until the commit code gets to writing it. So in theory it could disturb
the writeout logic by having more dirty data in memory than vm thinks it
has. Not that I'd have a better fix now but I wanted to point out this
problem.
Honza
--
Jan Kara <jack@xxxxxxx>
SuSE CR Labs
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/