Received: by 2002:a05:6a10:c604:0:0:0:0 with SMTP id y4csp62088pxt; Thu, 5 Aug 2021 18:02:15 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyx6r0P3Mwcr+xzDakzMqIjbCfPSngVe+suR0zQVMAb5e08Ooxwz73JU+F5Yv6GdvYKE1E2 X-Received: by 2002:a17:906:2451:: with SMTP id a17mr7412942ejb.75.1628211735045; Thu, 05 Aug 2021 18:02:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1628211735; cv=none; d=google.com; s=arc-20160816; b=cLQwaD0J6AeDWM6479bevUMHAwrrKPKihxchNRiFZMCjKlPuL58iyVoxAtCrqASCSZ 0S6ZbRet39K6VvSk+OrIz1gOBmPVhOXqeKoOfKDfFoJM9I7rlxm47eUW3UtBKigQpiC1 hD2cqZNHpdbGkELpku8nZHHDfw3ewcE/6LktRKOgnxrHApVXnTCJ+QQ5aXO9EUBVtP/J BXIVjlzCnUcdwbrYWgT2I2p6k7Zmcksa7MlAHNI8KdTdcbp67AVdItjxHd2ci2eJfm7B g/AJUWNCR0IUDxzVCJ8+BQV0/pU7JGUY23yQC3BXQPKno+lMVDGI3KwYSTzp2lEe8U9n brmA== 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=Lf+Lo5XZBjeZj26CYxZH/xK3V5qmXEQIAGQy9/M8Fos=; b=cwvih4zhDQQC836VVZXpKEr7piFHHmK70jqMT6LPtse6IlPCyKvdFDUtIPtb9GrB/7 34aPjVSI2gzOIGXmGwkrzf8Pou7pdmCBN8iW02f4IAsQDYyIxPIgC3xwfbTgVXeZrUht MXxuH/OMLwJu8G1x+z1kPq+UqyYcDrWS4tWXw1fwnV+wsAGdxHlZINQlkYz918U6NDb6 9S4VUj9G8TOhAnduzAFC5mPQk8EeRwoZwybd/VXOMycc+F2vz4QavpQ0m52M4pbpjQxa Sh5ZhoEO0CtkJX9V1E2xdY2N19WJgYJK0dFTfjGY+1okFf52qZ0FHrHQraWF8uToUyK9 gPpg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@sent.com header.s=fm1 header.b=BU7jEjGI; dkim=pass header.i=@messagingengine.com header.s=fm3 header.b=B1r8L+Yo; 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 b7si7170920edd.421.2021.08.05.18.01.40; Thu, 05 Aug 2021 18:02:15 -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=BU7jEjGI; dkim=pass header.i=@messagingengine.com header.s=fm3 header.b=B1r8L+Yo; 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 S242455AbhHETEP (ORCPT + 99 others); Thu, 5 Aug 2021 15:04:15 -0400 Received: from out2-smtp.messagingengine.com ([66.111.4.26]:60197 "EHLO out2-smtp.messagingengine.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241974AbhHETEF (ORCPT ); Thu, 5 Aug 2021 15:04:05 -0400 Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailout.nyi.internal (Postfix) with ESMTP id 5E30B5C0163; Thu, 5 Aug 2021 15:03:50 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute1.internal (MEProxy); Thu, 05 Aug 2021 15:03:50 -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=Lf+Lo5XZBjeZj 26CYxZH/xK3V5qmXEQIAGQy9/M8Fos=; b=BU7jEjGIWBuA7nBnSpdOo189jkLI5 NwRqb67cGvmHezcEdmUpqZKPS3139uAuuaE3a/BBl+dukvx51LWU4ohrNfGAqfuX ylUL80D/dHflw7e+u+bJJUkDYqlBvvT0N5DHnVq1B+adObgI+yCtI5OTI2aNvTj5 uJE1yMuyJSl63XF7j+hNDPP9pns04qrqXZvE9MGcwIe8qvV9STIYiYnuFQ/06ux5 6kp8Dgv/Hxlw77Fq0m+2q1GTiUK3bPzuqsfiR0oya9dKhUixJB9Dg158nERscoLF 3/VzMXrmYw74Aak9nOcxFRU66AJobAPCLnWM5zLw8xrNXLm2jFkLUgjuQ== 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=Lf+Lo5XZBjeZj26CYxZH/xK3V5qmXEQIAGQy9/M8Fos=; b=B1r8L+Yo PD3pvwzCaLIj12NCvVTj3l6HRer7jSt3363+mRBlrkicVMcqmsmWA/zRfWKJjgKU Ku3V9kJAn+ei1wTRrKpgK52IKHzV9+e3GSfK6NwUrD2j49U3uribv/2sQxgw4LyH 9olPYqQOzd2nlVPRP+WB5UrGREV8c2sb6uCWi0kEGK7mGwHwYqLXV8xKAFcSg6rb VQMuanJUr8g94pni2ctv1BfiwaqXYwfgGvPdetXBQeaWIO8ek+HC8OqZXa2UKySD pv9/OwADCaeePO6T1P4KCWW0u76cDg0xaHRxg4dMChvq2cJtWBQTSHvgwWRxSJLA FsTUFmX9h1fz7A== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvtddrieelgddufedtucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhephffvufffkffojghfrhgggfestdhqredtredttdenucfhrhhomhepkghiucgj rghnuceoiihirdihrghnsehsvghnthdrtghomheqnecuggftrfgrthhtvghrnhepieejue dvueduuefhgefhheeiuedvtedvuefgieegveetueeiueehtdegudehfeelnecuvehluhhs thgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomhepiihirdihrghnsehsvg 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 07/15] mm: hugetlb: use PAGES_PER_SECTION to check mem_map discontiguity Date: Thu, 5 Aug 2021 15:02:45 -0400 Message-Id: <20210805190253.2795604-8-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. Use PAGES_PER_SECTION to check the condition properly. Signed-off-by: Zi Yan Cc: Mike Kravetz Cc: linux-mm@kvack.org Cc: linux-kernel@vger.kernel.org --- mm/hugetlb.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mm/hugetlb.c b/mm/hugetlb.c index ce79d76c42ce..7f78203d6feb 100644 --- a/mm/hugetlb.c +++ b/mm/hugetlb.c @@ -1784,7 +1784,7 @@ pgoff_t hugetlb_basepage_index(struct page *page) pgoff_t index =3D page_index(page_head); unsigned long compound_idx; =20 - if (compound_order(page_head) >=3D MAX_ORDER) + if (compound_order(page_head) >=3D PAGES_PER_SECTION) compound_idx =3D page_to_pfn(page) - page_to_pfn(page_head); else compound_idx =3D page - page_head; --=20 2.30.2