From patchwork Mon Jun 18 16:59:53 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Rapoport X-Patchwork-Id: 10472297 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 482886029B for ; Mon, 18 Jun 2018 17:00:29 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3725128AEB for ; Mon, 18 Jun 2018 17:00:29 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 2B52928AED; Mon, 18 Jun 2018 17:00:29 +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 9FCDA28AD0 for ; Mon, 18 Jun 2018 17:00:28 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id D995B6B000E; Mon, 18 Jun 2018 13:00:22 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id CF5D06B0010; Mon, 18 Jun 2018 13:00:22 -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 AAC456B0266; Mon, 18 Jun 2018 13:00:22 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-wm0-f72.google.com (mail-wm0-f72.google.com [74.125.82.72]) by kanga.kvack.org (Postfix) with ESMTP id 4B4196B000E for ; Mon, 18 Jun 2018 13:00:22 -0400 (EDT) Received: by mail-wm0-f72.google.com with SMTP id l4-v6so5449116wmh.0 for ; Mon, 18 Jun 2018 10:00:22 -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=L7RiMsLQwWzkj+6DX5pyWqWJEVkx5r85oHZkM48LWy0=; b=hEGEF510FIg1LdiN5LQiUmAMwaLvzKSxpx6tcHAQe15b4ycf/tDO7rMih7QFd+jxN1 yUS+yUxIQ3AyIhWNdHJjcrndQJQqLiLNTXmiWYKSfe1cgp7j+vRTdlxZNpapR1A0zy42 JXLQtQkYgwycrpSu8IAIDFHWhrq7dDlmyQsbJxfqXwLWV+9HvQj1+AVE7IoEOXkfEG+J zsHM66cyvJBP0jpCb/7E4Q4/+hawO6Dx9bEitWO7PePDAdjeV9So7ed0wKRweAKP2x8u R+YAFARGz6GKwONwFEMKl4fcH7nySAmtU6YCwFczRGqbWqWxhxRdZBcvCNCUDC+fv0kV iD2A== X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 148.163.158.5 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: APt69E3UPijVxffbU3lGkiZpL53oP/z+Sj/+GfXSMmtOkwaVWyL2By/6 q5F5qKVT27qvKTouZKTL3wNQmQjBdszeIQ8vFHiYPPy4RVzBvCJyteWPV1EaxXXwALTbu4tkJRN /Fiz7P4GxyilYpU7GwCf8+HiCSNnVf+VnMPBOt8GKn3pK7RL6vj8JAy+nNkWAEIk= X-Received: by 2002:a1c:8cd:: with SMTP id 196-v6mr9836140wmi.46.1529341221835; Mon, 18 Jun 2018 10:00:21 -0700 (PDT) X-Google-Smtp-Source: ADUXVKJ5lp5JzDgcv/B4aFULaSfQ9Ldmi1bQ3xHkX9/0nnPOphROQtDmdLgVtMs36FFR9XlDHCCN X-Received: by 2002:a1c:8cd:: with SMTP id 196-v6mr9836089wmi.46.1529341220969; Mon, 18 Jun 2018 10:00:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1529341220; cv=none; d=google.com; s=arc-20160816; b=eCPRqyebwfWG2JgiH7TKqyXZGjwpyuD4Gn2YtH3zy/RTMNVSqdMbSvFzXv4fhEcv0j TI4SmPuAJqb08lWwjtfsXZx+KMcYdfhMM2vaqQJSpOTmb/Xli0pezkclr3gDRNh/QGNq d21EEz0lXHrx48kR6OxBgYl1d3MXeoYs4j8PPslmOw3GZU+IMW/sucg0RcW9P9+uPDXF Y0NFZ4DZssvzuJJkuXD8cP6cPx2wVMfMIZd49FAScLnJhR/vflNUMX8tOgfU2KiU5alE moLjom25cBQM8IN6/mnyObPNI+/7igRnJI2SWRIBP8kOD9JRYRuO4E7C8US6H9zcSyaC 0nPQ== 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=L7RiMsLQwWzkj+6DX5pyWqWJEVkx5r85oHZkM48LWy0=; b=L/7L2jnxdCppOBVioSjZP2WceSbWRsnq2mCw9Rwok8VmrBWZMLn6y6BY79PjYtjbfX 3BARXSwC4K8F3vf/jMkzl0vcGo6JvdVrS/O/VIrHtlHrjGMf+h7EsSGQnswHi1BCssOc ukqK5TvzC1QFHLAwfaxf1kbCv6BcuZUVSL6rhIu6rkWAMmP40IRfPgwvro7beYcj+Ari nuseI5+QHcf60WhtaTSGwSACkjddz+6mnaLQViWsOQLdND1jRC8+wso10IRwpZrdxPjd KfjJNdGRCZ7X/4yxpmNyzDPcqsUu8NFpQ7pFnoaflJbJFpM09LDtR9uBC+QJuajXi0nS c/5w== ARC-Authentication-Results: i=1; mx.google.com; spf=neutral (google.com: 148.163.158.5 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 (mx0b-001b2d01.pphosted.com. [148.163.158.5]) by mx.google.com with ESMTPS id e17-v6si4701990wrn.407.2018.06.18.10.00.20 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 18 Jun 2018 10:00:20 -0700 (PDT) Received-SPF: neutral (google.com: 148.163.158.5 is neither permitted nor denied by best guess record for domain of rppt@linux.vnet.ibm.com) client-ip=148.163.158.5; Authentication-Results: mx.google.com; spf=neutral (google.com: 148.163.158.5 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 (m0098416.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.22/8.16.0.22) with SMTP id w5IGwspG182615 for ; Mon, 18 Jun 2018 13:00:19 -0400 Received: from e06smtp04.uk.ibm.com (e06smtp04.uk.ibm.com [195.75.94.100]) by mx0b-001b2d01.pphosted.com with ESMTP id 2jpde7h8yh-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Mon, 18 Jun 2018 13:00:19 -0400 Received: from localhost by e06smtp04.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Mon, 18 Jun 2018 18:00:17 +0100 Received: from b06cxnps4076.portsmouth.uk.ibm.com (9.149.109.198) 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) Mon, 18 Jun 2018 18:00:14 +0100 Received: from d06av23.portsmouth.uk.ibm.com (d06av23.portsmouth.uk.ibm.com [9.149.105.59]) by b06cxnps4076.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id w5IH0DKG31457328 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Mon, 18 Jun 2018 17:00:13 GMT Received: from d06av23.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 31C4AA404D; Mon, 18 Jun 2018 17:50:57 +0100 (BST) Received: from d06av23.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id BA26EA4040; Mon, 18 Jun 2018 17:50:55 +0100 (BST) Received: from rapoport-lnx (unknown [9.148.8.74]) by d06av23.portsmouth.uk.ibm.com (Postfix) with ESMTPS; Mon, 18 Jun 2018 17:50:55 +0100 (BST) Received: by rapoport-lnx (sSMTP sendmail emulation); Mon, 18 Jun 2018 20:00:11 +0300 From: Mike Rapoport To: Jonathan Corbet Cc: Andrew Morton , linux-doc , linux-mm , lkml , Mike Rapoport Subject: [PATCH 05/11] docs/mm: bootmem: add overview documentation Date: Mon, 18 Jun 2018 19:59:53 +0300 X-Mailer: git-send-email 2.7.4 In-Reply-To: <1529341199-17682-1-git-send-email-rppt@linux.vnet.ibm.com> References: <1529341199-17682-1-git-send-email-rppt@linux.vnet.ibm.com> X-TM-AS-GCONF: 00 x-cbid: 18061817-0016-0000-0000-000001DD5BF5 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 18061817-0017-0000-0000-000032316261 Message-Id: <1529341199-17682-6-git-send-email-rppt@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:, , definitions=2018-06-18_07:, , 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-1805220000 definitions=main-1806180197 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..423cb5f 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. + * + * The 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]