On Mon, Sep 27, 2021 at 03:24:47PM -0700, Song Liu wrote: > OTOH, does it make sense to block writes within khugepaged, like: > @@ -1652,6 +1653,11 @@ static void collapse_file(struct mm_struct *mm, > /* Only allocate from the target node */ > gfp = alloc_hugepage_khugepaged_gfpmask() | __GFP_THISNODE; > > + if (deny_write_access(file)) { > + result = SCAN_BUSY_WRITE; > + return; > + } The problem is that it denies, rather than blocking. That means that the writer gets ETXTBSY instead of waiting until khugepaged is done.