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 kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 96A24EE645F for ; Fri, 15 Sep 2023 14:21:23 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 0ECFB6B0374; Fri, 15 Sep 2023 10:21:23 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 09CF96B0376; Fri, 15 Sep 2023 10:21:23 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id EA7396B0377; Fri, 15 Sep 2023 10:21:22 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0016.hostedemail.com [216.40.44.16]) by kanga.kvack.org (Postfix) with ESMTP id D7D046B0374 for ; Fri, 15 Sep 2023 10:21:22 -0400 (EDT) Received: from smtpin07.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id A4305120A6C for ; Fri, 15 Sep 2023 14:21:22 +0000 (UTC) X-FDA: 81239044404.07.25E7782 Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) by imf08.hostedemail.com (Postfix) with ESMTP id 5A4FF16002B for ; Fri, 15 Sep 2023 14:21:18 +0000 (UTC) Authentication-Results: imf08.hostedemail.com; dkim=pass header.d=infradead.org header.s=casper.20170209 header.b=ZAFN3W4n; dmarc=none; spf=none (imf08.hostedemail.com: domain of willy@infradead.org has no SPF policy when checking 90.155.50.34) smtp.mailfrom=willy@infradead.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1694787680; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=HhqRWnfOFQmhtzhnv8gfqh6lm+Imi8Fsr7KKLz7N0CA=; b=oh4fuRsaNrcsdSiB+eAg2IFsBnDiviIy8dQ0mTtyLlzRp8QyC1i6jlGDYbDFhfQdHG0ggH 3kYwtLP5UHXeMVqzPrne0Nx1PD7px3O1KUYxs5tpRK0JraAc7+ddiXhAL/8dc5aZHYdIwZ 0gK9IxTqi6uly45U2UmHL4XBnM6XZac= ARC-Authentication-Results: i=1; imf08.hostedemail.com; dkim=pass header.d=infradead.org header.s=casper.20170209 header.b=ZAFN3W4n; dmarc=none; spf=none (imf08.hostedemail.com: domain of willy@infradead.org has no SPF policy when checking 90.155.50.34) smtp.mailfrom=willy@infradead.org ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1694787680; a=rsa-sha256; cv=none; b=JGHqt07l/n41l/yK53Ujzw74/1ocDkGlKd3sbTU6bqFfDmhLdC33TadjWk5OiOjjE2eiDV HIOyHl/RhPmPh4r4cHZe4Ae3KOQPy4VLwvXn8hfoKYvI/ylpvTiQ2kHpeGKduCBZlmcycP x/SSPYfW18oaWW8mFr460CNLRAejVog= 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-Rspamd-Queue-Id: 5A4FF16002B X-Rspam-User: X-Rspamd-Server: rspam02 X-Stat-Signature: 9eogkhaanuysfjwrthsocjt4dsp5t8dn X-HE-Tag: 1694787678-940598 X-HE-Meta: U2FsdGVkX1/PYuOLTYB3LBRmhO4YA38bm0eAtzVZCEgAZofNQfMX8WtAT+IwYvCbjnpdcNToTW9zQBKalXwnfT/xB2X53kl8AbtNL2fDjzyyM8bUNQZlsqYjkwAjdG38mRYRuOUt/zfBeAHRb8VeJjagV8/Iw+Djr+J5bFJQKUxjTM6l1hCjK5MXN5JvDhuHaypdpoOXY+U9lbVD8FqsPie+bypTmEhAY76h6uzwwSZBzp7E6MJuTJWqarf9Vu6grFgAFICe9b8FAPdYZJ4aa8kdMFFGEntxWfl1zysac2ApqqVrnnRpiYPdzVwkl6cw3sNEGJIPWiN990l4WA76RDXvRDno/7HPSeVf9E+eC0TwDLc4HDoOOEVGvPY0WsCpd8UmYSVqwfi4IP884vqoBD1wqv1WzvJioA/24FyjJNURGPCjzq7jpvA+UYyunPMHzMwKjBrcC0qMnQND9YJJmWlxnPd/j695ZbhBkdkFJ80sDfXQXOs8ju3fbzGxubB1yvcPZVd90BYMwEtFCWXKvNy3JjeBBFDHDX+IqonbF7mm2Ad6WDrzud+L2voZPCxiv1thf6CpfT1wAanUyVeb17Gy6L3ribSuo8ElTcsGE7dmrCF/pBjwtn/NH6MPbC2wcmVYpyYMn9Wlp6qWpRFOWmVt/kwq2OxTXJI/WTMKgPwV7gc8Ut/QRCq5tVKfnQ0wz1frZcmE5RPLvHezRMvAK+NIK3X4QYBgaE0Jwdbwbs/+LP3zaBePMizM8sWh0eHDfX0FLMQKDeSC5rtcGf7do77YxtAGMVlqiPmLGSQYvY0YEciyVJDWLMW6AV6dn+DNF0SzUVsir8iNabLsBo9Kw16vY9ZpjZPQLPqO1TVZXhdkgxt0jzHsRueBMacZ6Y5UAJYoX2NgHaOKsYo8vUbOOKGGxDa7BsagSbgywuN48w/FzKXogh0gMv9xUfVyr7qisrJ0+1t9+EjSWy435q4 dkd7c9p1 Zja/Ad/w7LHwd37S2NuuI5D7/vJKnMbHXOVtrGMFelkN8RDGDDQhnehmrpe7vpIaIBTYcZvsbewfRmMYWKLpZxf6r7G5a8zfLbMUSDJU+SZjQ018AOjl0+KWj4aa2TYOSjvSMMuRi4I3YouQ= X-Bogosity: Ham, tests=bogofilter, spamicity=0.000006, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: 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?