Received: by 2002:ac0:a581:0:0:0:0:0 with SMTP id m1-v6csp1965363imm; Sat, 30 Jun 2018 07:59:56 -0700 (PDT) X-Google-Smtp-Source: ADUXVKKugJeVqWq/ugaODAg6U3sTaz/8B1ucsaOihI0vT8pzF96s+st96qzuijmyoDi3ZYrnYap5 X-Received: by 2002:a65:6597:: with SMTP id u23-v6mr15660246pgv.95.1530370795971; Sat, 30 Jun 2018 07:59:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1530370795; cv=none; d=google.com; s=arc-20160816; b=lhuaPr9m6OOyRUb3WmF+AE4bglOlyXRPw5OY/Gd9Vq7bPO9+QyWEo0XYNkSVFnprq3 KbiRyWzhbdHOG9iQEB5VzZnGvVVJo7sWaG1fL+pCU3MTqc2oSjs2M7GXPCceUfeBZRdT 2ZP020IZY0H/4E/AJh0/P2s9cLEnRFA8K3J1s2BDHUoUi2QKAoj+kRYzviZr7jLcApLI PKhfixK7lOON/zbCHGjvuIMGBZ+nxnUKmSrYibW8VDG+R1E4KArYN6uQGLwnAVPFut6f YoMUk1yLfhbizLZyhaudrNUSIYtgsDP/iwYbZGdsafhepH+BCOf6E7nWARngIb5PXWIA i3+A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:references:in-reply-to:date :subject:cc:to:from:arc-authentication-results; bh=2aMrD2jUXRiWix9LDwk+oZ8aw0E3Y6qaWzxanhYiG/I=; b=Tyf1dbkSOd5A+1XqAwvtL5a0R1aRrtP+ad5b+BbTNWUJaHvQysvkz6jJQq/f2Cc14b Yjvj+4aQ8HSBpFoOOXZcWK17NVpRCeyxnMSTPmxqEdFkEFK51/zCC8uxM2kanPvLoOI9 4a34bH80iygsKr2BGLyDKSXKlBg+Xgu48NsQ6xi6fbqR//wdBHE6UfRJurECgf9OBoza yrr2/pc1hX48BJxo/fCLs/Pf89xmBRJYZa/xsTWAkrsRdR9PxC2YyuqUU3gLg8jpTAhy yd+uKrO5w9kprOnaTLGOh8AU+cCFqHZpZ+dmurV4vmz4j3JtLtM9yvZ1tC/MHLkMHw+N 1wtg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=ibm.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id s71-v6si2433769pfa.367.2018.06.30.07.59.41; Sat, 30 Jun 2018 07:59:55 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=ibm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752116AbeF3O5T (ORCPT + 99 others); Sat, 30 Jun 2018 10:57:19 -0400 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:57918 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751505AbeF3Oza (ORCPT ); Sat, 30 Jun 2018 10:55:30 -0400 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 w5UErWYt035227 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 2jx562u9sy-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 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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] -- 2.7.4