From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 50FC0C433EF for ; Tue, 28 Sep 2021 17:00:06 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id E968F6128E for ; Tue, 28 Sep 2021 17:00:05 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org E968F6128E Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=kvack.org Received: by kanga.kvack.org (Postfix) id 68BF46B006C; Tue, 28 Sep 2021 13:00:05 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 63B8E6B0071; Tue, 28 Sep 2021 13:00:05 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 52C896B0072; Tue, 28 Sep 2021 13:00:05 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0087.hostedemail.com [216.40.44.87]) by kanga.kvack.org (Postfix) with ESMTP id 3F7DA6B006C for ; Tue, 28 Sep 2021 13:00:05 -0400 (EDT) Received: from smtpin19.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id CD5D22FE02 for ; Tue, 28 Sep 2021 17:00:03 +0000 (UTC) X-FDA: 78637594686.19.738D291 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by imf28.hostedemail.com (Postfix) with ESMTP id 77F7C90000AD for ; Tue, 28 Sep 2021 17:00:03 +0000 (UTC) Received: by mail.kernel.org (Postfix) with ESMTPSA id 984476128A for ; Tue, 28 Sep 2021 17:00:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1632848402; bh=LG73icpSNBU/h5t34vTPoYSK6Cz2xz8oCZHbpUZyobE=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=Mrm3kuuRt9rTs8NzBZWKzW9esRU3J2gFAarVZlpdoVicveeRdIEpnxnHjVjpc3MLd qE2lRrMsL6807RAQbe8tCWwp/k+47coKlK874eHIHxpofe3f11ZbPR4VkEkRHd6/ME RRu0NJFkri4xR39TJd2LtSpOoNJrDZzSAIeOp2LrhoUMQzcepDayORyoU04TDBScv/ 9X1kk02S95m0EotJLtdfer0+O7aN3k9CUmZ4zlKu4q/f2JMsRlQC0jzZNdcxxO7s2l 0kZkmoah/UHYPpBPI/23fqgxsy27QnWQVoToOiYvlXmepnwDAn4NvsE3yXFk+SZdQh X+muqectLw59Q== Received: by mail-lf1-f54.google.com with SMTP id y28so94583263lfb.0 for ; Tue, 28 Sep 2021 10:00:02 -0700 (PDT) X-Gm-Message-State: AOAM530xYwQNkdEQBleLX59NDDkLtRyn+X9km4hRanlAIH1R4QaujpVz uAp6zIGul0tjEpidM0JaC6wpDE0+6+8auXp8rUI= X-Google-Smtp-Source: ABdhPJxY+7EIdyIqAHPL7HS8zvTNn2gElYimnSM6iaXJpYTEkKGO3fCLONhSZe9SIqGhVwfZnGJja/w17Fp28QsN9eU= X-Received: by 2002:a2e:7503:: with SMTP id q3mr1068082ljc.48.1632848400893; Tue, 28 Sep 2021 10:00:00 -0700 (PDT) MIME-Version: 1.0 References: <20210906121200.57905-1-rongwei.wang@linux.alibaba.com> <20210922070645.47345-2-rongwei.wang@linux.alibaba.com> <20210923194343.ca0f29e1c4d361170343a6f2@linux-foundation.org> <9e41661d-9919-d556-8c49-610dae157553@linux.alibaba.com> In-Reply-To: From: Song Liu Date: Tue, 28 Sep 2021 09:59:49 -0700 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH v2 1/2] mm, thp: check page mapping when truncating page cache To: Matthew Wilcox Cc: Rongwei Wang , Andrew Morton , Linux MM , Linux Kernel Mailing List , William Kucharski , Hugh Dickins Content-Type: text/plain; charset="UTF-8" X-Rspamd-Server: rspam01 X-Rspamd-Queue-Id: 77F7C90000AD X-Stat-Signature: 8hokd3cx8y8eyk5ucrkmqecxpbihfaxt Authentication-Results: imf28.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=Mrm3kuuR; dmarc=pass (policy=none) header.from=kernel.org; spf=pass (imf28.hostedemail.com: domain of song@kernel.org designates 198.145.29.99 as permitted sender) smtp.mailfrom=song@kernel.org X-HE-Tag: 1632848403-194516 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On Tue, Sep 28, 2021 at 5:07 AM Matthew Wilcox wrote: > > 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. > Yes, I was thinking about the same problem last night and this morning. Unfortunately, I haven't got a good solution yet. Do you have some suggestions on this? Thanks, Song