Received: by 2002:a05:6a10:c604:0:0:0:0 with SMTP id y4csp53574pxt; Thu, 5 Aug 2021 17:44:20 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyxkTEJme5wCL8ekh2XCPzR/555wuUZryfVSb9H3ajr9H3a6Ec2/kvwBoaoTOggi0XRRA9j X-Received: by 2002:a17:906:d54c:: with SMTP id cr12mr7480639ejc.227.1628210660736; Thu, 05 Aug 2021 17:44:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1628210660; cv=none; d=google.com; s=arc-20160816; b=YqK47hxm4fiI/HCx5foXK1EIyogXA7RApcdDsW9QTSZG4q/BcoPl8GStgxflYII8EU mS7mXfJgw5nuM3i8pDffestU5gLQnEiQABdZX9nuepZy03dmpHJ2gDJjqOm/tLXL0RdS 3wUgfgKUArCHbj51f8xRqdSTTvVU1JM03q8H8UiyF3Gsj+r3lvBxp1sbB7R6MzqQBwWA GRIsXOuUPKSPeW49SigAMoSf/dSAoxG4PsW54Qeptqv9ZTbGBBitVs/wc/QVQGHPwQU7 Lj+TbjasZ0SSv+UrlSRhBgihZcITRMGUDPgun77XktyYIv+mOzZFCnG59grk7jsPqS3y Wy+w== 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:reply-to :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature:dkim-signature; bh=9b9lnDrs9VQeuLXncQCMIbv4vy0L5khM/fC6d/oCDXA=; b=cy2rqzPpjI/qe+nIIKcAZsp/vsHsPYQJUswEN+HL7Vnp5VrnzE14gIyPxH1QtxfH7U A1ZiyJ0TvIpHAW83G3gbpAiXGywG6jGP63E9sRIYzlnChxVotLfmwBUjIeA/NXz1dMCv +GCtmVneb/PqspVT4Au1pAL83ew2J0hHcpVswIvT3KOxPpdvM6aRpWDYkZo8cgEj0IDc k2E+7vJgDTU8SVMZ2v/Ba9huoNIhkqVYF9cNi0JI2qX2eJhZrj0RwPNKMkoQZN1nvDLZ rGcV+bptkcCBnaVo0qlu9/wF0FaBMzOeCwNKLOCYvYMictpSl/3f0Hvada2UxLbEyhXN YiTQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@sent.com header.s=fm1 header.b=OU4cZ8Tj; dkim=pass header.i=@messagingengine.com header.s=fm3 header.b=dFXQ9IEJ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=sent.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id k25si7301120edr.107.2021.08.05.17.43.57; Thu, 05 Aug 2021 17:44:20 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@sent.com header.s=fm1 header.b=OU4cZ8Tj; dkim=pass header.i=@messagingengine.com header.s=fm3 header.b=dFXQ9IEJ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=sent.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242332AbhHETEN (ORCPT + 99 others); Thu, 5 Aug 2021 15:04:13 -0400 Received: from out2-smtp.messagingengine.com ([66.111.4.26]:53295 "EHLO out2-smtp.messagingengine.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242145AbhHETEE (ORCPT ); Thu, 5 Aug 2021 15:04:04 -0400 Received: from compute6.internal (compute6.nyi.internal [10.202.2.46]) by mailout.nyi.internal (Postfix) with ESMTP id DA32D5C0164; Thu, 5 Aug 2021 15:03:49 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute6.internal (MEProxy); Thu, 05 Aug 2021 15:03:49 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sent.com; h=from :to:cc:subject:date:message-id:in-reply-to:references:reply-to :mime-version:content-transfer-encoding; s=fm1; bh=9b9lnDrs9VQeu LXncQCMIbv4vy0L5khM/fC6d/oCDXA=; b=OU4cZ8TjVlVmleX2bWKetvc5gwm7e jNkfnKbXADKL0QRCPeRLPUYmqPzTKQo8Ahc4VKw6mzAgL3RYFC8kT6o0M71/03G3 dNWLljRBSfrzRzdr+wXOlCQvWuo1CBUn0Aidpzrc9nwwqWHTkR2rhKzvGgqHnpt0 xq3S/JeOJ8/Xfc8HffM2q7IIecv7zOT9T+XhiT+0gysc4Th9IQd+p4cYWVLLqR2u oGQN/VXw1hOirdA59cfd6qTrm9aci5QwnaR6ZDfvpcPYAQkhaaYI02eOiCEn/cTC BDvUB28BUGnrCRTcvcojUZxP9SkoCciZBEneTq4H2RKbsjlpPTjPQA50w== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:date:from :in-reply-to:message-id:mime-version:references:reply-to:subject :to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm3; bh=9b9lnDrs9VQeuLXncQCMIbv4vy0L5khM/fC6d/oCDXA=; b=dFXQ9IEJ kYsiA0Yev3dse3G5yyI07udU8K/EmFWe9HfhOVwymJigLFi5ru9alNfRIAIzgbU4 6L26WRHprShkvLASjc2/5Rh1PyTwQWDiOLJbGAspghSOmXseuY4g5QE72SF8Jhhr 6jEG8Qkvz70sMciuY1SkVND29uXciqrNXJBBmp39gqjKKHu79Mi/2iWIyo2JGLrb wTqDwSK7I5dOS+V1+/lIKC66qZHkzzbDgN5WQNlWDxzZHcHCZXztN9PXGbIYNo5y Uh6pQy1/7Gl+RZfb812ehwc22PlFwfUZAHPa0115lifI2Ft2UBHDmazpDZWgh/ls oXUQo5jhcb4QFA== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvtddrieelgdduvdelucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhephffvufffkffojghfrhgggfestdhqredtredttdenucfhrhhomhepkghiucgj rghnuceoiihirdihrghnsehsvghnthdrtghomheqnecuggftrfgrthhtvghrnhepieejue dvueduuefhgefhheeiuedvtedvuefgieegveetueeiueehtdegudehfeelnecuvehluhhs thgvrhfuihiivgepudenucfrrghrrghmpehmrghilhhfrhhomhepiihirdihrghnsehsvg hnthdrtghomh X-ME-Proxy: Received: by mail.messagingengine.com (Postfix) with ESMTPA; Thu, 5 Aug 2021 15:03:49 -0400 (EDT) From: Zi Yan To: David Hildenbrand , linux-mm@kvack.org Cc: Matthew Wilcox , Vlastimil Babka , "Kirill A . Shutemov" , Mike Kravetz , Michal Hocko , John Hubbard , linux-kernel@vger.kernel.org, Zi Yan Subject: [RFC PATCH 06/15] mm: use PAGES_PER_SECTION instead for mem_map_offset/next(). Date: Thu, 5 Aug 2021 15:02:44 -0400 Message-Id: <20210805190253.2795604-7-zi.yan@sent.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210805190253.2795604-1-zi.yan@sent.com> References: <20210805190253.2795604-1-zi.yan@sent.com> Reply-To: Zi Yan MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Zi Yan mem_map is only guaranteed to be virtually contiguous within a section, so mem_map_offset/next() uses pfn to handle mem_map discontiguity. Use PAGES_PER_SECTION instead of MAX_ORDER_NR_PAGES to describe this condition more precisely. Signed-off-by: Zi Yan Cc: linux-mm@kvack.org Cc: linux-kernel@vger.kernel.org --- mm/internal.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mm/internal.h b/mm/internal.h index b1001ebeb286..4ca52c696902 100644 --- a/mm/internal.h +++ b/mm/internal.h @@ -485,7 +485,7 @@ static inline void vunmap_range_noflush(unsigned long s= tart, unsigned long end) */ static inline struct page *mem_map_offset(struct page *base, int offset) { - if (unlikely(offset >=3D MAX_ORDER_NR_PAGES)) + if (unlikely(offset >=3D PAGES_PER_SECTION)) return nth_page(base, offset); return base + offset; } @@ -497,7 +497,7 @@ static inline struct page *mem_map_offset(struct page *= base, int offset) static inline struct page *mem_map_next(struct page *iter, struct page *base, int offset) { - if (unlikely((offset & (MAX_ORDER_NR_PAGES - 1)) =3D=3D 0)) { + if (unlikely((offset & (PAGES_PER_SECTION - 1)) =3D=3D 0)) { unsigned long pfn =3D page_to_pfn(base) + offset; if (!pfn_valid(pfn)) return NULL; --=20 2.30.2