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=-5.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,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 28711C433B4 for ; Sun, 2 May 2021 00:17:25 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id C9B2161423 for ; Sun, 2 May 2021 00:17:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231774AbhEBASO (ORCPT ); Sat, 1 May 2021 20:18:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33876 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231266AbhEBASN (ORCPT ); Sat, 1 May 2021 20:18:13 -0400 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0B493C06174A for ; Sat, 1 May 2021 17:17:22 -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=AJqYP9E0uYAvEBKxSQheh1x0I1D7jTFKZhx2V8wDkK4=; b=O2UZykb+fFkx3GRnUwTN4oiE6D whn0L7HqvQiPXrLOFiIt/gz7pnmLYNhCNjlqJ/XyST/stv1RPAk5ul7cU0lUE7i0mZInH/NLX2Klc xoWTue+Ylzs2kKUpSHSu4cJNOHpALWGW7KkXDmf1T0uXQCaBWKXH9xr5USFc7Q48yHDhBZ8W3S055 7O1+q9U8hxrSBK0J/7uEJxhgzgLDr1PK72SclqB6W43pv+Nm1DJPhsKf7rcbpFZi3Ltri7axDSY2i Bmy+ISQCXO+LIyDqFAj5GnP/tmqcvd3NErduompNJIybIZOBEDTB1XY7JH9f/XkhlRSN2a8Iv9bnK Xi0BKdFg==; Received: from willy by casper.infradead.org with local (Exim 4.94 #2 (Red Hat Linux)) id 1lcznF-00D3kB-Ab; Sun, 02 May 2021 00:17:07 +0000 Date: Sun, 2 May 2021 01:17:05 +0100 From: Matthew Wilcox To: John Hubbard Cc: Nicholas Piggin , Hugh Dickins , akpm@linux-foundation.org, linux-fsdevel@vger.kernel.org, linux-mm@kvack.org, Linus Torvalds Subject: Re: [PATCH v8.1 00/31] Memory Folios Message-ID: <20210502001705.GW1847222@casper.infradead.org> References: <20210430180740.2707166-1-willy@infradead.org> <1619832406.8taoh84cay.astroid@bobo.none> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org On Sat, May 01, 2021 at 02:38:50PM -0700, John Hubbard wrote: > On 4/30/21 6:32 PM, Nicholas Piggin wrote: > ... > > > > - Big renaming (thanks to peterz): > > > > - PageFoo() becomes folio_foo() > > > > - SetFolioFoo() becomes folio_set_foo() > > > > - ClearFolioFoo() becomes folio_clear_foo() > > > > - __SetFolioFoo() becomes __folio_set_foo() > > > > - __ClearFolioFoo() becomes __folio_clear_foo() > > > > - TestSetPageFoo() becomes folio_test_set_foo() > > > > - TestClearPageFoo() becomes folio_test_clear_foo() > > > > - PageHuge() is now folio_hugetlb() > > > > If you rename these things at the same time, can you make it clear > > they're flags (folio_flag_set_foo())? The weird camel case accessors at > > least make that clear (after you get to know them). > > In addition to pointing out that the name was a page flag, the weird > camel case also meant, "if you try to search for this symbol, you will > be defeated", because the darn thing is constructed via macro > concatenation. I've always hated that, FWIW. And you can't add kernel-doc for them because kernel-doc doesn't understand cpp. So my current plan (quoting my other email): folio_dirty() -- defined in page-flags.h would have kernel-doc, would be greppable folio_test_set_dirty_flag() folio_test_clear_dirty_flag() __folio_clear_dirty_flag() __folio_set_dirty_flag() folio_clear_dirty_flag() folio_set_dirty_flag() -- generated in filemap.h under #ifndef MODULE would not have kernel-doc, would not be greppable, would only be used in core vfs and core mm. folio_mark_dirty() -- declared in mm.h (this is rare; turns out all kinds of crap wants to mark pages as being dirty) folio_clear_dirty_for_io() -- declared in filemap.h already have kernel-doc, are greppable, used by filesystems and sometimes other random code. > Except that over time, it turned out to be not quite that simple, and > people started adding functionality. So now it's "cannot find it, and > it's also got little goodies hiding in there--maybe!". I also don't like that. With what I'm thinking, there are no special cases hidden in the autogenerated names. Special things like the current SetPageUptodate would be in folio_mark_uptodate() and filesystems couldn't even call folio_set_uptodate(). > Given all that, I'd argue for either: > b) changing a bunch of the items to actual written-out names. What's > the harm? We'd end up with a longer file, but one could grep or > cscope for the names. I hope the above makes you happy -- everything a filesystem author needs gets kernel-doc. People working inside the VM/VFS still get exposed to undocumented folio_test_set_foo_flag(), but it's all regular and autogenerated.