Received: by 2002:a05:7412:31a9:b0:e2:908c:2ebd with SMTP id et41csp4634999rdb; Fri, 15 Sep 2023 08:01:49 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHA1bZc3Xl9qXNOJGWidcEyzdULL3Pk4vVJNipbyLgBN1/3B4Fb6lDOlb9vKqVyy9UKoXV+ X-Received: by 2002:a05:6a21:778b:b0:13c:988c:e885 with SMTP id bd11-20020a056a21778b00b0013c988ce885mr1862250pzc.56.1694790108586; Fri, 15 Sep 2023 08:01:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1694790108; cv=none; d=google.com; s=arc-20160816; b=K9uz/vfG5oUISSRBPcmJKNb9H3fgIozqJxA5KPUqHZzyDlfikP1JQL3UqgxFVEE5Mq 2ahKaUoDYOnyRwIrPqA1uQmrSznoQMSAaVTSTbwQweK9gexbdcpR/VM0nmmnU7bMZ2DJ Z7pk9YYPnzmIRt+TQzoI372XAqavvsXHtKcfMA6tOtiB0/kMQHEqGg8TjowtR9/+DWbh 7Ac2OHYTwuFFFPEzQhg0jtsurjO00iIWuNZzpW5qxAmH30TjrvgZsGN6ZioLLjxrjoJ8 KHLuOD+XViSRc54ujh3g9H3EAvdA8nR0BraND0UJ6VPM7IpH7g5DegXbl0fVxq4GmTuo bXvw== 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=HhqRWnfOFQmhtzhnv8gfqh6lm+Imi8Fsr7KKLz7N0CA=; fh=jSY7VpgM37G2LEVBv7cu9ZuepjPVHSg2+7DB+PWiq/Q=; b=pFQ/xVS0tEWBjZNe82fieMePpOjZT/Migyy/36UNVVBufJ2Tm2YEzTZ1ZdQUlCCy6a dDa+jIZhoTaaea4ATAxQULRhK+TkrxZEZ9pWC8s89jPN7AASHPKqs+sfdM4LCCWnX0lN Xvwelg9ZlKC0t+IdEO52KpbOXhxNpC2rU/U6FnL88tJmQGLYlxB2sxP/90N0tgOREv2E CunCTUaSf5LJ6qf7yAEe4ArLNepLCzSQ2yE6smChdLnPFveoIJSKLEmCSQMah9xCkm3T aGF2nLYVb+Izx2U1sf+fsuDPrAwA80KHCgYXjMkKxzvZ+lbQRhVW71CSZhYcL98AvW58 JQNQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=ZAFN3W4n; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from agentk.vger.email (agentk.vger.email. [23.128.96.32]) by mx.google.com with ESMTPS id i66-20020a636d45000000b00577f4d85fd7si3279406pgc.316.2023.09.15.08.01.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 15 Sep 2023 08:01:48 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) client-ip=23.128.96.32; Authentication-Results: mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=ZAFN3W4n; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by agentk.vger.email (Postfix) with ESMTP id 4878B80C2553; Fri, 15 Sep 2023 07:21:38 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at agentk.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235593AbjIOOV0 (ORCPT + 99 others); Fri, 15 Sep 2023 10:21:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46326 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235323AbjIOOVZ (ORCPT ); Fri, 15 Sep 2023 10:21:25 -0400 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9BAEEF3; Fri, 15 Sep 2023 07:21:19 -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=HhqRWnfOFQmhtzhnv8gfqh6lm+Imi8Fsr7KKLz7N0CA=; b=ZAFN3W4nMASD2f9xgs7ZQX6ljK ZE54cWK5jw2+Sxw46PIOJA0UT2U5uUkdTZr2k8KtDrXX41eNaAyPpkouQr6gf2KB8iRM8JlWgsjPq t5J8O6xrgRo4ZmbpLLDrG0qoZub5CnCxyF7xiWItr/5duXyu508Qh+WsEzlNdenRG20Q1ZqBJGjrT P3pHnkskJkhMaKdgyszIiS2taMgR4RYA9tvPdRy46Qyos8b+Pf1/YITWhln/UD8jr6YsVX77kS86O Jfgys6odI16/xcwKtGf2mj3NH9cxT2EOf0oVU6upGq60J67ibRP5ZTz6zAZLmzeIzhKi8c1Z+62nx ZyxDzIsg==; Received: from willy by casper.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1qh9h3-00ACmq-G6; Fri, 15 Sep 2023 14:21:13 +0000 Date: Fri, 15 Sep 2023 15:21:13 +0100 From: Matthew Wilcox To: Hugh Dickins Cc: Jens Axboe , Andrew Morton , "Kirill A . Shutemov" , Hannes Reineke , linux-mm@kvack.org, linux-block@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, stable@vger.kernel.org Subject: Re: [PATCH] block: Remove special-casing of compound pages Message-ID: References: <20230814144100.596749-1-willy@infradead.org> <94635da5-ce28-a8fb-84e3-7a9f5240fe6a@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <94635da5-ce28-a8fb-84e3-7a9f5240fe6a@google.com> X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on agentk.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (agentk.vger.email [0.0.0.0]); Fri, 15 Sep 2023 07:21:38 -0700 (PDT) On Wed, Aug 16, 2023 at 01:27:17PM -0700, Hugh Dickins wrote: > > This problem predates the folio work; it could for example have been > > triggered by mmaping a THP in tmpfs and using that as the target of an > > O_DIRECT read. > > > > Fixes: 800d8c63b2e98 ("shmem: add huge pages support") > > No. It's a good catch, but bug looks specific to the folio work to me. > > Almost all shmem pages are dirty from birth, even as soon as they are > brought back from swap; so it is not necessary to re-mark them dirty. > > The exceptions are pages allocated to holes when faulted: so you did > get me worried as to whether khugepaged could collapse a pmd-ful of > those into a THP without marking the result as dirty. > > But no, in v6.5-rc6 the collapse_file() success path has > if (is_shmem) > folio_mark_dirty(folio); > and in v5.10 the same appears as > if (is_shmem) > set_page_dirty(new_page); > > (IIRC, that or marking pmd dirty was missed from early shmem THP > support, but fairly soon corrected, and backported to stable then. > I have a faint memory of versions which assembled pmd_dirty from > collected pte_dirtys.) > > And the !is_shmem case is for CONFIG_READ_ONLY_THP_FOR_FS: writing > into those pages, by direct IO or whatever, is already prohibited. > > It's dem dirty (or not dirty) folios dat's the trouble! Thanks for the correction! Could it happen with anon THP? They're not kept dirty from birth ... are they?