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=-16.8 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham 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 C3236C43460 for ; Mon, 26 Apr 2021 14:19:45 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 2517361165 for ; Mon, 26 Apr 2021 14:19:45 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 2517361165 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id A50F56B0070; Mon, 26 Apr 2021 10:19:44 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id A28EA6B0071; Mon, 26 Apr 2021 10:19:44 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 8F13C6B0072; Mon, 26 Apr 2021 10:19:44 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0209.hostedemail.com [216.40.44.209]) by kanga.kvack.org (Postfix) with ESMTP id 6E1B66B0070 for ; Mon, 26 Apr 2021 10:19:44 -0400 (EDT) Received: from smtpin19.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id 28362363C for ; Mon, 26 Apr 2021 14:19:44 +0000 (UTC) X-FDA: 78074726688.19.0C95C64 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by imf29.hostedemail.com (Postfix) with ESMTP id 19238D6 for ; Mon, 26 Apr 2021 14:19:39 +0000 (UTC) Received: by mail.kernel.org (Postfix) with ESMTPSA id B3BA56101C; Mon, 26 Apr 2021 14:19:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1619446782; bh=/Q3C+Yf/LH5vmVHv0+NtFuLk/XJ/KpuX0JQvBT1NiDs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=IfFZC1sTriLI2UHnZdynbjCvY3wZY+lTDlPwmRsNvkQ8D1gn8m53T7X/0WltGXx+l Z6LfX0gv+b4UWHf0wo9b1Po4B3G1pveAavsVfpBDNs24uU4BFHkZ1f7clX0foRVWQy O+EbcD0OwmDFztxIbY8WZ2Vo3JCrkkJ2WSc+ULA1zxEIlZ4QGbCsCZBHyfIAE/L8Zo DPH9ws/Uka4LoigEg40qzdLwWt5BjBKBVl0n74JycZSMz3Ef+f/NDga/3NsNogthMd YZqMtfc/FY9xh6mBuPTvOa6OOU867I+ZSSDCJyHInarXcEGgVr/SLvRGn2Gno+GfVW yS9jJRl982wiA== From: Mike Rapoport To: Andrew Morton Cc: Anshuman Khandual , Jonathan Corbet , Matthew Wilcox , Mike Rapoport , Mike Rapoport , linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org Subject: [PATCH v2 2/2] mm/mmzone.h: simplify is_highmem_idx() Date: Mon, 26 Apr 2021 17:19:27 +0300 Message-Id: <20210426141927.1314326-3-rppt@kernel.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20210426141927.1314326-1-rppt@kernel.org> References: <20210426141927.1314326-1-rppt@kernel.org> MIME-Version: 1.0 X-Rspamd-Server: rspam05 X-Rspamd-Queue-Id: 19238D6 X-Stat-Signature: nxfyepj5uji8t9ohewh76tyadddc7x8t Received-SPF: none (kernel.org>: No applicable sender policy available) receiver=imf29; identity=mailfrom; envelope-from=""; helo=mail.kernel.org; client-ip=198.145.29.99 X-HE-DKIM-Result: pass/pass X-HE-Tag: 1619446779-17499 Content-Transfer-Encoding: quoted-printable 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: From: Mike Rapoport There is a lot of historical ifdefery in is_highmem_idx() and its helper zone_movable_is_highmem() that was required because of two different path= s for nodes and zones initialization that were selected at compile time. Until commit 3f08a302f533 ("mm: remove CONFIG_HAVE_MEMBLOCK_NODE_MAP option") the movable_zone variable was only available for configurations that had CONFIG_HAVE_MEMBLOCK_NODE_MAP enabled so the test in zone_movable_is_highmem() used that variable only for such configurations= . For other configurations the test checked if the index of ZONE_MOVABLE wa= s greater by 1 than the index of ZONE_HIGMEM and then movable zone was considered a highmem zone. Needless to say, ZONE_MOVABLE - 1 equals ZONE_HIGHMEM by definition when CONFIG_HIGHMEM=3Dy. Commit 3f08a302f533 ("mm: remove CONFIG_HAVE_MEMBLOCK_NODE_MAP option") made movable_zone variable always available. Since this variable is set t= o ZONE_HIGHMEM if CONFIG_HIGHMEM is enabled and highmem zone is populated, = it is enough to check whether zone_idx =3D=3D ZONE_MOVABLE && movable_zone =3D=3D ZONE_HIGMEM to test if zone index points to a highmem zone. Remove zone_movable_is_highmem() that is not used anywhere except is_highmem_idx() and use the test above in is_highmem_idx() instead. Signed-off-by: Mike Rapoport Reviewed-by: Anshuman Khandual --- include/linux/mmzone.h | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-) diff --git a/include/linux/mmzone.h b/include/linux/mmzone.h index 0d53eba1c383..c2bfefd34b59 100644 --- a/include/linux/mmzone.h +++ b/include/linux/mmzone.h @@ -982,22 +982,11 @@ static inline void zone_set_nid(struct zone *zone, = int nid) {} =20 extern int movable_zone; =20 -#ifdef CONFIG_HIGHMEM -static inline int zone_movable_is_highmem(void) -{ -#ifdef CONFIG_NEED_MULTIPLE_NODES - return movable_zone =3D=3D ZONE_HIGHMEM; -#else - return (ZONE_MOVABLE - 1) =3D=3D ZONE_HIGHMEM; -#endif -} -#endif - static inline int is_highmem_idx(enum zone_type idx) { #ifdef CONFIG_HIGHMEM return (idx =3D=3D ZONE_HIGHMEM || - (idx =3D=3D ZONE_MOVABLE && zone_movable_is_highmem())); + (idx =3D=3D ZONE_MOVABLE && movable_zone =3D=3D ZONE_HIGHMEM)); #else return 0; #endif --=20 2.29.2