Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp389998pxb; Wed, 22 Sep 2021 04:41:26 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyUENwSLAQsIZcUSCJuzYEZYJUN93dxTZMFfnq1YDdXBSrAWcXiFBDfAVTbTdB12X0j93DM X-Received: by 2002:a05:6602:2cc5:: with SMTP id j5mr3975245iow.156.1632310886035; Wed, 22 Sep 2021 04:41:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1632310886; cv=none; d=google.com; s=arc-20160816; b=P3dxiQee1bs7CtWLyXFEsCYwTwM5VI2TtNK3h70oS7j6cyP+PK/BttMqcmJJ5+O1xr AoB66F4qGOAbof6hb/EpS/G18k2ZGWW/Aqio5ycNcbz+RotMgUR6O0IOqasmlV3dq8Ui PuREbx1hdRPkuZ/a4BqbH1TGzh9Ttp8YBRCVxKq0QMFTV2OXw44i0iZI4MORdRc+9OdU 3aqBYFhYYue43D0tjR/F6SKWrCC+2XLtdQkZgBc4B7U86athdGNr9o8lQ4Ius/x3vLNc t5wIybhV4BWtoen+OsEXnkKMzH80+d4XOnSYI83Ac0yUVWDuxzJgR7D3HDc+Fp1dWDMJ zbhQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=tZq1SReOZM5no9c+5zSUWDpuhZmax+sW5KT+xZkE3Ks=; b=pB9/m2fMcmcv75mfp7TdBHbltDxiDBxHYOcJJWx0p7BveMUFxeMHv49Ct24AvkOJod 4AqKMfj4a14aNVec+Xo6izd3ImXG+6t4oTQ6XR+KGMfu7ybYnUU9oVg5yEcz5CylvdAz RAPYjikQO3LLMDMGYJrxxr35e5DYmyGkH+o63rXof67ApvZcriU7p6R4O+k0/Qtr7hjq bacUeQYH1WJUY2BJYS3WQLIC7r1R9uMCq/hE1JEb41kbqv8Qb9OmdSWj8030U9KHIcss 2tq6ii2HWMVGHdU9M6NUkhIIeadiDoKzUDFW1N1fHa0bDYtYe3yixmI3hTV5dTsJywdr CdwA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=c3sp06S4; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id z22si2807199jan.63.2021.09.22.04.41.14; Wed, 22 Sep 2021 04:41:26 -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=@infradead.org header.s=casper.20170209 header.b=c3sp06S4; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235730AbhIVLlA (ORCPT + 99 others); Wed, 22 Sep 2021 07:41:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45054 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230171AbhIVLk7 (ORCPT ); Wed, 22 Sep 2021 07:40:59 -0400 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DAA80C061574 for ; Wed, 22 Sep 2021 04:39:29 -0700 (PDT) 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> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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/