> > On Fri 20-11-15 13:34:36, Namjae Jeon wrote: > > Actually, I can quickly create memleak with simple testcase like: > > while(1000) > > { > > Random seek(max 500M) -> write 1M -> fsync ->truncate(random size) > > } > > > > As there is significant memleak in this situation also, I started focusing > > on this simple testcase only. When use this testcase, I never saw EBUSY path > > in jbd2_journal_invalidatepage() -> journal_unmap_buffer(). > > > > On the other hand(), for memleak pages jbd2_journal_invalidatepage() -> > > journal_unmap_buffer() was almost bailing out every time from > > if (!buffer_dirty(bh)) { > > /* bdflush has written it. We can drop it now */ > > goto zap_buffer; > > } > > > > As per debugging, NULL mapping page or buffer is created in below scenario: > > Write(or Kjournald) -> jbd2_journal_commit_transaction > > -> BH_JBDDirty buffer is added to forget list. > > -> Buffer is added to new checkpoint, > > additional reference count is taken on b_jcount which > > keeps buffer busy until remove checkpoint. > > -> Buffer is unfiled, removed from forget list, BH_JBDDirty > > is cleared and BH_Dirty is set, it is exposed to VM. > > Ah, I see! Thanks for the easy reproduction testcase and for the debugging. > Attached patch fixes the issue (at least the simple truncate case) for me. > Can you check whether it fixes the issue for you as well? Thanks! This patch looks good to me! I checked that all leak issues are fixed with your patch. Thanks for your help! > > Honza > -- > Jan Kara <jack@xxxxxxxx> > SUSE Labs, CR -- To unsubscribe from this list: send the line "unsubscribe linux-ext4" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html