From patchwork Fri Jan 6 17:40:25 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: SeongJae Park X-Patchwork-Id: 3676 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4e01:0:0:0:0:0 with SMTP id p1csp944665wrt; Fri, 6 Jan 2023 09:43:58 -0800 (PST) X-Google-Smtp-Source: AMrXdXss+nxmMexskbQDtFxnnvqCrrtTtcWUuq79bdoiGxrIB4373BW9BWs6XnecmspX7m9gvm+w X-Received: by 2002:a17:907:cbc8:b0:7c0:f2c9:4404 with SMTP id vk8-20020a170907cbc800b007c0f2c94404mr56116194ejc.21.1673027038218; Fri, 06 Jan 2023 09:43:58 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673027038; cv=none; d=google.com; s=arc-20160816; b=vc3EkzJ6NVnFEipCzAF78k1Pjsqc6ATDgnB2CZ1IbfQgJIsNsIQG/Q5mW7pLoMp4+M FyAnSyZufcO8xMhVszwE7mCvpj1TdzIaeIcdycY3Ec9cuweBabVjekWeMswp7/Bb4xx3 8VlvbDyV3sEBHp4syyF64+uRO2/ZkVUX1rzH1BOw0SUef1lk0X01YPdWGnyql+/arbYO nxG2MQnm6bOuHXnZHUSual/VMovRRhZe8yxil8PbRFOxyIXBvD2GVyCifnOkEUWX7oON 0p6iPRjLu8NOs6N1O6zZG2ANzc7YJfhddg2MKb+fCM1+3IXfcpRIt4jB+/FaJukn94fe EvBg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=56aQxLMNNXht4lUJaV0pcXj992G0NW6dt9R3o7I+KkI=; b=0WAB4c9lDnJG9Uk2tbLXPmDKQiPXHFGbRK0jTZlv2lvIKhwKqLPwD4+ZEVD6/OvZfd rY9K+SUSPvz55zZm26QvNDr0NG2wSaRPNs6bIshZFcoGARgd+TbnEBMa5m1N+WGte3pk jIBfx4ZtwE3VTgZ6N9ydFykIwuaXkhqAI5RsA0KndeEFGAwmXWjopl/ZEFVI/LycSlDw Nra9GnpmavSMEydxH2GjBxltzCqTX1cphCo72/chPaUNYq47SwWfaalnMOCzEb5FdFVl V61zEz6sNvZQb7g2I770BgzW3X4pPvU9KaVReRuLUXnOOhgwuI17k3taOfe3Jo2mtxvj XM4w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=NXZXYzIz; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id gt44-20020a1709072dac00b0084c723cab0dsi2175922ejc.89.2023.01.06.09.43.35; Fri, 06 Jan 2023 09:43:58 -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=@kernel.org header.s=k20201202 header.b=NXZXYzIz; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234465AbjAFRke (ORCPT + 99 others); Fri, 6 Jan 2023 12:40:34 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36238 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230497AbjAFRkc (ORCPT ); Fri, 6 Jan 2023 12:40:32 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A9ABD7D9DC; Fri, 6 Jan 2023 09:40:31 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 4CA4F616F5; Fri, 6 Jan 2023 17:40:31 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id DAC3CC433EF; Fri, 6 Jan 2023 17:40:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1673026830; bh=RPl7e2yBo83c5bpefsyB/x5AStixSmvwCt6OqN8mVRA=; h=From:To:Cc:Subject:Date:From; b=NXZXYzIz+4ecrSUefmPBaOBbALJel/O/I56Yx+vNVLtvvGtgf94GV1QFNHD6OR3I6 i0GyyTkuKlVocoLBOqq50sdu/aj0RGLCZQQGq0eeDZOgBS1WJbFl7nB+/Alqr6eRfC uvUP/EUfkOQjMyV2e31sJWCdpo13LLjLtdfx//WtynQZE6FL68aYh45dJwALkyPfqj B9vGPTfQVeZUQMdGN8tiOq2V5qDa3+AeBncTri0dCoSdXqRp9Tmyhp9/xGMkWGvohs gQlzaWNk2/L8YwsNRRwssuwjPlp5u8iFDA/rLIvSqqbbIFZSLKTLYdUBFs/ixfvZSt d9h5NGQ00D4xg== From: SeongJae Park To: Andrew Morton Cc: SeongJae Park , willy@infradead.org, Xiubo Li , Ilya Dryomov , Jeff Layton , linux-mm@kvack.org, ceph-devel@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 0/3] add folio_headpage() macro Date: Fri, 6 Jan 2023 17:40:25 +0000 Message-Id: <20230106174028.151384-1-sj@kernel.org> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1754295999090143680?= X-GMAIL-MSGID: =?utf-8?q?1754295999090143680?= 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)'. SeongJae Park (3): include/linux/page-flags: add folio_headpage() mm: use folio_headpage() instead of folio_page() fs/ceph/addr: use folio_headpage() instead of folio_page() fs/ceph/addr.c | 2 +- include/linux/page-flags.h | 8 ++++++++ mm/shmem.c | 4 ++-- mm/slab.c | 6 +++--- mm/slab_common.c | 4 ++-- mm/slub.c | 4 ++-- 6 files changed, 18 insertions(+), 10 deletions(-)