Received: by 2002:a05:6a10:c604:0:0:0:0 with SMTP id y4csp871661pxt; Thu, 5 Aug 2021 13:55:53 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz8AQtz9+aihL34lwgKHDI+RrnntJyHqksxOlDeaJ0nZMpRopExM806aoIrLjlkTvh6mFLX X-Received: by 2002:a02:b058:: with SMTP id q24mr6302152jah.88.1628196952866; Thu, 05 Aug 2021 13:55:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1628196952; cv=none; d=google.com; s=arc-20160816; b=nvqsPVaIVwqCMbICyIDFxfB05ASlRy4oxA6r6yjupCFWcHbOmRtMKtTpd9wC9NuJly xfzB+QKQ4zP1N58jXi8a6PDWDxkZFNNHA6jhP6FUqYWLdecJ+bpVH8FzlRnGC0cCEUeB vmBcHPEV7RpM4eNwOHzNk6GWCyc/0cyDiJhjpXJ+KHxNsLB7BmPE0TFFIABMd32suOD3 F7BsrD4JNFushG9B/Ya1vVKjU0I+s13vuwpO+/dbhEjddu9JdpT9HIMR5zF8+ZC7uI92 J0Ql+YgO4cf2zdLHp6oLZtU9EvU6gP07CSdO4L537oyvOb2ScW67gufNcNgL8uw9P0TA HEyA== 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=WkfkSBDKtT+JVsvcnvI+ensvQFYsr8arKk51nWla/ns=; b=Jbmm4LpkwQuhmbFoMwOth6jasoPNK2rvv10ihYoP96Qjitpfr6gJMMZn4H8EO4QauZ N1ibjlo5pHb3fYUfXy2Fj7lg0VbLdSOPyntTluOX/cUZY48xfDuvvsfZFcya0Op1+ydi GKnLr5IQwzSq0yKF3xo5mTTVnYDD5ezdPqP/1EOlf2G6RLLkTUurTOy1ygZkXJyC7aYL +ZGAo1zdsvuKTPOjauKWtbQpRdEdt2CgSdwOYtCO6ag0rBC8GW9kH+DnB8CpiSKuIzGj y6BiuOT1HB6ZsReQ3WHc9bQ5H6yCvUbcpcMJRskfCrSju1oJM1uxGTMXcr1RVOr5tJrN ZczA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@sent.com header.s=fm1 header.b=Eig43P7o; dkim=pass header.i=@messagingengine.com header.s=fm3 header.b=rprndRDD; 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 m9si7170401jah.91.2021.08.05.13.55.39; Thu, 05 Aug 2021 13:55:52 -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=Eig43P7o; dkim=pass header.i=@messagingengine.com header.s=fm3 header.b=rprndRDD; 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 S242161AbhHETEL (ORCPT + 99 others); Thu, 5 Aug 2021 15:04:11 -0400 Received: from out2-smtp.messagingengine.com ([66.111.4.26]:58753 "EHLO out2-smtp.messagingengine.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242113AbhHETEE (ORCPT ); Thu, 5 Aug 2021 15:04:04 -0400 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.nyi.internal (Postfix) with ESMTP id 7774A5C0160; Thu, 5 Aug 2021 15:03:49 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute4.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=WkfkSBDKtT+JV svcnvI+ensvQFYsr8arKk51nWla/ns=; b=Eig43P7o6pypWoyU3Hgwo3CSypMVP ukIGgpHhdvWi079VQpHg45cL6bV27wy668fQ77gO7jaLVuUa6yrgVDNE31izvaGD Qq4PHwqogRrBecw7ulqS9gS36MAKu0ceQhm4tY0fezKT7Ral+2B9qzpb/IQezyGN o3drdYRotmiJStMDWBCD3ptzV954eIPG8LPXu2DvNWNqDGXFOnZwBRe/G+1aNSze KiYp6za1VQb4iz8hyARC1qCKNH/JXWJOJO5dYrlBwkm6rL86GC4Ua3D2K9dVT3RE VMvJpeKGHJPJE4v4ajSKrbAo/Ei3bjy8BRUrZJWtJ95CmhGRnDzJh7Mtw== 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=WkfkSBDKtT+JVsvcnvI+ensvQFYsr8arKk51nWla/ns=; b=rprndRDD 7vPzUXWe215Wt32209lM4uzb3aVuktPzk8wLAdRoVDG5zPo3syWwO05AmQd+1Ooj d0ZsRdEEsZFgUSit6tF6bp8OozeIEz4LZD6cUQf9VWbjQDxisfnuOu8/wghjlEgz l2FlVeuC0ts3Zm6Oz7Se6kFD8e81U46aRIl7zJPve1FkmmOSCamVil6A29t80cKx 64fFn/UKHI9LAE49zNqeXGVegPWgcl9WLlkTMlXVVca8hwGELSjIibZ9uCRp9I1V DrOZrNjJ4ZHrvpG0oDqcUWdaJf9r5D1WADoVc3+IuZCwwkKIRUo31DQdRWefH4YM aHLFjXncJqQOuA== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvtddrieelgdduvdelucetufdoteggodetrfdotf 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 05/15] mm/memory_hotplug: online pages at section size. Date: Thu, 5 Aug 2021 15:02:43 -0400 Message-Id: <20210805190253.2795604-6-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 When CONFIG_SET_MAX_ORDER is used, MAX_ORDER can be larger than section size. Holes can appear in hotplug memory chunks with size of 2^MAX_ORDER. Use PFN_SECTION_SHIFT (the order of section size) to limit hotplug memory size. Signed-off-by: Zi Yan Cc: David Hildenbrand Cc: linux-mm@kvack.org Cc: linux-kernel@vger.kernel.org --- mm/memory_hotplug.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/mm/memory_hotplug.c b/mm/memory_hotplug.c index 85029994a494..91ca751ac20c 100644 --- a/mm/memory_hotplug.c +++ b/mm/memory_hotplug.c @@ -601,16 +601,16 @@ static void online_pages_range(unsigned long start_pf= n, unsigned long nr_pages) unsigned long pfn; =20 /* - * Online the pages in MAX_ORDER - 1 aligned chunks. The callback might - * decide to not expose all pages to the buddy (e.g., expose them + * Online the pages in PFN_SECTION_SHIFT aligned chunks. The callback + * might decide to not expose all pages to the buddy (e.g., expose them * later). We account all pages as being online and belonging to this * zone ("present"). * When using memmap_on_memory, the range might not be aligned to - * MAX_ORDER_NR_PAGES - 1, but pageblock aligned. __ffs() will detect - * this and the first chunk to online will be pageblock_nr_pages. + * PAGES_PER_SECTION - 1, but section size aligned. __ffs() will detect + * this and the first chunk to online will be PAGES_PER_SECTION. */ for (pfn =3D start_pfn; pfn < end_pfn;) { - int order =3D min(MAX_ORDER - 1UL, __ffs(pfn)); + int order =3D min_t(unsigned long, PFN_SECTION_SHIFT, __ffs(pfn)); =20 (*online_page_callback)(pfn_to_page(pfn), order); pfn +=3D (1UL << order); --=20 2.30.2