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 8A5E7C433F5 for ; Thu, 30 Sep 2021 17:39:29 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 1969761439 for ; Thu, 30 Sep 2021 17:39:28 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 1969761439 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=kvack.org Received: by kanga.kvack.org (Postfix) id 37AC79400C0; Thu, 30 Sep 2021 13:39:28 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 32AA994003A; Thu, 30 Sep 2021 13:39:28 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 1F1CE9400C0; Thu, 30 Sep 2021 13:39:28 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0020.hostedemail.com [216.40.44.20]) by kanga.kvack.org (Postfix) with ESMTP id 0DFBB94003A for ; Thu, 30 Sep 2021 13:39:28 -0400 (EDT) Received: from smtpin10.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id A2C3530C88 for ; Thu, 30 Sep 2021 17:39:27 +0000 (UTC) X-FDA: 78644951574.10.AE2D46B Received: from mail-ed1-f49.google.com (mail-ed1-f49.google.com [209.85.208.49]) by imf20.hostedemail.com (Postfix) with ESMTP id 6D649D000465 for ; Thu, 30 Sep 2021 17:39:27 +0000 (UTC) Received: by mail-ed1-f49.google.com with SMTP id r18so25024135edv.12 for ; Thu, 30 Sep 2021 10:39:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=wBFXHARFQ6BmCFJJOsLjYh6MCL2g45Z1Rh5ubIbYOmI=; b=V97LYSYIBz7qx56yMPIZqCCA22l4dW7pVidzju2hYTNnI3GhkxlLFTx3AL6I3Pk+dt IVsI1mG5mgJ5hkVv+qllmTjeCuWU/PK6yMiPLp52Y4Akg/UHBEDm/7Bbi+AaAF9gwlIt t34p8QTgY2PPL8O4sNJuLp3nw+92rgzsbk6gZS/J+QeAl6u2T+QdADs7DYHT8Ocdk8Os XcXpz0RGMvNbswAzbD6anG9IwXM3u3SxL8A6YmpctGUPLFuT9kILdYrhn/+Fx7V2uS2a +t6UNkq9sFE99cDLgeVgVMMksTk2yKxzqtA1CPYP1c7nU5xfBti4iB6XJrV3ae+/wmw5 dYFw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=wBFXHARFQ6BmCFJJOsLjYh6MCL2g45Z1Rh5ubIbYOmI=; b=hRPuQBmlww/w+FSUiYXCWfUMN8i7OyOgvf9aZ2QUJVFBePbT4w7DGJ+Tz0tnkQ0FL+ xWVNFup01vmlwV7BooyKX3IUCP9gIBU23Ch+ss5QtE6FXuJnavHTMPuiSt7pmuVB4emN AdcjvBBBNqd4fXjVjpAD/bm3HsFSWVW8L3EGRNWdoBvb33Lz22wVSAeHtnO52i1yTY26 8js6AE+nX1+H/nHS27R9/JUwULYlJLngfvsBjyGeln4L+CkQZwX/5LB5pjQFrJjRbARq mHMXByFdUtSDLbRIsC5xlBX2G+gh8HgqXscWxkP4Bqty+3ql3h0Dqowi4i40+UP/3d5C JjuQ== X-Gm-Message-State: AOAM531Ef+fBuYtSsXFhZs0GXMwV/f2S7grTi5HN7HJdd+rj2XbdwoGx GypGCvM69AvOiJHkpJkMZzf570CwxsucWc0b9qY= X-Google-Smtp-Source: ABdhPJzG7awZ4BvsrrS64zuGfGd3yEJCDW2Wup/jcoQSvyxqmsIrjCSF48wYWFfCZsLcUvTmnrbW0XTrL5Ddvhd/BBI= X-Received: by 2002:a50:8d85:: with SMTP id r5mr8583604edh.312.1633023566307; Thu, 30 Sep 2021 10:39:26 -0700 (PDT) MIME-Version: 1.0 References: <68737431-01d2-e6e3-5131-7d7c731e49ae@linux.alibaba.com> <67906bf5-4de9-8433-3d70-cc8fc5cc2347@linux.alibaba.com> <3d264ed9-f8fd-60d4-7125-f9f745ebeb52@google.com> In-Reply-To: From: Yang Shi Date: Thu, 30 Sep 2021 10:39:14 -0700 Message-ID: Subject: Re: [PATCH v2 1/2] mm, thp: check page mapping when truncating page cache To: Hugh Dickins Cc: Matthew Wilcox , Song Liu , Rongwei Wang , Andrew Morton , Linux MM , Linux Kernel Mailing List , William Kucharski Content-Type: text/plain; charset="UTF-8" X-Rspamd-Server: rspam05 X-Rspamd-Queue-Id: 6D649D000465 X-Stat-Signature: 34fznayq1eqki5wsyet4ti18ndc77huc Authentication-Results: imf20.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=V97LYSYI; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf20.hostedemail.com: domain of shy828301@gmail.com designates 209.85.208.49 as permitted sender) smtp.mailfrom=shy828301@gmail.com X-HE-Tag: 1633023567-861202 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 Thu, Sep 30, 2021 at 9:49 AM Hugh Dickins wrote: > > On Thu, 30 Sep 2021, Matthew Wilcox wrote: > > On Wed, Sep 29, 2021 at 10:24:44PM -0700, Hugh Dickins wrote: > > > > > > Aside from the above page->index mischeck in find_lock_entries(), > > > I now think this bug needs nothing more than simply removing the > > > VM_BUG_ON_PAGE(PageTail(page), page) from truncate_inode_page(). > > > > I don't think that's right. This bug was also observed when calling > > truncate(), so there's clearly a situation where two concurrent calls > > to truncate_pagecache() leaves a THP in the cache. > > I assume you're thinking of one of the fuzzer blkdev ones: > https://lore.kernel.org/linux-mm/CACkBjsbtF_peC7N_4mRfHML_BeiPe+O9DahTfr84puSG_J9rcQ@mail.gmail.com/ > or > https://lore.kernel.org/lkml/CACkBjsYwLYLRmX8GpsDpMthagWOjWWrNxqY6ZLNQVr6yx+f5vA@mail.gmail.com/ > > I haven't started on those ones yet: yes, I imagine one or both of those > will need a further fix (S_ISREG() check somewhere if we're lucky; but > could well be nastier); but for the bug in this thread, I expect Makes sense to me. We should be able to check S_ISREG() in khugepaged, if it is not a regular file, just bail out. Sounds not that nasty to me AFAIU. > removing the VM_BUG_ON_PAGE(PageTail) to be enough. > > If you're thinking of something else, please send a link if you can - thanks. > > Hugh >