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 X-Spam-Level: X-Spam-Status: No, score=-3.6 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 67CBFC433F5 for ; Wed, 22 Sep 2021 11:38:51 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id F330260EE7 for ; Wed, 22 Sep 2021 11:38:50 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org F330260EE7 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=kvack.org Received: by kanga.kvack.org (Postfix) id 8D9426B006C; Wed, 22 Sep 2021 07:38:50 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 83ACA900002; Wed, 22 Sep 2021 07:38:50 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 703696B0073; Wed, 22 Sep 2021 07:38:50 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0218.hostedemail.com [216.40.44.218]) by kanga.kvack.org (Postfix) with ESMTP id 5F9186B006C for ; Wed, 22 Sep 2021 07:38:50 -0400 (EDT) Received: from smtpin04.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id 2002E30177 for ; Wed, 22 Sep 2021 11:38:50 +0000 (UTC) X-FDA: 78615012420.04.5CE789A Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) by imf07.hostedemail.com (Postfix) with ESMTP id E03341000098 for ; Wed, 22 Sep 2021 11:38:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=tZq1SReOZM5no9c+5zSUWDpuhZmax+sW5KT+xZkE3Ks=; b=c3sp06S44e4D61s4gSsvVhM9FV hUf+CAxIT07xY031PRLyOqrgPpVvIKzlwjETkpxRCeuTQ+FcfBr6Ucj4uxXoz0fbKdknBJDM60yt2 NbmgG7fstVOGLJGZJ+0nufBPsR50dBPQKIoIYm3FPd6ubN68qQauA9BYuRL4eYHbDw1BAO45bRq0E qMFN2tON9yTv4mhrErucP81OrVcMbZxZfM31lIBWNxRmB1SVybEiuVuhThqoc0sxYf3Z+cW+t6dHk QhJPOrGIE6W8xtG3NIkkR6rlrl/5n3nYF5Cdpqb/OW8i1yWChj+Bmw0D5ILj/EnCc1Gjh7wYb0KWt bCq8B3OA==; Received: from willy by casper.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1mT0Yy-004jv5-N5; Wed, 22 Sep 2021 11:37:36 +0000 Date: Wed, 22 Sep 2021 12:37:20 +0100 From: Matthew Wilcox To: Rongwei Wang Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, akpm@linux-foundation.org, cfijalkovich@google.com, song@kernel.org, william.kucharski@oracle.com, hughd@google.com Subject: Re: [PATCH v2 1/2] mm, thp: check page mapping when truncating page cache Message-ID: References: <20210906121200.57905-1-rongwei.wang@linux.alibaba.com> <20210922070645.47345-2-rongwei.wang@linux.alibaba.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210922070645.47345-2-rongwei.wang@linux.alibaba.com> Authentication-Results: imf07.hostedemail.com; dkim=pass header.d=infradead.org header.s=casper.20170209 header.b=c3sp06S4; spf=none (imf07.hostedemail.com: domain of willy@infradead.org has no SPF policy when checking 90.155.50.34) smtp.mailfrom=willy@infradead.org; dmarc=none X-Rspamd-Server: rspam06 X-Rspamd-Queue-Id: E03341000098 X-Stat-Signature: xodkq67kju1kt1ctkowcudwc7bx7o8kw X-HE-Tag: 1632310729-451488 X-Bogosity: Ham, tests=bogofilter, spamicity=0.176825, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On Wed, Sep 22, 2021 at 03:06:44PM +0800, Rongwei Wang wrote: > Transparent huge page has supported read-only non-shmem files. The file- > backed THP is collapsed by khugepaged and truncated when written (for > shared libraries). > > However, there is race in two possible places. > > 1) multiple writers truncate the same page cache concurrently; > 2) collapse_file rolls back when writer truncates the page cache; As I've said before, the bug here is that somehow there is a writable fd to a file with THPs. That's what we need to track down and fix. https://lore.kernel.org/linux-mm/YUdL3lFLFHzC80Wt@casper.infradead.org/