From patchwork Thu Oct 4 22:11:00 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Rapoport X-Patchwork-Id: 10626933 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 1A99A15A6 for ; Thu, 4 Oct 2018 22:11:21 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 09C3B294D6 for ; Thu, 4 Oct 2018 22:11:21 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id EF2B7294F3; Thu, 4 Oct 2018 22:11:20 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 14E90294D6 for ; Thu, 4 Oct 2018 22:11:20 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id E563C6B0269; Thu, 4 Oct 2018 18:11:18 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id E05EC6B026A; Thu, 4 Oct 2018 18:11:18 -0400 (EDT) X-Original-To: int-list-linux-mm@kvack.org X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id CCD5A6B026B; Thu, 4 Oct 2018 18:11:18 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-oi1-f197.google.com (mail-oi1-f197.google.com [209.85.167.197]) by kanga.kvack.org (Postfix) with ESMTP id 9D0426B0269 for ; Thu, 4 Oct 2018 18:11:18 -0400 (EDT) Received: by mail-oi1-f197.google.com with SMTP id h21-v6so6108030oib.16 for ; Thu, 04 Oct 2018 15:11:18 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-original-authentication-results:x-gm-message-state:from:to:cc :subject:date:in-reply-to:references:message-id; bh=g0sXwBSAh3wl72th0AUW5Je99FtiM6UrmqiAX1s1Ij4=; b=oYGdBOasAk5LYuNgj5d1Gyy2K7+52SY11k0OWssodPdCtdqUocD4seV7n9P4STH/FL 9QYanjn+cM3nIybLZB72FTDGckNbN+L3R3y0uPtH70njzuESZQVN+qoCInVlVL1wQchj 2snf7O3J67CZVW3Fw9sMHSSSliut16vnu0Qd0NUZnZfeNbRYQ69XZhYUIcHE8RZ3Ugz6 AlfSRbSCzTH1jOOabXCvPms/EsC7mCyOiTzzdw586FdXXWpfbD+VC36lre6+DHEpVR+s 0KqG3J90LcJsuXkYvFyVyA05aQOOUgDl11LekBXIw7Ot8OpuJA/eQs4dpwkhAPxBU3Vp T9hQ== X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 148.163.156.1 is neither permitted nor denied by best guess record for domain of rppt@linux.vnet.ibm.com) smtp.mailfrom=rppt@linux.vnet.ibm.com; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=ibm.com X-Gm-Message-State: ABuFfojB0P5GNpk8q/g0amhpfJs4QHj2IE42gdUW/YBLSfuOKlLnHUq7 hSJ2hCQ5kBA+DME8f64epUYSPkMEqOQHA0WOTtSbyXUlQ9f7RgdyoriUCH+skFitBxeosp9mg2X 2lUCF8bEMw6wjXdrhJiQ+T0C8Zf6YQl3Mfv+0WwtJ+/O2quvrUSlGtmuL/oR3BV8= X-Received: by 2002:aca:2b0a:: with SMTP id i10-v6mr4213263oik.7.1538691078300; Thu, 04 Oct 2018 15:11:18 -0700 (PDT) X-Google-Smtp-Source: ACcGV61BjEqfShTFdB8tw+r2EBkILaGTUsA/u1O9OuwWeCCdPz8CpY2g4dethyBrN99nXVsU77yq X-Received: by 2002:aca:2b0a:: with SMTP id i10-v6mr4213231oik.7.1538691077182; Thu, 04 Oct 2018 15:11:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1538691076; cv=none; d=google.com; s=arc-20160816; b=Lyo6jFsSsBiPMlf+nxv33vaP9CZvLi8eXFXMc3ZyBCdRPmJwQlV9u08UPeD1/PHmM8 /V2PpiUZjradIQTeMOSq3qq4HZii7TlI6jjuZFjWAS7VQ5uKLa49x2pD6Vo8Kd85aT4c //fJZyBjHwEooBSjcavGHTCjzU2JbFcFgmB8NeDn1/cQE1VWENk5Q30EtdnI/MxKclj6 YyIexMbEcTwziYgi3MaOFlNEdp1uHT7wA0hjVBL1zwMOj6RUlFVqrgEji7DI1YU1XqTJ pT7wUz2T2FLetstIvzfoxCovwI2B7l2VH7GVF2GYsQUlnUIMzbS6/3P2s2PmrAp4yk3b Lkhg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=message-id:references:in-reply-to:date:subject:cc:to:from; bh=g0sXwBSAh3wl72th0AUW5Je99FtiM6UrmqiAX1s1Ij4=; b=OXVxgM4wX6Jn3O3IL3nnuwePX0gVpXbta/etex06ypLQ2Cf4B2k//fPyApof/SAoEw 6Lu5qyzQ7ADgZz7d+cluRyBuv0MrRAMuxXn4qhqzJpfmq8KFKP/L+GQ2u1daWxAXbMyC Y8yW8vhxI9hF2kGZbEDiH/2vPFRCruwZEb9fL/0r90VO1kwcuipPcPEz45F7NoDmZ9Sb GC26njP1KkWY+AsR+vibjso+naNtQ1IySn03aeNvE1cjuoeqDgDVFb8XmmNRnvLpczle tVo5HsaE5PPEvGQsWTN9l1grc2puqn0utkMiae76dsEBEGCjHkrmQyNduhDTFRo2RDuK or7g== ARC-Authentication-Results: i=1; mx.google.com; spf=neutral (google.com: 148.163.156.1 is neither permitted nor denied by best guess record for domain of rppt@linux.vnet.ibm.com) smtp.mailfrom=rppt@linux.vnet.ibm.com; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=ibm.com Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com. [148.163.156.1]) by mx.google.com with ESMTPS id r18si3043717ote.203.2018.10.04.15.11.16 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 04 Oct 2018 15:11:16 -0700 (PDT) Received-SPF: neutral (google.com: 148.163.156.1 is neither permitted nor denied by best guess record for domain of rppt@linux.vnet.ibm.com) client-ip=148.163.156.1; Authentication-Results: mx.google.com; spf=neutral (google.com: 148.163.156.1 is neither permitted nor denied by best guess record for domain of rppt@linux.vnet.ibm.com) smtp.mailfrom=rppt@linux.vnet.ibm.com; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=ibm.com Received: from pps.filterd (m0098394.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.22/8.16.0.22) with SMTP id w94M9Flp124074 for ; Thu, 4 Oct 2018 18:11:16 -0400 Received: from e06smtp04.uk.ibm.com (e06smtp04.uk.ibm.com [195.75.94.100]) by mx0a-001b2d01.pphosted.com with ESMTP id 2mwrs9g1hr-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Thu, 04 Oct 2018 18:11:15 -0400 Received: from localhost by e06smtp04.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Thu, 4 Oct 2018 23:11:13 +0100 Received: from b06cxnps3074.portsmouth.uk.ibm.com (9.149.109.194) by e06smtp04.uk.ibm.com (192.168.101.134) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; (version=TLSv1/SSLv3 cipher=AES256-GCM-SHA384 bits=256/256) Thu, 4 Oct 2018 23:11:11 +0100 Received: from d06av22.portsmouth.uk.ibm.com (d06av22.portsmouth.uk.ibm.com [9.149.105.58]) by b06cxnps3074.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id w94MBAvc62390308 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Thu, 4 Oct 2018 22:11:10 GMT Received: from d06av22.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id DA1E84C04A; Fri, 5 Oct 2018 01:10:49 +0100 (BST) Received: from d06av22.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 6EB844C040; Fri, 5 Oct 2018 01:10:48 +0100 (BST) Received: from rapoport-lnx (unknown [9.148.204.110]) by d06av22.portsmouth.uk.ibm.com (Postfix) with ESMTPS; Fri, 5 Oct 2018 01:10:48 +0100 (BST) Received: by rapoport-lnx (sSMTP sendmail emulation); Fri, 05 Oct 2018 01:11:07 +0300 From: Mike Rapoport To: Jonathan Corbet Cc: linux-doc@vger.kernel.org, linux-mm@kvack.org, Mike Rapoport Subject: [PATCH 1/2] docs: move memory hotplug description into admin-guide/mm Date: Fri, 5 Oct 2018 01:11:00 +0300 X-Mailer: git-send-email 2.7.4 In-Reply-To: <1538691061-31289-1-git-send-email-rppt@linux.vnet.ibm.com> References: <1538691061-31289-1-git-send-email-rppt@linux.vnet.ibm.com> X-TM-AS-GCONF: 00 x-cbid: 18100422-0016-0000-0000-0000020EA8B2 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 18100422-0017-0000-0000-00003265F6FF Message-Id: <1538691061-31289-2-git-send-email-rppt@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:,, definitions=2018-10-04_09:,, signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 suspectscore=0 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 mlxscore=0 impostorscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1807170000 definitions=main-1810040199 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: X-Virus-Scanned: ClamAV using ClamSMTP The memory hotplug description in Documentation/memory-hotplug.txt is already formatted as ReST and can be easily added to admin-guide/mm section. While on it, slightly update formatting to make it consistent with the doc-guide. Signed-off-by: Mike Rapoport --- Documentation/admin-guide/mm/index.rst | 1 + .../mm/memory-hotplug.rst} | 73 +++++++++++----------- 2 files changed, 38 insertions(+), 36 deletions(-) rename Documentation/{memory-hotplug.txt => admin-guide/mm/memory-hotplug.rst} (92%) diff --git a/Documentation/admin-guide/mm/index.rst b/Documentation/admin-guide/mm/index.rst index ceead68..8edb35f 100644 --- a/Documentation/admin-guide/mm/index.rst +++ b/Documentation/admin-guide/mm/index.rst @@ -29,6 +29,7 @@ the Linux memory management. hugetlbpage idle_page_tracking ksm + memory-hotplug numa_memory_policy pagemap soft-dirty diff --git a/Documentation/memory-hotplug.txt b/Documentation/admin-guide/mm/memory-hotplug.rst similarity index 92% rename from Documentation/memory-hotplug.txt rename to Documentation/admin-guide/mm/memory-hotplug.rst index 7f49ebf..a33090c 100644 --- a/Documentation/memory-hotplug.txt +++ b/Documentation/admin-guide/mm/memory-hotplug.rst @@ -1,3 +1,5 @@ +.. _admin_guide_memory_hotplug: + ============== Memory Hotplug ============== @@ -9,10 +11,12 @@ This document is about memory hotplug including how-to-use and current status. Because Memory Hotplug is still under development, contents of this text will be changed often. +.. contents:: :local: + .. CONTENTS 1. Introduction - 1.1 purpose of memory hotplug + 1.1 Purpose of memory hotplug 1.2. Phases of memory hotplug 1.3. Unit of Memory online/offline operation 2. Kernel Configuration @@ -35,13 +39,13 @@ be changed often. (1) x86_64's has special implementation for memory hotplug. This text does not describe it. - (2) This text assumes that sysfs is mounted at /sys. + (2) This text assumes that sysfs is mounted at ``/sys``. Introduction ============ -purpose of memory hotplug +Purpose of memory hotplug ------------------------- Memory Hotplug allows users to increase/decrease the amount of memory. @@ -57,7 +61,6 @@ hardware which supports memory power management. Linux memory hotplug is designed for both purpose. - Phases of memory hotplug ------------------------ @@ -92,7 +95,6 @@ phase by hand. (However, if you writes udev's hotplug scripts for memory hotplug, these phases can be execute in seamless way.) - Unit of Memory online/offline operation --------------------------------------- @@ -107,10 +109,9 @@ unit upon which memory online/offline operations are to be performed. The default size of a memory block is the same as memory section size unless an architecture specifies otherwise. (see :ref:`memory_hotplug_sysfs_files`.) -To determine the size (in bytes) of a memory block please read this file: - -/sys/devices/system/memory/block_size_bytes +To determine the size (in bytes) of a memory block please read this file:: + /sys/devices/system/memory/block_size_bytes Kernel Configuration ==================== @@ -119,22 +120,22 @@ To use memory hotplug feature, kernel must be compiled with following config options. - For all memory hotplug: - - Memory model -> Sparse Memory (CONFIG_SPARSEMEM) - - Allow for memory hot-add (CONFIG_MEMORY_HOTPLUG) + - Memory model -> Sparse Memory (``CONFIG_SPARSEMEM``) + - Allow for memory hot-add (``CONFIG_MEMORY_HOTPLUG``) - To enable memory removal, the following are also necessary: - - Allow for memory hot remove (CONFIG_MEMORY_HOTREMOVE) - - Page Migration (CONFIG_MIGRATION) + - Allow for memory hot remove (``CONFIG_MEMORY_HOTREMOVE``) + - Page Migration (``CONFIG_MIGRATION``) - For ACPI memory hotplug, the following are also necessary: - - Memory hotplug (under ACPI Support menu) (CONFIG_ACPI_HOTPLUG_MEMORY) + - Memory hotplug (under ACPI Support menu) (``CONFIG_ACPI_HOTPLUG_MEMORY``) - This option can be kernel module. - As a related configuration, if your box has a feature of NUMA-node hotplug via ACPI, then this option is necessary too. - ACPI0004,PNP0A05 and PNP0A06 Container Driver (under ACPI Support menu) - (CONFIG_ACPI_CONTAINER). + (``CONFIG_ACPI_CONTAINER``). This option can be kernel module too. @@ -145,10 +146,11 @@ sysfs files for memory hotplug ============================== All memory blocks have their device information in sysfs. Each memory block -is described under /sys/devices/system/memory as: +is described under ``/sys/devices/system/memory`` as:: /sys/devices/system/memory/memoryXXX - (XXX is the memory block id.) + +where XXX is the memory block id. For the memory block covered by the sysfs directory. It is expected that all memory sections in this range are present and no memory holes exist in the @@ -157,7 +159,7 @@ the existence of one should not affect the hotplug capabilities of the memory block. For example, assume 1GiB memory block size. A device for a memory starting at -0x100000000 is /sys/device/system/memory/memory4:: +0x100000000 is ``/sys/device/system/memory/memory4``:: (0x100000000 / 1Gib = 4) @@ -165,11 +167,11 @@ This device covers address range [0x100000000 ... 0x140000000) Under each memory block, you can see 5 files: -- /sys/devices/system/memory/memoryXXX/phys_index -- /sys/devices/system/memory/memoryXXX/phys_device -- /sys/devices/system/memory/memoryXXX/state -- /sys/devices/system/memory/memoryXXX/removable -- /sys/devices/system/memory/memoryXXX/valid_zones +- ``/sys/devices/system/memory/memoryXXX/phys_index`` +- ``/sys/devices/system/memory/memoryXXX/phys_device`` +- ``/sys/devices/system/memory/memoryXXX/state`` +- ``/sys/devices/system/memory/memoryXXX/removable`` +- ``/sys/devices/system/memory/memoryXXX/valid_zones`` =================== ============================================================ ``phys_index`` read-only and contains memory block id, same as XXX. @@ -207,13 +209,15 @@ Under each memory block, you can see 5 files: These directories/files appear after physical memory hotplug phase. If CONFIG_NUMA is enabled the memoryXXX/ directories can also be accessed -via symbolic links located in the /sys/devices/system/node/node* directories. +via symbolic links located in the ``/sys/devices/system/node/node*`` directories. + +For example:: -For example: -/sys/devices/system/node/node0/memory9 -> ../../memory/memory9 + /sys/devices/system/node/node0/memory9 -> ../../memory/memory9 -A backlink will also be created: -/sys/devices/system/memory/memory9/node0 -> ../../node/node0 +A backlink will also be created:: + + /sys/devices/system/memory/memory9/node0 -> ../../node/node0 .. _memory_hotplug_physical_mem: @@ -240,7 +244,6 @@ If firmware supports NUMA-node hotplug, and defines an object _HID "ACPI0004", calls hotplug code for all of objects which are defined in it. If memory device is found, memory hotplug code will be called. - Notify memory hot-add event by hand ----------------------------------- @@ -251,8 +254,9 @@ CONFIG_ARCH_MEMORY_PROBE and can be configured on powerpc, sh, and x86 if hotplug is supported, although for x86 this should be handled by ACPI notification. -Probe interface is located at -/sys/devices/system/memory/probe +Probe interface is located at:: + + /sys/devices/system/memory/probe You can tell the physical address of new memory to the kernel by:: @@ -263,7 +267,6 @@ memory_block_size] memory range is hot-added. In this case, hotplug script is not called (in current implementation). You'll have to online memory by yourself. Please see :ref:`memory_hotplug_how_to_online_memory`. - Logical Memory hot-add phase ============================ @@ -301,7 +304,7 @@ This sets a global policy and impacts all memory blocks that will subsequently be hotplugged. Currently offline blocks keep their state. It is possible, under certain circumstances, that some memory blocks will be added but will fail to online. User space tools can check their "state" files -(/sys/devices/system/memory/memoryXXX/state) and try to online them manually. +(``/sys/devices/system/memory/memoryXXX/state``) and try to online them manually. If the automatic onlining wasn't requested, failed, or some memory block was offlined it is possible to change the individual block's state by writing to the @@ -334,8 +337,6 @@ available memory will be increased. This may be changed in future. - - Logical memory remove ===================== @@ -418,7 +419,7 @@ Memory hotplug event notifier Hotplugging events are sent to a notification queue. -There are six types of notification defined in include/linux/memory.h: +There are six types of notification defined in ``include/linux/memory.h``: MEM_GOING_ONLINE Generated before new memory becomes available in order to be able to @@ -485,7 +486,7 @@ The third argument (arg) passes a pointer of struct memory_notify:: The callback routine shall return one of the values NOTIFY_DONE, NOTIFY_OK, NOTIFY_BAD, NOTIFY_STOP -defined in include/linux/notifier.h +defined in ``include/linux/notifier.h`` NOTIFY_DONE and NOTIFY_OK have no effect on the further processing. From patchwork Thu Oct 4 22:11:01 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Rapoport X-Patchwork-Id: 10626935 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 8ACF41731 for ; Thu, 4 Oct 2018 22:11:27 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 782CE294D6 for ; Thu, 4 Oct 2018 22:11:27 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 6A53B294F3; Thu, 4 Oct 2018 22:11:27 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A196C294D6 for ; Thu, 4 Oct 2018 22:11:26 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 3A8486B026B; Thu, 4 Oct 2018 18:11:25 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 32EE96B026C; Thu, 4 Oct 2018 18:11:25 -0400 (EDT) X-Original-To: int-list-linux-mm@kvack.org X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 1D0D76B026D; Thu, 4 Oct 2018 18:11:25 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-oi1-f197.google.com (mail-oi1-f197.google.com [209.85.167.197]) by kanga.kvack.org (Postfix) with ESMTP id DDCEF6B026B for ; Thu, 4 Oct 2018 18:11:24 -0400 (EDT) Received: by mail-oi1-f197.google.com with SMTP id p11-v6so7309824oih.17 for ; Thu, 04 Oct 2018 15:11:24 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-original-authentication-results:x-gm-message-state:from:to:cc :subject:date:in-reply-to:references:message-id; bh=SKedq4/6cNxZ3Fyelu+y4RSRtNmFL6vsSGS+ksYjzdg=; b=jG7INjCEqKX02iOcl7b8ifuCKE2cZYwpaMRJfWwguyIPHKuS2yP6KjuJOi8uXK2Gm+ g79zeFfjqbG0Ou2LLW5/Dw0aKmgre09G395BkeHa6lYKCD6bAMJwMFxjjEuG1ljUSVE0 +lEarZ0R3K+IVBpS3XEUqQZLDIRexGHhHpVsMDdcDC9+VoGDYk4oOyCuMfcAeXJx7+i8 JgW3dvFkvuzfmOsu708tg1pxR6Yt2oIKApwbarGlsk6TYfZKtgQJTWMgYrJT9GLte9Qc 63MJh8eeDLaQ23q0iiyL6O2nQSN7kIfOOtWsa3NgvZXpTjIVGcrxhMecF/AEfDMPgdDJ UFeQ== X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 148.163.156.1 is neither permitted nor denied by best guess record for domain of rppt@linux.vnet.ibm.com) smtp.mailfrom=rppt@linux.vnet.ibm.com; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=ibm.com X-Gm-Message-State: ABuFfoiGVFMvVxwiWxDB2aNQRN4vNPZRDdJmQ4OKlzc0PoIMMzE4T8+q I2L0WxLwHxJCl6P/W5LSvSROkvn+MUcaW1+HsUGR+XH5xw2qJIMQA1fzDbmB4P9Hugoi2qJD54n 4tgYDbKR44dCw4CHunLvfX7TMqvsbkzo4AnkdZ2shoFozcW2znLArB1c9fR5vAgI= X-Received: by 2002:aca:3b42:: with SMTP id i63-v6mr1451832oia.312.1538691084587; Thu, 04 Oct 2018 15:11:24 -0700 (PDT) X-Google-Smtp-Source: ACcGV63CzjHFViLjOdGspFNtKMWtVmtB2z0eCijsc29WgF8+qQCTK9GLzop3J1Wd+dgpEp9JHmQd X-Received: by 2002:aca:3b42:: with SMTP id i63-v6mr1451794oia.312.1538691083337; Thu, 04 Oct 2018 15:11:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1538691083; cv=none; d=google.com; s=arc-20160816; b=Y5UdjvFmrFEvSwtV3YpNlceb049kIMMkNKOB9FIjqdm9LwNrc6C/C+9jouqruXBm14 DNbfIlHjrcxJQuA5Xo3cYpQkhrfhAh/Ojk0/05KGvk4nxQxT9J98202xziI/qrmfjjDa O5LS/XmGScxfvWc8pxgjHsx7eWYd/tDTQ7jI9Bf7kJbLdiB2XT4F+6Di0GPVozAZ+UK7 otw9f2WojOMxiAoarmcs4pQ1dumBUTJy/cDBOkq8fF5Jh5cUE/3T/a10bHYZ5GjwAINS QDeriRnZd9o8dRzdnmdYvI17zfA/ta56yijX8jCWl45HpKpA4VG6kbVA5eqU/jeBwLrf d6yA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=message-id:references:in-reply-to:date:subject:cc:to:from; bh=SKedq4/6cNxZ3Fyelu+y4RSRtNmFL6vsSGS+ksYjzdg=; b=W8gKUdOeTBdgk3voac8uLOKlyBWnvSq4cmcMS9XT7WnKcOWtnlJ3PGP0nsRzqedvMk V30XfR+FPK4qXLxw/xE9zd0mi0ht+v3bVN4wRk802T48uZ+pxvrOvzLyeZD+Qer7R7UJ E2bII4BMfKn1wZgowzY/KqbFQjxAOZaFiwV9C/Ek2kkUE2rz+nHwAs6iUJgSVBv8IcMH xvie2cweEwnS+8905W5Qsi97licphHmdpjnlwDl+tatKSUbCtYcJ+w0CP2TEIbWzG7/1 FHy0dYA3DqRdnBexUeKr/B1sNr+l4SUIYbvPbvJAiyaYD1AT0Sgb9cGaGu9T/Ns6LyI9 kMQw== ARC-Authentication-Results: i=1; mx.google.com; spf=neutral (google.com: 148.163.156.1 is neither permitted nor denied by best guess record for domain of rppt@linux.vnet.ibm.com) smtp.mailfrom=rppt@linux.vnet.ibm.com; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=ibm.com Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com. [148.163.156.1]) by mx.google.com with ESMTPS id g1-v6si3137101otb.294.2018.10.04.15.11.23 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 04 Oct 2018 15:11:23 -0700 (PDT) Received-SPF: neutral (google.com: 148.163.156.1 is neither permitted nor denied by best guess record for domain of rppt@linux.vnet.ibm.com) client-ip=148.163.156.1; Authentication-Results: mx.google.com; spf=neutral (google.com: 148.163.156.1 is neither permitted nor denied by best guess record for domain of rppt@linux.vnet.ibm.com) smtp.mailfrom=rppt@linux.vnet.ibm.com; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=ibm.com Received: from pps.filterd (m0098394.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.22/8.16.0.22) with SMTP id w94M9FCT124116 for ; Thu, 4 Oct 2018 18:11:22 -0400 Received: from e06smtp05.uk.ibm.com (e06smtp05.uk.ibm.com [195.75.94.101]) by mx0a-001b2d01.pphosted.com with ESMTP id 2mwrs9g1qd-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Thu, 04 Oct 2018 18:11:22 -0400 Received: from localhost by e06smtp05.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Thu, 4 Oct 2018 23:11:20 +0100 Received: from b06cxnps3075.portsmouth.uk.ibm.com (9.149.109.195) by e06smtp05.uk.ibm.com (192.168.101.135) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; (version=TLSv1/SSLv3 cipher=AES256-GCM-SHA384 bits=256/256) Thu, 4 Oct 2018 23:11:17 +0100 Received: from d06av23.portsmouth.uk.ibm.com (d06av23.portsmouth.uk.ibm.com [9.149.105.59]) by b06cxnps3075.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id w94MBGqS65273894 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Thu, 4 Oct 2018 22:11:16 GMT Received: from d06av23.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 25422A4053; Fri, 5 Oct 2018 01:10:53 +0100 (BST) Received: from d06av23.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id AE787A4051; Fri, 5 Oct 2018 01:10:51 +0100 (BST) Received: from rapoport-lnx (unknown [9.148.204.110]) by d06av23.portsmouth.uk.ibm.com (Postfix) with ESMTPS; Fri, 5 Oct 2018 01:10:51 +0100 (BST) Received: by rapoport-lnx (sSMTP sendmail emulation); Fri, 05 Oct 2018 01:11:14 +0300 From: Mike Rapoport To: Jonathan Corbet Cc: linux-doc@vger.kernel.org, linux-mm@kvack.org, Mike Rapoport Subject: [PATCH 2/2] docs/vm: split memory hotplug notifier description to Documentation/core-api Date: Fri, 5 Oct 2018 01:11:01 +0300 X-Mailer: git-send-email 2.7.4 In-Reply-To: <1538691061-31289-1-git-send-email-rppt@linux.vnet.ibm.com> References: <1538691061-31289-1-git-send-email-rppt@linux.vnet.ibm.com> X-TM-AS-GCONF: 00 x-cbid: 18100422-0020-0000-0000-000002CFAB38 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 18100422-0021-0000-0000-0000211DFC79 Message-Id: <1538691061-31289-3-git-send-email-rppt@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:,, definitions=2018-10-04_09:,, signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 suspectscore=2 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 mlxscore=0 impostorscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1807170000 definitions=main-1810040199 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: X-Virus-Scanned: ClamAV using ClamSMTP The memory hotplug notifier description is about kernel internals rather than admin/user visible API. Place it appropriately. Signed-off-by: Mike Rapoport Signed-off-by: Mike Rapoport --- Documentation/admin-guide/mm/memory-hotplug.rst | 83 --------------------- Documentation/core-api/index.rst | 2 + Documentation/core-api/memory-hotplug-notifier.rst | 84 ++++++++++++++++++++++ 3 files changed, 86 insertions(+), 83 deletions(-) create mode 100644 Documentation/core-api/memory-hotplug-notifier.rst diff --git a/Documentation/admin-guide/mm/memory-hotplug.rst b/Documentation/admin-guide/mm/memory-hotplug.rst index a33090c..0b9c83e 100644 --- a/Documentation/admin-guide/mm/memory-hotplug.rst +++ b/Documentation/admin-guide/mm/memory-hotplug.rst @@ -31,7 +31,6 @@ be changed often. 6.1 Memory offline and ZONE_MOVABLE 6.2. How to offline memory 7. Physical memory remove - 8. Memory hotplug event notifier 9. Future Work List @@ -414,88 +413,6 @@ Need more implementation yet.... - Notification completion of remove works by OS to firmware. - Guard from remove if not yet. -Memory hotplug event notifier -============================= - -Hotplugging events are sent to a notification queue. - -There are six types of notification defined in ``include/linux/memory.h``: - -MEM_GOING_ONLINE - Generated before new memory becomes available in order to be able to - prepare subsystems to handle memory. The page allocator is still unable - to allocate from the new memory. - -MEM_CANCEL_ONLINE - Generated if MEMORY_GOING_ONLINE fails. - -MEM_ONLINE - Generated when memory has successfully brought online. The callback may - allocate pages from the new memory. - -MEM_GOING_OFFLINE - Generated to begin the process of offlining memory. Allocations are no - longer possible from the memory but some of the memory to be offlined - is still in use. The callback can be used to free memory known to a - subsystem from the indicated memory block. - -MEM_CANCEL_OFFLINE - Generated if MEMORY_GOING_OFFLINE fails. Memory is available again from - the memory block that we attempted to offline. - -MEM_OFFLINE - Generated after offlining memory is complete. - -A callback routine can be registered by calling:: - - hotplug_memory_notifier(callback_func, priority) - -Callback functions with higher values of priority are called before callback -functions with lower values. - -A callback function must have the following prototype:: - - int callback_func( - struct notifier_block *self, unsigned long action, void *arg); - -The first argument of the callback function (self) is a pointer to the block -of the notifier chain that points to the callback function itself. -The second argument (action) is one of the event types described above. -The third argument (arg) passes a pointer of struct memory_notify:: - - struct memory_notify { - unsigned long start_pfn; - unsigned long nr_pages; - int status_change_nid_normal; - int status_change_nid_high; - int status_change_nid; - } - -- start_pfn is start_pfn of online/offline memory. -- nr_pages is # of pages of online/offline memory. -- status_change_nid_normal is set node id when N_NORMAL_MEMORY of nodemask - is (will be) set/clear, if this is -1, then nodemask status is not changed. -- status_change_nid_high is set node id when N_HIGH_MEMORY of nodemask - is (will be) set/clear, if this is -1, then nodemask status is not changed. -- status_change_nid is set node id when N_MEMORY of nodemask is (will be) - set/clear. It means a new(memoryless) node gets new memory by online and a - node loses all memory. If this is -1, then nodemask status is not changed. - - If status_changed_nid* >= 0, callback should create/discard structures for the - node if necessary. - -The callback routine shall return one of the values -NOTIFY_DONE, NOTIFY_OK, NOTIFY_BAD, NOTIFY_STOP -defined in ``include/linux/notifier.h`` - -NOTIFY_DONE and NOTIFY_OK have no effect on the further processing. - -NOTIFY_BAD is used as response to the MEM_GOING_ONLINE, MEM_GOING_OFFLINE, -MEM_ONLINE, or MEM_OFFLINE action to cancel hotplugging. It stops -further processing of the notification queue. - -NOTIFY_STOP stops further processing of the notification queue. - Future Work =========== diff --git a/Documentation/core-api/index.rst b/Documentation/core-api/index.rst index 165d7688..4f8a426 100644 --- a/Documentation/core-api/index.rst +++ b/Documentation/core-api/index.rst @@ -32,6 +32,8 @@ Core utilities gfp_mask-from-fs-io timekeeping boot-time-mm + memory-hotplug-notifier + Interfaces for kernel debugging =============================== diff --git a/Documentation/core-api/memory-hotplug-notifier.rst b/Documentation/core-api/memory-hotplug-notifier.rst new file mode 100644 index 0000000..35347cc --- /dev/null +++ b/Documentation/core-api/memory-hotplug-notifier.rst @@ -0,0 +1,84 @@ +.. _memory_hotplug_notifier: + +============================= +Memory hotplug event notifier +============================= + +Hotplugging events are sent to a notification queue. + +There are six types of notification defined in ``include/linux/memory.h``: + +MEM_GOING_ONLINE + Generated before new memory becomes available in order to be able to + prepare subsystems to handle memory. The page allocator is still unable + to allocate from the new memory. + +MEM_CANCEL_ONLINE + Generated if MEM_GOING_ONLINE fails. + +MEM_ONLINE + Generated when memory has successfully brought online. The callback may + allocate pages from the new memory. + +MEM_GOING_OFFLINE + Generated to begin the process of offlining memory. Allocations are no + longer possible from the memory but some of the memory to be offlined + is still in use. The callback can be used to free memory known to a + subsystem from the indicated memory block. + +MEM_CANCEL_OFFLINE + Generated if MEM_GOING_OFFLINE fails. Memory is available again from + the memory block that we attempted to offline. + +MEM_OFFLINE + Generated after offlining memory is complete. + +A callback routine can be registered by calling:: + + hotplug_memory_notifier(callback_func, priority) + +Callback functions with higher values of priority are called before callback +functions with lower values. + +A callback function must have the following prototype:: + + int callback_func( + struct notifier_block *self, unsigned long action, void *arg); + +The first argument of the callback function (self) is a pointer to the block +of the notifier chain that points to the callback function itself. +The second argument (action) is one of the event types described above. +The third argument (arg) passes a pointer of struct memory_notify:: + + struct memory_notify { + unsigned long start_pfn; + unsigned long nr_pages; + int status_change_nid_normal; + int status_change_nid_high; + int status_change_nid; + } + +- start_pfn is start_pfn of online/offline memory. +- nr_pages is # of pages of online/offline memory. +- status_change_nid_normal is set node id when N_NORMAL_MEMORY of nodemask + is (will be) set/clear, if this is -1, then nodemask status is not changed. +- status_change_nid_high is set node id when N_HIGH_MEMORY of nodemask + is (will be) set/clear, if this is -1, then nodemask status is not changed. +- status_change_nid is set node id when N_MEMORY of nodemask is (will be) + set/clear. It means a new(memoryless) node gets new memory by online and a + node loses all memory. If this is -1, then nodemask status is not changed. + + If status_changed_nid* >= 0, callback should create/discard structures for the + node if necessary. + +The callback routine shall return one of the values +NOTIFY_DONE, NOTIFY_OK, NOTIFY_BAD, NOTIFY_STOP +defined in ``include/linux/notifier.h`` + +NOTIFY_DONE and NOTIFY_OK have no effect on the further processing. + +NOTIFY_BAD is used as response to the MEM_GOING_ONLINE, MEM_GOING_OFFLINE, +MEM_ONLINE, or MEM_OFFLINE action to cancel hotplugging. It stops +further processing of the notification queue. + +NOTIFY_STOP stops further processing of the notification queue.