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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C33EAC3DA7A for ; Fri, 6 Jan 2023 19:22:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235486AbjAFTVt (ORCPT ); Fri, 6 Jan 2023 14:21:49 -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> 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.