Re: [PATCH v2 5/5] mm/khugepaged: Convert collapse_pte_mapped_thp() to use folios

From: Kefeng Wang
Date: Wed Oct 18 2023 - 22:17:10 EST




On 2023/10/19 7:01, Vishal Moola wrote:
On Wed, Oct 18, 2023 at 01:32:13PM -0700, Vishal Moola (Oracle) wrote:
This removes 2 calls to compound_head() and helps convert khugepaged to
use folios throughout.

Previously, if the address passed to collapse_pte_mapped_thp()
corresponded to a tail page, the scan would fail immediately. Using
filemap_lock_folio() we can get the corresponding folio back and try to
operate on the folio instead.

Signed-off-by: Vishal Moola (Oracle) <vishal.moola@xxxxxxxxx>

Hi Andrew, I've attached a fix patch addressing the syzbot issue.
It can be squashed into this patch, syzbot tested it on v2 already as
well.

Hi Vishal, only IS_ERR(folio) is enough since filemap_lock_folio won't return NULL.