From patchwork Sat Jun 30 14:55: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: 10498237 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 85BEB60230 for ; Sat, 30 Jun 2018 14:55:37 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 76AA62906E for ; Sat, 30 Jun 2018 14:55:37 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 68E2828F7E; Sat, 30 Jun 2018 14:55:37 +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 DEFAD28F7E for ; Sat, 30 Jun 2018 14:55:36 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id E45E56B026C; Sat, 30 Jun 2018 10:55:33 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id DD0BF6B026D; Sat, 30 Jun 2018 10:55:33 -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 C47EB6B026E; Sat, 30 Jun 2018 10:55:33 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-ed1-f70.google.com (mail-ed1-f70.google.com [209.85.208.70]) by kanga.kvack.org (Postfix) with ESMTP id 5BBF06B026C for ; Sat, 30 Jun 2018 10:55:33 -0400 (EDT) Received: by mail-ed1-f70.google.com with SMTP id t11-v6so558844edq.1 for ; Sat, 30 Jun 2018 07:55:33 -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=2aMrD2jUXRiWix9LDwk+oZ8aw0E3Y6qaWzxanhYiG/I=; b=Z0H/HOGre/Pvh54ResHyPs97YuEc2zQwb6FB22d8h4+NnJ5/Ik9p6avDhhVm7iwnzc fM6F9wWCFQtJ6sEZNhEs/6Lxx8+YSXYtKajZy7po7Loa95NBMWl+Rb9RT7pC/qLoUTyt nsVY0x+u1+DWeOqtuFltyoRXZzxBQ64ge3sneGoFdoBJuTBIAgwdGQ+5QX0dCehVjRwa 5K+XqlfVHeic1GLcUAAoaaB8enJKI6MA+z+60onqdbpDO72CHtWh9Hx+jNX/rp4pmJTM ZqS9XbwG9nImpOrM1eMnoSZfzN4YfICu5QREIYKsZn07vJo7u/AognmcSZYdDu5g+PJN Ya3Q== 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: APt69E0e5WkI/QrBwzqYWfF8mtvzTtzvaHHjWsAqqSQ7+7BO1QQVg973 us4ccu2ivRgbnIIgfCwrUPWWzWZCS+XFee7VvLwPeR0SiL7kubnlNrQVlhnuHEm7BkRo7wBIziM J7R21p8BaxTCzDS4heOcPpIC4aUXIJlO51N3OiwZR20n6wb359cy9Degow/pDRBM= X-Received: by 2002:aa7:da9a:: with SMTP id q26-v6mr1957085eds.115.1530370532923; Sat, 30 Jun 2018 07:55:32 -0700 (PDT) X-Google-Smtp-Source: AAOMgpdfa9AXzdf3MwhUVScyvaZ52MAnF96E6SbqIG5Fv8afc0rKhLSUBnj61AJ2WjBWtGwluPB6 X-Received: by 2002:aa7:da9a:: with SMTP id q26-v6mr1957051eds.115.1530370532162; Sat, 30 Jun 2018 07:55:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1530370532; cv=none; d=google.com; s=arc-20160816; b=IZ/HXQZ4TEit3Ex4x3qgI9m6fBw3HhxJEJmQufQ4mgsQYT0a/YUJr5ULrRGqVImCWk fvGVFp9J6OFKFcu83m23/XMwnAiKHYseeyom5Rp+AIbirWPlaLJtpUqYOUespd/u/Zjj MrinddcWXwPgPqpZ2a/UHycBWpnirfvBw1Tw1JA56EShA1meHHBl4hk62OG+azotuoSg 1GF/oMkG9G7s+DVnLvt3DQlLcOJUX197CrZT9UpOX5flOTTENE6XVJCepNEs4vemfSp5 29dxOtFjwpc/QWLCzX2uoqa07ELKaVqv+QISnyUcPS8LzhCyuGVQks6zCh8C5wdgfctu 5XSw== 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 :arc-authentication-results; bh=2aMrD2jUXRiWix9LDwk+oZ8aw0E3Y6qaWzxanhYiG/I=; b=ptMaeFAF0+hP2/vHYJWJYZMtyUFAj+IwY7ACGYn0RwU7RX9ETSInVKqWs19dN9Tv2G LT7Li40l96q30ZsRa9DAGB51MEZvbYkaKTOHwyAhamW4VTGo/LevxZND92oP8D/HslF9 GqL/x9bb16mB0uS/Xz2e+wivQBqzEtZrZbJC6wUTP2urjwQgIqpRBc6QZ3KKHIRbeH7g tokK/mLs35P7mXUxmqBE1KUdntRAouLah7h8H0J82bCxM+3ia1sVYfkyYJu+7VDOa9gU MIYLGWyJbnFYNvtndLksnhuiyQw6ZH36FS1jpt2iDuU4kwAffsHSOmaI+an9TfuZmduQ LWeg== 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 f5-v6si7350927eda.356.2018.06.30.07.55.31 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 30 Jun 2018 07:55:32 -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 (m0098409.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.22/8.16.0.22) with SMTP id w5UErVko035217 for ; Sat, 30 Jun 2018 10:55:29 -0400 Received: from e06smtp01.uk.ibm.com (e06smtp01.uk.ibm.com [195.75.94.97]) by mx0a-001b2d01.pphosted.com with ESMTP id 2jx562u9t0-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Sat, 30 Jun 2018 10:55:29 -0400 Received: from localhost by e06smtp01.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Sat, 30 Jun 2018 15:55:27 +0100 Received: from b06cxnps4075.portsmouth.uk.ibm.com (9.149.109.197) by e06smtp01.uk.ibm.com (192.168.101.131) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; (version=TLSv1/SSLv3 cipher=AES256-GCM-SHA384 bits=256/256) Sat, 30 Jun 2018 15:55:23 +0100 Received: from d06av25.portsmouth.uk.ibm.com (d06av25.portsmouth.uk.ibm.com [9.149.105.61]) by b06cxnps4075.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id w5UEtMDH40698100 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Sat, 30 Jun 2018 14:55:22 GMT Received: from d06av25.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id F214411C052; Sat, 30 Jun 2018 15:55:08 +0100 (BST) Received: from d06av25.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 61B1E11C04C; Sat, 30 Jun 2018 15:55:07 +0100 (BST) Received: from rapoport-lnx (unknown [9.148.205.240]) by d06av25.portsmouth.uk.ibm.com (Postfix) with ESMTPS; Sat, 30 Jun 2018 15:55:07 +0100 (BST) Received: by rapoport-lnx (sSMTP sendmail emulation); Sat, 30 Jun 2018 17:55:20 +0300 From: Mike Rapoport To: Jonathan Corbet Cc: Randy Dunlap , linux-doc , linux-mm , lkml , Mike Rapoport Subject: [PATCH v2 05/11] docs/mm: bootmem: add overview documentation Date: Sat, 30 Jun 2018 17:55:00 +0300 X-Mailer: git-send-email 2.7.4 In-Reply-To: <1530370506-21751-1-git-send-email-rppt@linux.vnet.ibm.com> References: <1530370506-21751-1-git-send-email-rppt@linux.vnet.ibm.com> X-TM-AS-GCONF: 00 x-cbid: 18063014-4275-0000-0000-00000293AA14 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 18063014-4276-0000-0000-0000379B1E27 Message-Id: <1530370506-21751-6-git-send-email-rppt@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:, , definitions=2018-06-30_05:, , 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-1806210000 definitions=main-1806300176 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 Signed-off-by: Mike Rapoport --- mm/bootmem.c | 47 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) diff --git a/mm/bootmem.c b/mm/bootmem.c index 76fc17e..97db0e8 100644 --- a/mm/bootmem.c +++ b/mm/bootmem.c @@ -21,6 +21,53 @@ #include "internal.h" +/** + * DOC: bootmem overview + * + * Bootmem is a boot-time physical memory allocator and configurator. + * + * It is used early in the boot process before the page allocator is + * set up. + * + * Bootmem is based on the most basic of allocators, a First Fit + * allocator which uses a bitmap to represent memory. If a bit is 1, + * the page is allocated and 0 if unallocated. To satisfy allocations + * of sizes smaller than a page, the allocator records the Page Frame + * Number (PFN) of the last allocation and the offset the allocation + * ended at. Subsequent small allocations are merged together and + * stored on the same page. + * + * The information used by the bootmem allocator is represented by + * :c:type:`struct bootmem_data`. An array to hold up to %MAX_NUMNODES + * such structures is statically allocated and then it is discarded + * when the system initialization completes. Each entry in this array + * corresponds to a node with memory. For UMA systems only entry 0 is + * used. + * + * The bootmem allocator is initialized during early architecture + * specific setup. Each architecture is required to supply a + * :c:func:`setup_arch` function which, among other tasks, is + * responsible for acquiring the necessary parameters to initialise + * the boot memory allocator. These parameters define limits of usable + * physical memory: + * + * * @min_low_pfn - the lowest PFN that is available in the system + * * @max_low_pfn - the highest PFN that may be addressed by low + * memory (%ZONE_NORMAL) + * * @max_pfn - the last PFN available to the system. + * + * After those limits are determined, the :c:func:`init_bootmem` or + * :c:func:`init_bootmem_node` function should be called to initialize + * the bootmem allocator. The UMA case should use the `init_bootmem` + * function. It will initialize ``contig_page_data`` structure that + * represents the only memory node in the system. In the NUMA case the + * `init_bootmem_node` function should be called to initialize the + * bootmem allocator for each node. + * + * Once the allocator is set up, it is possible to use either single + * node or NUMA variant of the allocation APIs. + */ + #ifndef CONFIG_NEED_MULTIPLE_NODES struct pglist_data __refdata contig_page_data = { .bdata = &bootmem_node_data[0]