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: 13091656 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 kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id C4049C54E76 for ; Fri, 6 Jan 2023 17:40:36 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id DFAFE8E0003; Fri, 6 Jan 2023 12:40:35 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id D84718E0001; Fri, 6 Jan 2023 12:40:35 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id C27038E0003; Fri, 6 Jan 2023 12:40:35 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id B3C9A8E0001 for ; Fri, 6 Jan 2023 12:40:35 -0500 (EST) Received: from smtpin22.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id 76F4A1C667C for ; Fri, 6 Jan 2023 17:40:35 +0000 (UTC) X-FDA: 80325088830.22.8679D59 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by imf28.hostedemail.com (Postfix) with ESMTP id E5886C0010 for ; Fri, 6 Jan 2023 17:40:33 +0000 (UTC) Authentication-Results: imf28.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=NXZXYzIz; spf=pass (imf28.hostedemail.com: domain of sj@kernel.org designates 145.40.68.75 as permitted sender) smtp.mailfrom=sj@kernel.org; dmarc=pass (policy=none) header.from=kernel.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1673026834; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:references:dkim-signature; bh=56aQxLMNNXht4lUJaV0pcXj992G0NW6dt9R3o7I+KkI=; b=hTgifstlxrUd3pqMxmGodMMamDhGxjXdEgn4O/L0nuKtX3elJ+lkAF2uB3EsiYhCT2ow4C BeVmxXegpVH5XnRUovZw1sTThfpsmwxY5vQp4MevcpCKRcZDPGZscdbQAZW9amprhlaN9w UBXB/782Wzfty++v4AwM+/QwJzmqD7k= ARC-Authentication-Results: i=1; imf28.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=NXZXYzIz; spf=pass (imf28.hostedemail.com: domain of sj@kernel.org designates 145.40.68.75 as permitted sender) smtp.mailfrom=sj@kernel.org; dmarc=pass (policy=none) header.from=kernel.org ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1673026834; a=rsa-sha256; cv=none; b=P4J6vWafJhPycgz1ygJTZH9t/8fd2PEEsOajRs5KX4h5aOfv3/BbtcOG7VYiAkyZJnlfE7 gg2QECZ0blijW+YkZ/AggANQNQRkq5MjbSXkXHFCqZXt+1le/ua4VggvAgwRv97YQsgini kUMSvzRBWtIjQ724aNOxU+Co2ingb7A= 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 ams.source.kernel.org (Postfix) with ESMTPS id 045F3B81C52; Fri, 6 Jan 2023 17:40:32 +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-Rspamd-Queue-Id: E5886C0010 X-Stat-Signature: 85ah6i7m387obm8e58tu9buxwjbooe4h X-Rspam-User: X-Rspamd-Server: rspam08 X-HE-Tag: 1673026833-214660 X-HE-Meta: U2FsdGVkX1/giOwJ8QhmK8yMSp6WM8G4BoBAj56U9AXKJjP/TumKL8BaIZB+E2meT33nCaqfPY2Bgg0BO/H51dyPlx9vmEBQlHTv2aVdK5yGydOsms5LZnZpI2poMTRqUZA0YCxPd6uvH6+eD1Rwoq7ctc1ZUoSjl3Tp6q+vU/b/grw4sH3gmv1HJocp9NQo3MeaM0aWKMsMSmzGO4FSz8PG5DsL6HUytyFa1M1ohY9ivJP7M6vHgTVSNJtvqMg/CBMv7JFccMR/IvtwEzAbu9jGhj+MXcmhv2ivhCp/FRdeeJ9mPSOZ3Adx7Cc4YNeQWao1+awSXNJtu8HIsWFgs4r73x/tZXxY/DzjcN0n5uSuCr1bxMMAVPtDygXKxGTl1X0e6H6EiPmv8xfwh1X42yJLFZMkLijpeFWzjxLP8QOJSuVc6Zj9g0eSngbiAbxMUnwyEJWfJUoW+LSab40wfqqyp0lZdwzqx8JMP7QZO/yhTbDKAB1vgSKBi8fcdrZfCHBEFbGtfIAOmDN9AyxF9/hMMiEhNCcFnATC5izMq1gRFjdLkc7l9YHbyN4mQCTzIg/ymworSJLrvUhhO8CGcQN59NeCE6sn9BQlciTN4yilFMO/7NUIYbJBByNcrIIpXnzF8sF6NTONmM0WIOQ6xnfNRjfQmZ/M5HXDjPpGrEV3+cfxLwocei+j37uc9rNTjHJCH3wuHLw3fCJC8ITeNtqfp6k5SCFYhuoLtuiyIP8DeE+fh3HfGFVCT5qjsQblDLB9t322RNkF+l3Amuq34HQyCR1CRpUAB4ojbq446RaHoEoC5vzhk4lJFMnBog0Y04qUpGot4A9I9FlAowNZx6Wj5olko66kg7IAm6z7Rqs5I65vwMpOaWcmnyqFaeid8vtUlIqE6iapm+4uh/wJ126udXUifiFDsNwpwWIRPek6QxVIEbv0drB2chCtGLxjNEOQ6+UBzlz0e8eTHiy FMvHQcE1 0Jw6Iu0fdBsrU+Xo0etsMoLSVv8ChioefshlhB/5mNzk0RcPSW/CDqPI8drticZCAcTjiBJuWiRgpDtwiw41kl9lfQniAWmYHPS4J+0QV7YjTXg9X5W7VDfVH7A== X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: 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(-)