Received: by 2002:a05:6358:16cc:b0:ea:6187:17c9 with SMTP id r12csp2831580rwl; Fri, 6 Jan 2023 11:25:33 -0800 (PST) X-Google-Smtp-Source: AMrXdXvN6GlLjHPuM/Mitk9IMz3hf/e6aVKQvjNjeVwR4KEp29K7Z/Zv8eLeMEpKkz/McfKi8CWw X-Received: by 2002:a05:6a20:4904:b0:9d:efbf:8156 with SMTP id ft4-20020a056a20490400b0009defbf8156mr74913139pzb.31.1673033133669; Fri, 06 Jan 2023 11:25:33 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673033133; cv=none; d=google.com; s=arc-20160816; b=zpR2FessISPMBY454sG7Ix/9FHGJLDLFvyH+YWa39Dli/s14bmQbejLUHmgJVCW1m1 N4u+6Qh1wRIc7tWSSW2oyO2ER8Z2pDZBqFI4OQIsdT+3Rd2N9+KOCaJ/8gh4Bz5qw/iI qVt55YXc3aOOAxhBZhgCUUe+DXUwGAoCSP2JajOB6q8wttxdnartHq1i4yJPtd43hHKU 8gKKNvXjiQW49RP9aPRIaH4LCgp/zRCKgy1nB8swzF/pIQEs3y4Dao0DRdWu1FntC7/8 b6hYrIroGXNdpOD34crCcCUp7uFMphSwTm8rW7D76zwFYV2qptASBuHpUYEmBjGYjQXL AE4Q== 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=dsRHMp9OopMZ+5Sq2nVA/uTwPQ8x6Lz0DDDDmnk8Iwg=; b=po7lJFMwYinplXhi1xlXLL5Z/nqEfo/KjKhQtnEpvOzZyZN4gG1A0rMMSKWxBwU/+F fsYuR/PXiYil7LnAHUISZEAc0mrXBDMk9s7hupVyqt+ThWGLtlOwAwWixheGNC9tp8SV +m3090BSKJp00IFMK3xe84gtvvwY7hchSDBkkAm25RfJC0nVqwb0yTWqgADVffp/xQ3z q1LS/KDfnXp+3ltK/IJV42ZdQuM7uuG3V9ZRPptlstQnhe776i1fOmYry8Bd4H8kBTwS bNxGz5uauH0Sn4Uami8/Tw0n7BGzo8M6XS/PO+VRMIFxp5IHsw8EVQ84Dn+vV2mMgqbs kCfw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b="J/+vDt8x"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id z13-20020a63d00d000000b0047702d2fe08si2076386pgf.493.2023.01.06.11.25.26; Fri, 06 Jan 2023 11:25:33 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b="J/+vDt8x"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235303AbjAFTVr (ORCPT + 56 others); Fri, 6 Jan 2023 14:21:47 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55002 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234814AbjAFTVm (ORCPT ); Fri, 6 Jan 2023 14:21:42 -0500 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 21C843D5F2; Fri, 6 Jan 2023 11:21:41 -0800 (PST) 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=dsRHMp9OopMZ+5Sq2nVA/uTwPQ8x6Lz0DDDDmnk8Iwg=; b=J/+vDt8x6eZrANv21ctTOHWcfV +gj5WdtL1fDmWIXastniD3CxjCL0Ru3TzClJ5iLARTdm77qNeKVQjkoLj9j70Oxy+onoyxIC0mu1h +iDhKvbEMmVh4lAfU8B5LDbshRvTo6Y5Ui+3aJFMQuO/GfPU+lvqIW5AimVwRMJ/kDt9tFOHXrHPC vRuPxnJeTSLxMfjObxQlCVgJf0H5BxJWwPNQl271CWuMFldmB21m2j5TyEPxh90zstQP0v+H5hbs9 V64WIvCs7yGIqayunr7g+QpvzJUfM5WUuvp0OGUDN6H9U7N8TO7wgxXSS7Pyde0ZAzzKAaxVeEzkI nbxDQcww==; Received: from willy by casper.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1pDsHc-00HR2F-Dc; Fri, 06 Jan 2023 19:21:40 +0000 Date: Fri, 6 Jan 2023 19:21:40 +0000 From: Matthew Wilcox To: SeongJae Park Cc: Andrew Morton , Xiubo Li , Ilya Dryomov , Jeff Layton , linux-mm@kvack.org, ceph-devel@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 0/3] add folio_headpage() macro Message-ID: References: <20230106174028.151384-1-sj@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230106174028.151384-1-sj@kernel.org> X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_NONE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Jan 06, 2023 at 05:40:25PM +0000, SeongJae Park wrote: > The standard idiom for getting head page of a given folio is > '&folio->page'. It is efficient and safe even if the folio is NULL, > because the offset of page field in folio is zero. However, it makes > the code not that easy to understand at the first glance, especially the > NULL safety. Also, sometimes people forget the idiom and use > 'folio_page(folio, 0)' instead. To make it easier to read and remember, > add a new macro function called 'folio_headpage()' with the NULL case > explanation. Then, replace the 'folio_page(folio, 0)' calls with > 'folio_headpage(folio)'. No. Everywhere that uses &folio->page is a place that needs to be fixed. It shouldn't have a nice convenience macro. It should make you mildly uncomfortable.