Received: by 2002:a05:6a10:f3d0:0:0:0:0 with SMTP id a16csp423456pxv; Wed, 14 Jul 2021 07:08:16 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwS6N38X6OmrvgLc835QkmhcrkdwY/4VMn3hdrc0TA1LfwsffdoC6TSoX6T+u/ByulTUZc2 X-Received: by 2002:a5d:644c:: with SMTP id d12mr12884501wrw.129.1626271696303; Wed, 14 Jul 2021 07:08:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1626271696; cv=none; d=google.com; s=arc-20160816; b=0Mvhw2sPxhOxSSlvQ2LvpKJPS2Rt5Bw71K3tD7vv/5NQQf4oJjQPrDj5o0NSCF39Iw G1eI51ipmQLqrY3vSvTaUBVVWHrtVwumRoyYYbw0TNYzeaWIc1P4sMgG9cYYXuYkbCFz w7U2StefPhDLf0JPSFzfix7fbXv77PhwBYHnLwZ0+4octpW3kAOl9JiwmKTe6RA81OGW E8uqJqBxtF58jBb24xgukpTl4XTAKNL/U/Uoi1/8zcjCShSHzl+StAxq2tuj15o0TMSK bfFReCaZJ/ORS0OQ0JaCNNQKdbp3nMNXViyIB/ar+jx61PlE1JgV943mxfI6JvXvUX5y m64A== 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=WOmlUxJ/fNDV743IUVs9ki0OfQCNwpCeAeNQZqslUxs=; b=LwJz0fMw+niXyQgTnmdJB9jkQo+bwMJvNjutGgp8ECQlLGq2BQe8AtlY3SSBRAE54+ iTzCFOF84BAFFVHPCrxmb2YW4GJJR9skVuuS0WK3aX7druY/IUY3vAlAx0XbrBqM+5ui fVRH6WVWaPF0caajdfNmpdp2N+Mv/oNI0Wnvr13yxFqliLYfcpnJe8+/WVl+r+yK/5bG 5OyxZil6erdZqC2hvGOAJND4d6DJ3Rv/CB3XE7TZBQHWlxDM53PwJaL9Ca3NA7gY4TU+ FRruXl8PxvtznKOiqhSHTPd+a91txajRsTphpTzp9J5+UHTgWiQz3riYBACrniSIzd3G TWiA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=JdFOgclV; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id bo23si2762191edb.343.2021.07.14.07.07.52; Wed, 14 Jul 2021 07:08:16 -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=@infradead.org header.s=casper.20170209 header.b=JdFOgclV; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239418AbhGNOHF (ORCPT + 99 others); Wed, 14 Jul 2021 10:07:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55350 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231543AbhGNOHF (ORCPT ); Wed, 14 Jul 2021 10:07:05 -0400 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 97C67C06175F; Wed, 14 Jul 2021 07:04:13 -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=WOmlUxJ/fNDV743IUVs9ki0OfQCNwpCeAeNQZqslUxs=; b=JdFOgclV2hYdDuLhl/7tmnxIFu Yp5ZTizwqbUY0ckDTQPlYCtnyqBsO3MjWmPfkjKm+Npgjro/enXyebDYDa9dlqu3NMlJgwWI2XvpR 0u3z1aZXDyCY4TdYOWutI2Jus3QPdOUwzDKRbTJd8WCEvDGSmwtH3rQtyYwo8BBdqAAveyQU3/rE0 HeXBJXKEJQ5V4qU1XExMKVeneNZEio4D66+f98O2u8nq5Y51mnpGl767Ulz23xswqEftIVEYK2QoC T4vsnvwyCxinQzcFv9Luugqi4hlmlyW/m7WBfamRk+mkJq0EV2LuBivg/g6jg0hcmloUSpNnhmfb1 zULYF3tA==; Received: from willy by casper.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1m3fUF-002GdH-Vh; Wed, 14 Jul 2021 14:03:48 +0000 Date: Wed, 14 Jul 2021 15:03:43 +0100 From: Matthew Wilcox To: Andrew Morton Cc: Johannes Weiner , Peter Zijlstra , linux-kernel@vger.kernel.org, linux-mm@kvack.org, linux-fsdevel@vger.kernel.org, Christoph Hellwig , Jeff Layton , "Kirill A . Shutemov" , Vlastimil Babka , William Kucharski , David Howells , Linus Torvalds , Hugh Dickins Subject: Re: [PATCH v13 010/137] mm: Add folio flag manipulation functions Message-ID: References: <20210712030701.4000097-1-willy@infradead.org> <20210712030701.4000097-11-willy@infradead.org> <20210713091533.GB4132@worktop.programming.kicks-ass.net> <20210713185628.9962f4ce987fd952515c83fa@linux-foundation.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210713185628.9962f4ce987fd952515c83fa@linux-foundation.org> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Jul 13, 2021 at 06:56:28PM -0700, Andrew Morton wrote: > On Tue, 13 Jul 2021 11:55:04 -0400 Johannes Weiner wrote: > > I agree that _is_ reads nicer by itself, but paired with other ops > > such as testset, _test_ might be better. > > > > For example, in __set_page_dirty_no_writeback() > > > > if (folio_is_dirty()) > > return !folio_testset_dirty() > > > > is less clear about what's going on than would be: > > > > if (folio_test_dirty()) > > return !folio_testset_dirty() > > I like folio_is_foo(). As long as it is used consistently, we'll get > used to it quickly. I'm not sure that folio_is_private(), folio_is_lru(), folio_is_waiters(), or folio_is_reclaim() really work. > Some GNU tools are careful about appending "_p" to > functions-which-test-something (stands for "predicate"). Having spent > a lot of time a long time ago with my nose in this stuff, I found the > convention to be very useful. I think foo_is_bar() is as good as > foo_bar_p() in this regard. I just wish C let us put '?' on the end of a function name, but I recognise the ambiguity with foo?bar:baz; > And sure, the CaMeLcAsE is fugly, but it sure is useful. > set_page_dirty() is very different from SetPageDirty() and boy that > visual differentiation is a relief. Oh, I'm glad you brought that up In folios, here's how that ends up looking: SetPageDirty() -> folio_set_dirty_flag() (johannes proposes folio_set_dirty instead) set_page_dirty() -> folio_mark_dirty() aops->set_page_dirty() -> aops->dirty_folio() __set_page_dirty() -> __folio_mark_dirty() __set_page_dirty_buffers() -> block_dirty_folio() __set_page_dirty_nobuffers() -> filemap_dirty_folio() __set_page_dirty_no_writeback() -> dirty_folio_no_writeback() I kind of feel that last one should be nowb_dirty_folio(), but I'm also hoping to eliminate it; if the filesystem sets AS_NO_WRITEBACK_TAGS in mapping->flags, then we just inline the no-writeback case into folio_mark_dirty() (which already has it for the !mapping case).