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=-11.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,UNPARSEABLE_RELAY,USER_AGENT_GIT autolearn=ham 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 8B28EC433F5 for ; Mon, 6 Sep 2021 12:12:21 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id F16D160F43 for ; Mon, 6 Sep 2021 12:12:20 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org F16D160F43 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linux.alibaba.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=kvack.org Received: by kanga.kvack.org (Postfix) id 71D35900002; Mon, 6 Sep 2021 08:12:20 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 6CC886B0073; Mon, 6 Sep 2021 08:12:20 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 5BC1A900002; Mon, 6 Sep 2021 08:12:20 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0162.hostedemail.com [216.40.44.162]) by kanga.kvack.org (Postfix) with ESMTP id 49AE06B0072 for ; Mon, 6 Sep 2021 08:12:20 -0400 (EDT) Received: from smtpin33.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id 04E93181D396E for ; Mon, 6 Sep 2021 12:12:20 +0000 (UTC) X-FDA: 78557036040.33.D1B1E47 Received: from out4436.biz.mail.alibaba.com (out4436.biz.mail.alibaba.com [47.88.44.36]) by imf24.hostedemail.com (Postfix) with ESMTP id 2031BB0000A3 for ; Mon, 6 Sep 2021 12:12:18 +0000 (UTC) X-Alimail-AntiSpam:AC=PASS;BC=-1|-1;BR=01201311R121e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=e01e01424;MF=rongwei.wang@linux.alibaba.com;NM=1;PH=DS;RN=7;SR=0;TI=SMTPD_---0UnRyn5B_1630930321; Received: from localhost.localdomain(mailfrom:rongwei.wang@linux.alibaba.com fp:SMTPD_---0UnRyn5B_1630930321) by smtp.aliyun-inc.com(127.0.0.1); Mon, 06 Sep 2021 20:12:02 +0800 From: Rongwei Wang To: linux-mm@kvack.org, linux-kernel@vger.kernel.org Cc: akpm@linux-foundation.org, cfijalkovich@google.com, song@kernel.org, william.kucharski@oracle.com, hughd@google.com Subject: [PATCH 0/2] mm, thp: fix file-backed THP race in collapse_file Date: Mon, 6 Sep 2021 20:11:58 +0800 Message-Id: <20210906121200.57905-1-rongwei.wang@linux.alibaba.com> X-Mailer: git-send-email 2.32.0 MIME-Version: 1.0 Authentication-Results: imf24.hostedemail.com; dkim=none; dmarc=pass (policy=none) header.from=alibaba.com; spf=pass (imf24.hostedemail.com: domain of rongwei.wang@linux.alibaba.com designates 47.88.44.36 as permitted sender) smtp.mailfrom=rongwei.wang@linux.alibaba.com X-Stat-Signature: f5t8ahgqjscub6xctdosfgx3fybur3sd X-Rspamd-Queue-Id: 2031BB0000A3 X-Rspamd-Server: rspam04 X-HE-Tag: 1630930338-641256 Content-Transfer-Encoding: quoted-printable 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: Hi, We found two bugs related to file-backed THP in our cases, recently. The two bugs rough description as following: 1) in truncate_inode_pages_range, subpage(s) of file-backed THP can be revealed by find_get_entry. 2) 'collapse_file' miss the pages which in writeback but no private. This situation will be triggered in XFS when block size is set to PAGESIZE. These two patchs mainly fix the above mentioned bugs, and have been tested in latest branch. Rongwei Wang (2): mm, thp: check page mapping when truncating page cache mm, thp: bail out early in collapse_file for writeback page mm/filemap.c | 7 ++++++- mm/khugepaged.c | 3 ++- mm/truncate.c | 17 ++++++++++++++++- 3 files changed, 24 insertions(+), 3 deletions(-) --=20 1.8.3.1