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=-3.6 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS autolearn=no 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 0653EC2B9F4 for ; Mon, 28 Jun 2021 15:45:52 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 58CCA619A0 for ; Mon, 28 Jun 2021 15:45:51 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 58CCA619A0 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 694CB8D0060; Mon, 28 Jun 2021 11:45:50 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 644D08D0016; Mon, 28 Jun 2021 11:45:50 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 4E65D8D0060; Mon, 28 Jun 2021 11:45:50 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0225.hostedemail.com [216.40.44.225]) by kanga.kvack.org (Postfix) with ESMTP id 252D98D0016 for ; Mon, 28 Jun 2021 11:45:50 -0400 (EDT) Received: from smtpin37.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id 0F872181AEF23 for ; Mon, 28 Jun 2021 15:45:47 +0000 (UTC) X-FDA: 78303557934.37.B02BA6A Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) by imf21.hostedemail.com (Postfix) with ESMTP id A151FE0004C9 for ; Mon, 28 Jun 2021 15:45:46 +0000 (UTC) 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=7p3ZErU459kzXpwH69SdGsHIsa2wrWdtYOXOZ1fJP8c=; b=JhRzUPgcCrJIWJsK3FwDl0OlPC X+8ZgMfTejZ3tHRU44TZQdOdnLkKkTdmSZvTZ8K0oFpaMQFONI6TjeIjj+ZBbqZfz/ehfbrk9s88m +QFPdPYbMAqlrHAhxkgggEuA9q7JD87ntSum7R8qJ22YbMvQ46Rp3S5wrzRZNvjXLJmFBmrXIqNDD bExBPBzhsDVegpzJnTcncBgRMPniX/b5zSsCRqe4VG4lpBVH6AKs0CKHY/ARoyI3KuxVkTquY0J01 WCmwt/ewf58/duMqTFgzOidkw0gjQMIiclqJzKDbCwBwK304VeCqX19HaGG9SLwvTjBvs64hDcDom Ve7nkdZw==; Received: from willy by casper.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1lxtQ3-003BkT-Qc; Mon, 28 Jun 2021 15:43:41 +0000 Date: Mon, 28 Jun 2021 16:43:31 +0100 From: Matthew Wilcox To: Christoph Hellwig Cc: akpm@linux-foundation.org, linux-fsdevel@vger.kernel.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v2 27/46] mm/writeback: Add __folio_mark_dirty() Message-ID: References: <20210622121551.3398730-1-willy@infradead.org> <20210622121551.3398730-28-willy@infradead.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Rspamd-Server: rspam01 X-Rspamd-Queue-Id: A151FE0004C9 Authentication-Results: imf21.hostedemail.com; dkim=pass header.d=infradead.org header.s=casper.20170209 header.b=JhRzUPgc; spf=none (imf21.hostedemail.com: domain of willy@infradead.org has no SPF policy when checking 90.155.50.34) smtp.mailfrom=willy@infradead.org; dmarc=none X-Stat-Signature: g51kwdw4ojfrrbgi3tzj8bctr6qp4kjg X-HE-Tag: 1624895146-597388 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 Mon, Jun 28, 2021 at 07:03:26AM +0100, Christoph Hellwig wrote: > On Thu, Jun 24, 2021 at 07:37:30PM +0100, Matthew Wilcox wrote: > > On Wed, Jun 23, 2021 at 11:27:12AM +0200, Christoph Hellwig wrote: > > > On Tue, Jun 22, 2021 at 01:15:32PM +0100, Matthew Wilcox (Oracle) wrote: > > > > Turn __set_page_dirty() into a wrapper around __folio_mark_dirty() (which > > > > can directly cast from page to folio because we know that set_page_dirty() > > > > calls filesystems with the head page). Convert account_page_dirtied() > > > > into folio_account_dirtied() and account the number of pages in the folio. > > > > > > Is it really worth micro-optimizing a transitional function like that? > > > I'd rather eat the overhead of the compound_page() call over adding hacky > > > casts like this. > > > > Fair enough. There's only three calls to it and one of them goes away > > this series. > > The other option would be a helper that asserts a page is not a tail > page and then do the cast to document the assumptions. btw, every call to folio_flags() checks !PageTail: struct page *page = &folio->page; VM_BUG_ON_PGFLAGS(PageTail(page), page); now, that's not going to be turned on for regular builds, but it does give us a _lot_ of runtime assertions that somebody hasn't cast a tail page to a folio.