Received: by 2002:a05:6a10:d5a5:0:0:0:0 with SMTP id gn37csp510703pxb; Thu, 30 Sep 2021 10:42:10 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxD4SRP/lJvR7346ZbMuiItimmWhZRV1L1Lbh3/Uc6GqFqxT5Ww5vTcgpIYc/sjQQR1DXnD X-Received: by 2002:a17:90a:1610:: with SMTP id n16mr14351290pja.59.1633023729996; Thu, 30 Sep 2021 10:42:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1633023729; cv=none; d=google.com; s=arc-20160816; b=CZVPbC66Hzs2scdE1WRPuRo0/woIAU6/GStaKjAnByRkSGJrrMZzcZmXVbc0WWph9d /avraJJ89DmURo1pehh0PFRCt5VTmU6ZFD3PX5eVCKg3ZskjLpmwM1JUg4NLb6QJu+aD b1W9N4+qzDYVJowA8u/2fh46MZ1iddZ+GBj9AToIuXlbbmO1pHDrFmuWX1X4MozffKJc jWJ8+QHOZA+cLM61lBROtuESVzG0h0EUsq6i7eshb5VBDzUZPBQhq/XTRgDSp1ABYhca EQxtyZPBMQaF26+9hd+bRK0lNFdsDRpB4SymGtqJQzvkGpzS4DnXEWKWNNYiuRQGzn3e 2FYA== 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=wBFXHARFQ6BmCFJJOsLjYh6MCL2g45Z1Rh5ubIbYOmI=; b=wqdByoKtiIA/2OoCfWWTT9Df1UJ1smmj/hPVMZUB1nSyrg5X4nxciuQLxGbFxwzNcI x3Q70cKrQXnDnA2ruvweHITtRbuiAPVN7Yn8wp3/tiaVdEo2oLyVfZQ6tyLwwglVnRs0 3pxL6zv1jDNTV3INQ2I8ATN+0MW26/SHopHIrYGqdc3DJxWXe/5IMQYinjv3DYV8hg0V bc8T8GSi59rmhlLGm/v1ciPf7lkMi5FfWBNT/ROLR2T8EmhacVhN2MDWy6nJeK8FKYat pHgN5XkNwEtUSqpqTT9P+Rjs0IVKVPnDviuAooPFHi6OEOfHUOvnGNc7Lrn+Vi86TI4O hhbQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=V97LYSYI; 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=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id h3si4474770plb.88.2021.09.30.10.41.43; Thu, 30 Sep 2021 10:42:09 -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=@gmail.com header.s=20210112 header.b=V97LYSYI; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1352775AbhI3RlL (ORCPT + 99 others); Thu, 30 Sep 2021 13:41:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52950 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1352722AbhI3RlK (ORCPT ); Thu, 30 Sep 2021 13:41:10 -0400 Received: from mail-ed1-x52d.google.com (mail-ed1-x52d.google.com [IPv6:2a00:1450:4864:20::52d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B4109C06176A for ; Thu, 30 Sep 2021 10:39:27 -0700 (PDT) Received: by mail-ed1-x52d.google.com with SMTP id b26so25273355edt.0 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=6GsXh5cpTSvDoRNFZNpVeBSmJpVUccVAyqrxipzxO2JW03NzmpAUJ1CufDuQnbbiSU HgkWF59juy/+Wi6IA3H+wqZGJfExWtdajUbVFKLA8aRxRRaGJvMhAyPVShWsyHEnsAjz SiPHo+i6DBk8j8PiAnPsqLF8LzM8Iwxxvd53gTU18oMbKBSVfbQCPyvjCIz3+6naRoiy DN3FJgafjNeiprs1MxxcTLan+3NyLyb7Iubfskr8toQ1R1gbrqw4D/peDQnAionyRLmT fse4XIcB3HBhVgMavE8gM27DK8jdDT5PPFzRpZ/MtCjtKSpdBXxz9LLFXuJk8Pu9n7t3 C67A== X-Gm-Message-State: AOAM533QNgUtyDgBGLMDDycqy2a5UXptMChA/qu7tgLYN4EbtOcyI0TK gsrWo3iYsTWKsANzoOixLVdAwmkkFNmPY8Rgo7U= 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" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 >