Re: [PATCH v2 1/2] mm, thp: check page mapping when truncating page cache

From: Song Liu
Date: Mon Oct 04 2021 - 16:26:43 EST


On Mon, Oct 4, 2021 at 10:26 AM Rongwei Wang
<rongwei.wang@xxxxxxxxxxxxxxxxx> wrote:
>
> Hi,
> I have run our cases these two days to stress test new Patch #1. The new
> Patch #1 mainly add filemap_invalidate_{un}lock before and after
> truncate_pagecache(), basing on original Patch #1. And the crash has not
> happened.
>
> Now, I keep the original Patch #1, then adding the code below which
> suggested by liu song (I'm not sure which one I should add in the next
> version, Suggested-by or Signed-off-by? If you know, please remind me).
>
> - if (filemap_nr_thps(inode->i_mapping))
> + if (filemap_nr_thps(inode->i_mapping)) {
> + filemap_invalidate_lock(inode->i_mapping);
> truncate_pagecache(inode, 0);
> + filemap_invalidate_unlock(inode->i_mapping);
> + }

It is mostly suggested by Matthew. If the patch goes that way, you can add

Tested-by: Song Liu <song@xxxxxxxxxx>