From patchwork Thu Aug 5 19:02:43 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zi Yan X-Patchwork-Id: 12421865 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=-15.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,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 13DE0C4338F for ; Thu, 5 Aug 2021 19:03:56 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id BD84860F01 for ; Thu, 5 Aug 2021 19:03:55 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org BD84860F01 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=sent.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=kvack.org Received: by kanga.kvack.org (Postfix) id C7EB06B007B; Thu, 5 Aug 2021 15:03:50 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id BB8826B007D; Thu, 5 Aug 2021 15:03:50 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id A58E86B007E; Thu, 5 Aug 2021 15:03:50 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0118.hostedemail.com [216.40.44.118]) by kanga.kvack.org (Postfix) with ESMTP id 838226B007B for ; Thu, 5 Aug 2021 15:03:50 -0400 (EDT) Received: from smtpin13.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id 2E09818016129 for ; Thu, 5 Aug 2021 19:03:50 +0000 (UTC) X-FDA: 78441951420.13.5CB12C1 Received: from out2-smtp.messagingengine.com (out2-smtp.messagingengine.com [66.111.4.26]) by imf27.hostedemail.com (Postfix) with ESMTP id D39357001F78 for ; Thu, 5 Aug 2021 19:03:49 +0000 (UTC) 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 Authentication-Results: imf27.hostedemail.com; dkim=pass header.d=sent.com header.s=fm1 header.b=Eig43P7o; dkim=pass header.d=messagingengine.com header.s=fm3 header.b=rprndRDD; dmarc=pass (policy=none) header.from=sent.com; spf=pass (imf27.hostedemail.com: domain of zi.yan@sent.com designates 66.111.4.26 as permitted sender) smtp.mailfrom=zi.yan@sent.com X-Stat-Signature: 1naw3m3k66ert5cecyaqmt3hfn41sreg X-Rspamd-Queue-Id: D39357001F78 X-Rspamd-Server: rspam01 X-HE-Tag: 1628190229-419032 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: 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_pfn, unsigned long nr_pages) unsigned long pfn; /* - * 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 = start_pfn; pfn < end_pfn;) { - int order = min(MAX_ORDER - 1UL, __ffs(pfn)); + int order = min_t(unsigned long, PFN_SECTION_SHIFT, __ffs(pfn)); (*online_page_callback)(pfn_to_page(pfn), order); pfn += (1UL << order);