Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp5077182pxb; Tue, 28 Sep 2021 10:03:19 -0700 (PDT) X-Google-Smtp-Source: ABdhPJymjGZFhYBCK7iJ2fzr6weIYfcQf7UMZPKcQumirf93LaOcwColcSJVWdLS5EoQHhmYdOcy X-Received: by 2002:a17:902:7e05:b0:13d:e01a:be5f with SMTP id b5-20020a1709027e0500b0013de01abe5fmr5702502plm.56.1632848599472; Tue, 28 Sep 2021 10:03:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1632848599; cv=none; d=google.com; s=arc-20160816; b=bveqLLEWXa/Ssd2Hv81GMUJ9C71hbixMpGEA73MSnj/fLVjbouDPiF80E2qcGclxPT 73l7YIJb0jzjUAYtyRF6obKRiThvSiCUhgkdrss9ryLIMWIao6B6QztpuFisFZWrV8EB vVx/qBT6KvJobNCJEX/RCc9AkkF0yLlgrYFJFLU5PxVPmkLDOROSgC4gf8iUwLEcZVDb 2DE51kE13et9fqHg0inLWaCOlt73jN/5jSbQaTdpR1N1WO4vsk9zuKWJ8M8BE5avWV09 2txhIDyh+WIaaih7QFuyOJiWqhTgy2rsuXxHGuPDdI/zUidVULtOG5+v/3u0LgZfF7fh oYUg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=mrovyevhFGG1CKNIUweYPBLRzjVMSTjKwCCATnFdKRk=; b=MlYyUWvOYDCNEcWliKOOimk4bu8eIOzDNrEI/7UogxPD49DokS7lBitaQ7/s9NxZBe LOzoWuQQWAx5UWsOH1KZZGVz5b37SsLE7/duvlAISqmV7IKx9zctVVk1lql8ud+GvWRq CwCWkVv/Ytrju44xiXTq7D+ptVtey+fntQwNDVRGmYeQ2bh4xq/RTRpODNIECY+W/3zh S5CuKw/TUdtiQvHrJ/me5IZ/I6T6rkYUix5HYOQcgeTaL1clHAEszz5XVRG4cMhvYEdN 238GK8T0ia62unGOauFPE7Jr3A9pYMLZvvI3vsHvbaPzBAcyNfuAtdWgbbwON2cJgrKu zmjw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=Mrm3kuuR; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id q4si26113476pln.35.2021.09.28.10.03.00; Tue, 28 Sep 2021 10:03:19 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=Mrm3kuuR; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241939AbhI1RBn (ORCPT + 99 others); Tue, 28 Sep 2021 13:01:43 -0400 Received: from mail.kernel.org ([198.145.29.99]:47064 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241907AbhI1RBm (ORCPT ); Tue, 28 Sep 2021 13:01:42 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id A0DC361352 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-f42.google.com with SMTP id y28so94583271lfb.0 for ; Tue, 28 Sep 2021 10:00:02 -0700 (PDT) X-Gm-Message-State: AOAM530uO5iCxeRbmMU5h7GPf44tPnRhJD4kXyY/BXgtBNXeYTC6GBwB IB/HzyBopZZkzUXLKbkoV9lTYFPfMGDUGdCowRE= 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" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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