Received: by 2002:a05:6a10:a852:0:0:0:0 with SMTP id d18csp1465843pxy; Thu, 6 May 2021 08:30:35 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz5Jst+gA5JYXYQMcGSo71JqEjG+juZvqb9spmUATcosRVdqGbwL6Fni+y03cuPKuwh452w X-Received: by 2002:a63:4c0e:: with SMTP id z14mr4873766pga.30.1620315034651; Thu, 06 May 2021 08:30:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1620315034; cv=none; d=google.com; s=arc-20160816; b=jEtthLgNo/Bvg5BT2Jt/UU98klLJZLfton6AcosapmNzi3uR6vfQOaetyZMnx7VxEY 9CdmvgxP9fzYiUFfaQ0stbGJGaspTA5EYia0vUSe31RJfzQcWx+WJH18hbK6ddw2dFI+ HUzQr2wASqfwvctpZwKpw3Su6yUzKZITHURrB3KOogbinAUwylK7T9XWDqbEXVS07e1c OvIsKoBOhfSqKRHslRZDXZEBetbiWqgUe3xIkMf47vG0wIcUcHE7mxPs6R/OOgwaKo7B HFqPdXUqtBSd6dQ8ekiOYHES5mEsknyKSFrVzeiGLRF3gIcc2HjVIT+zJgXzhBhLYCIa 01jA== 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 :message-id:date:subject:cc:to:from:dkim-signature:dkim-signature; bh=idfxFi2niIlXphs1rSRpisMaNeRwPzwfRsm8hAUYBvQ=; b=PZjH4zKzSzczthuzCT7ZC7tG9dlOafqV03L9uJ6tB9F/HdfSKxoMU/DqWQkcZ/bfga VOmMk5UxFNB85KyUjNdkhDV9XWPg4nUo3JgKS2I36dP+a9bFniKfNYriQCOQktyPMvtf spx/hoF7qnwzpn/r2dyLdeuBXkzmjbITgpeOVBRdiOBPEb158lgoVeI7hc/SQoWn2dtT xmbnpw+/JRLn70k2iZdeiSip+8BqcwPYWAutfqInGME++mk8asIsK1ZEvnyLAO82RIut +z3b20GyAp0URiXPgYwOagE/uFRXRTOyDzwtDCQAF47VR95W875qZo+1ftJWHOjXJFyN 8xFg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@sent.com header.s=fm3 header.b=hdYJWH8e; dkim=pass header.i=@messagingengine.com header.s=fm2 header.b="qf4gh/Oo"; 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 q5si3577523pgt.378.2021.05.06.08.30.20; Thu, 06 May 2021 08:30:34 -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=fm3 header.b=hdYJWH8e; dkim=pass header.i=@messagingengine.com header.s=fm2 header.b="qf4gh/Oo"; 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 S235749AbhEFP2y (ORCPT + 99 others); Thu, 6 May 2021 11:28:54 -0400 Received: from new4-smtp.messagingengine.com ([66.111.4.230]:33385 "EHLO new4-smtp.messagingengine.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235495AbhEFP1u (ORCPT ); Thu, 6 May 2021 11:27:50 -0400 Received: from compute5.internal (compute5.nyi.internal [10.202.2.45]) by mailnew.nyi.internal (Postfix) with ESMTP id 42165580B72; Thu, 6 May 2021 11:26:50 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute5.internal (MEProxy); Thu, 06 May 2021 11:26:50 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sent.com; h=from :to:cc:subject:date:message-id:reply-to:mime-version :content-transfer-encoding; s=fm3; bh=idfxFi2niIlXphs1rSRpisMaNe RwPzwfRsm8hAUYBvQ=; b=hdYJWH8eNG6Nd+MRc3r283kN9IufmtoATaqfCU96YH ZKyLzDOs9mGhZSlD83jeL7H3DOqnFDCXn/VXD229UiHg68Vz+1cHYe64OVsP7fXV 7i456IoTE2D8mIiUzaHreIvLE4WMfptERGMoBchm/EYEioelxClLvi0cEjk2Z8se Arvfi8vRUcvLA33pxjnXxQmlCVsyXNryd5LfhOBp+3pZvqI36t6IK+pdROusiIec gXu5SgWTBHSw0qxydioj5F1Ec3AtLzDDc5vIue2gJTGi+JN2UwBs88PaeFZ6CQwn 7QhhXtghvdNckXVzjjQVUrQkB4SzeptEzI7DHQV/sbdw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:date:from :message-id:mime-version:reply-to:subject:to:x-me-proxy :x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm2; bh=idfxFi 2niIlXphs1rSRpisMaNeRwPzwfRsm8hAUYBvQ=; b=qf4gh/OodsbTyJHDo4/xMy XWnV10CwU190E3R4EbQH9v7/GANI/SHKBnKoNo+YtkMbM4Vnc0BA5STeVvOx5JAk QbOEJpYSN6+uvVxGfYHFJ7L3SvqPtmevmMEDxN1/w8HICPWdYg8gr/6WF1OWeC4H x2aX6/hzkjEnSGvUlD4WKg8F33YuV3SGpHhpJSiE/1iJqiNVsfPZAdb84Jetu6qY XNunEtvZhRhT1qIed+Qn+KrN2qp8++eFknjSTrCea322qDnqF8r0r698iXZ52kMQ De9S9QiodAWedpRqKM1DYX+rI3FeGwLbUo0bV5DgW4WFjPJIr4TakXPY/JZ5BjHg == X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduledrvdegtddgkeelucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhephffvufffkfforhgggfestdhqredtredttdenucfhrhhomhepkghiucgjrghn uceoiihirdihrghnsehsvghnthdrtghomheqnecuggftrfgrthhtvghrnhepleetvddtvd dttdetffdvkeehffdtjefhkedtheffjeehvdejueektedukedufeffnecukfhppeefhedr udeigedrvdegiedrfeegnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrg hilhhfrhhomhepiihirdihrghnsehsvghnthdrtghomh X-ME-Proxy: Received: from Threadripper.local (ec2-35-164-246-34.us-west-2.compute.amazonaws.com [35.164.246.34]) by mail.messagingengine.com (Postfix) with ESMTPA; Thu, 6 May 2021 11:26:44 -0400 (EDT) From: Zi Yan To: David Hildenbrand , Oscar Salvador Cc: Michael Ellerman , Benjamin Herrenschmidt , Thomas Gleixner , x86@kernel.org, Andy Lutomirski , "Rafael J . Wysocki" , Andrew Morton , Mike Rapoport , Anshuman Khandual , Michal Hocko , Dan Williams , Wei Yang , linux-ia64@vger.kernel.org, linux-kernel@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-mm@kvack.org, Zi Yan Subject: [RFC PATCH 0/7] Memory hotplug/hotremove at subsection size Date: Thu, 6 May 2021 11:26:16 -0400 Message-Id: <20210506152623.178731-1-zi.yan@sent.com> X-Mailer: git-send-email 2.30.2 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 Hi all, This patchset tries to remove the restriction on memory hotplug/hotremove granularity, which is always greater or equal to memory section size[1]. With the patchset, kernel is able to online/offline memory at a size indepe= ndent of memory section size, as small as 2MB (the subsection size). The motivation is to increase MAX_ORDER of the buddy allocator and pageblock size without increasing memory hotplug/hotremove granularity at the same ti= me, so that the kernel can allocator 1GB pages using buddy allocator and utiliz= es existing pageblock based anti-fragmentation, paving the road for 1GB THP support[2]. The patchset utilizes the existing subsection support[3] and changes the section size alignment checks to subsection size alignment checks. There are also changes to pageblock code to support partial pageblocks, when pageblock size is increased along with MAX_ORDER. Increasing pageblock size can enable kernel to utilize existing anti-fragmentation mechanism for gigantic page allocations. The last patch increases SECTION_SIZE_BITS to demonstrate the use of memory hotplug/hotremove subsection, but is not intended to be merged as is. It is there in case one wants to try this out and will be removed during the final submission. Feel free to give suggestions and comments. I am looking forward to your feedback. Thanks. Zi Yan (7): mm: sparse: set/clear subsection bitmap when pages are onlined/offlined. mm: set pageblock_order to the max of HUGETLB_PAGE_ORDER and MAX_ORDER-1 mm: memory_hotplug: decouple memory_block size with section size. mm: pageblock: allow set/unset migratetype for partial pageblock mm: memory_hotplug, sparse: enable memory hotplug/hotremove subsections arch: x86: no MAX_ORDER exceeds SECTION_SIZE check for 32bit vdso. [not for merge] mm: increase SECTION_SIZE_BITS to 31 arch/ia64/Kconfig | 1 - arch/powerpc/Kconfig | 1 - arch/x86/Kconfig | 15 +++ arch/x86/entry/vdso/Makefile | 1 + arch/x86/include/asm/sparsemem.h | 2 +- drivers/base/memory.c | 176 +++++++++++++++---------------- drivers/base/node.c | 2 +- include/linux/memory.h | 8 +- include/linux/mmzone.h | 2 + include/linux/page-isolation.h | 8 +- include/linux/pageblock-flags.h | 9 -- mm/Kconfig | 7 -- mm/memory_hotplug.c | 22 ++-- mm/page_alloc.c | 40 ++++--- mm/page_isolation.c | 30 +++--- mm/sparse.c | 55 ++++++++-- 16 files changed, 219 insertions(+), 160 deletions(-) --=20 2.30.2