From: Mike Rapoport <rppt@linux.vnet.ibm.com>
To: Michal Hocko <mhocko@kernel.org>
Cc: Jonathan Corbet <corbet@lwn.net>,
Randy Dunlap <rdunlap@infradead.org>,
linux-doc <linux-doc@vger.kernel.org>,
linux-mm <linux-mm@kvack.org>,
lkml <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH v2 11/11] docs/mm: add description of boot time memory management
Date: Thu, 12 Jul 2018 10:26:07 +0300 [thread overview]
Message-ID: <20180712072606.GB4422@rapoport-lnx> (raw)
In-Reply-To: <20180703122324.GA23824@dhcp22.suse.cz>
Hi,
On Tue, Jul 03, 2018 at 02:23:24PM +0200, Michal Hocko wrote:
> On Sat 30-06-18 17:55:06, Mike Rapoport wrote:
> > Both bootmem and memblock are have pretty good internal documentation
> > coverage. With addition of some overview we get a nice description of the
> > early memory management.
> >
> > Signed-off-by: Mike Rapoport <rppt@linux.vnet.ibm.com>
>
> Yes this looks reasonable. I would just mention the available debugging
> options and CONFIG_ARCH_DISCARD_MEMBLOCK.
I'd really prefer to add it as a separate patch rather then resending the
whole series.
> Other than that looks goot to get a rough idea. Improvements can be done
> on top of course.
>
> Acked-by: Michal Hocko <mhocko@suse.com>
Thanks for the review. I think Jon was mostly concerned about the patch
"mm/memblock: add a name for memblock flags enumeration" [1]. Could you
please review it as well?
[1] https://lore.kernel.org/lkml/1530370506-21751-7-git-send-email-rppt@linux.vnet.ibm.com/
> > ---
> > Documentation/core-api/boot-time-mm.rst | 92 +++++++++++++++++++++++++++++++++
> > Documentation/core-api/index.rst | 1 +
> > 2 files changed, 93 insertions(+)
> > create mode 100644 Documentation/core-api/boot-time-mm.rst
> >
> > diff --git a/Documentation/core-api/boot-time-mm.rst b/Documentation/core-api/boot-time-mm.rst
> > new file mode 100644
> > index 0000000..03cb164
> > --- /dev/null
> > +++ b/Documentation/core-api/boot-time-mm.rst
> > @@ -0,0 +1,92 @@
> > +===========================
> > +Boot time memory management
> > +===========================
> > +
> > +Early system initialization cannot use "normal" memory management
> > +simply because it is not set up yet. But there is still need to
> > +allocate memory for various data structures, for instance for the
> > +physical page allocator. To address this, a specialized allocator
> > +called the :ref:`Boot Memory Allocator <bootmem>`, or bootmem, was
> > +introduced. Several years later PowerPC developers added a "Logical
> > +Memory Blocks" allocator, which was later adopted by other
> > +architectures and renamed to :ref:`memblock <memblock>`. There is also
> > +a compatibility layer called `nobootmem` that translates bootmem
> > +allocation interfaces to memblock calls.
> > +
> > +The selection of the early allocator is done using
> > +``CONFIG_NO_BOOTMEM`` and ``CONFIG_HAVE_MEMBLOCK`` kernel
> > +configuration options. These options are enabled or disabled
> > +statically by the architectures' Kconfig files.
> > +
> > +* Architectures that rely only on bootmem select
> > + ``CONFIG_NO_BOOTMEM=n && CONFIG_HAVE_MEMBLOCK=n``.
> > +* The users of memblock with the nobootmem compatibility layer set
> > + ``CONFIG_NO_BOOTMEM=y && CONFIG_HAVE_MEMBLOCK=y``.
> > +* And for those that use both memblock and bootmem the configuration
> > + includes ``CONFIG_NO_BOOTMEM=n && CONFIG_HAVE_MEMBLOCK=y``.
> > +
> > +Whichever allocator is used, it is the responsibility of the
> > +architecture specific initialization to set it up in
> > +:c:func:`setup_arch` and tear it down in :c:func:`mem_init` functions.
> > +
> > +Once the early memory management is available it offers a variety of
> > +functions and macros for memory allocations. The allocation request
> > +may be directed to the first (and probably the only) node or to a
> > +particular node in a NUMA system. There are API variants that panic
> > +when an allocation fails and those that don't. And more recent and
> > +advanced memblock even allows controlling its own behaviour.
> > +
> > +.. _bootmem:
> > +
> > +Bootmem
> > +=======
> > +
> > +(mostly stolen from Mel Gorman's "Understanding the Linux Virtual
> > +Memory Manager" `book`_)
> > +
> > +.. _book: https://www.kernel.org/doc/gorman/
> > +
> > +.. kernel-doc:: mm/bootmem.c
> > + :doc: bootmem overview
> > +
> > +.. _memblock:
> > +
> > +Memblock
> > +========
> > +
> > +.. kernel-doc:: mm/memblock.c
> > + :doc: memblock overview
> > +
> > +
> > +Functions and structures
> > +========================
> > +
> > +Common API
> > +----------
> > +
> > +The functions that are described in this section are available
> > +regardless of what early memory manager is enabled.
> > +
> > +.. kernel-doc:: mm/nobootmem.c
> > +
> > +Bootmem specific API
> > +--------------------
> > +
> > +These interfaces available only with bootmem, i.e when ``CONFIG_NO_BOOTMEM=n``
> > +
> > +.. kernel-doc:: include/linux/bootmem.h
> > +.. kernel-doc:: mm/bootmem.c
> > + :nodocs:
> > +
> > +Memblock specific API
> > +---------------------
> > +
> > +Here is the description of memblock data structures, functions and
> > +macros. Some of them are actually internal, but since they are
> > +documented it would be silly to omit them. Besides, reading the
> > +descriptions for the internal functions can help to understand what
> > +really happens under the hood.
> > +
> > +.. kernel-doc:: include/linux/memblock.h
> > +.. kernel-doc:: mm/memblock.c
> > + :nodocs:
> > diff --git a/Documentation/core-api/index.rst b/Documentation/core-api/index.rst
> > index f5a66b7..93d5a46 100644
> > --- a/Documentation/core-api/index.rst
> > +++ b/Documentation/core-api/index.rst
> > @@ -28,6 +28,7 @@ Core utilities
> > printk-formats
> > circular-buffers
> > gfp_mask-from-fs-io
> > + boot-time-mm
> >
> > Interfaces for kernel debugging
> > ===============================
> > --
> > 2.7.4
>
> --
> Michal Hocko
> SUSE Labs
>
--
Sincerely yours,
Mike.
--
To unsubscribe from this list: send the line "unsubscribe linux-doc" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
WARNING: multiple messages have this Message-ID (diff)
From: Mike Rapoport <rppt@linux.vnet.ibm.com>
To: Michal Hocko <mhocko@kernel.org>
Cc: Jonathan Corbet <corbet@lwn.net>,
Randy Dunlap <rdunlap@infradead.org>,
linux-doc <linux-doc@vger.kernel.org>,
linux-mm <linux-mm@kvack.org>,
lkml <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH v2 11/11] docs/mm: add description of boot time memory management
Date: Thu, 12 Jul 2018 10:26:07 +0300 [thread overview]
Message-ID: <20180712072606.GB4422@rapoport-lnx> (raw)
In-Reply-To: <20180703122324.GA23824@dhcp22.suse.cz>
Hi,
On Tue, Jul 03, 2018 at 02:23:24PM +0200, Michal Hocko wrote:
> On Sat 30-06-18 17:55:06, Mike Rapoport wrote:
> > Both bootmem and memblock are have pretty good internal documentation
> > coverage. With addition of some overview we get a nice description of the
> > early memory management.
> >
> > Signed-off-by: Mike Rapoport <rppt@linux.vnet.ibm.com>
>
> Yes this looks reasonable. I would just mention the available debugging
> options and CONFIG_ARCH_DISCARD_MEMBLOCK.
I'd really prefer to add it as a separate patch rather then resending the
whole series.
> Other than that looks goot to get a rough idea. Improvements can be done
> on top of course.
>
> Acked-by: Michal Hocko <mhocko@suse.com>
Thanks for the review. I think Jon was mostly concerned about the patch
"mm/memblock: add a name for memblock flags enumeration" [1]. Could you
please review it as well?
[1] https://lore.kernel.org/lkml/1530370506-21751-7-git-send-email-rppt@linux.vnet.ibm.com/
> > ---
> > Documentation/core-api/boot-time-mm.rst | 92 +++++++++++++++++++++++++++++++++
> > Documentation/core-api/index.rst | 1 +
> > 2 files changed, 93 insertions(+)
> > create mode 100644 Documentation/core-api/boot-time-mm.rst
> >
> > diff --git a/Documentation/core-api/boot-time-mm.rst b/Documentation/core-api/boot-time-mm.rst
> > new file mode 100644
> > index 0000000..03cb164
> > --- /dev/null
> > +++ b/Documentation/core-api/boot-time-mm.rst
> > @@ -0,0 +1,92 @@
> > +===========================
> > +Boot time memory management
> > +===========================
> > +
> > +Early system initialization cannot use "normal" memory management
> > +simply because it is not set up yet. But there is still need to
> > +allocate memory for various data structures, for instance for the
> > +physical page allocator. To address this, a specialized allocator
> > +called the :ref:`Boot Memory Allocator <bootmem>`, or bootmem, was
> > +introduced. Several years later PowerPC developers added a "Logical
> > +Memory Blocks" allocator, which was later adopted by other
> > +architectures and renamed to :ref:`memblock <memblock>`. There is also
> > +a compatibility layer called `nobootmem` that translates bootmem
> > +allocation interfaces to memblock calls.
> > +
> > +The selection of the early allocator is done using
> > +``CONFIG_NO_BOOTMEM`` and ``CONFIG_HAVE_MEMBLOCK`` kernel
> > +configuration options. These options are enabled or disabled
> > +statically by the architectures' Kconfig files.
> > +
> > +* Architectures that rely only on bootmem select
> > + ``CONFIG_NO_BOOTMEM=n && CONFIG_HAVE_MEMBLOCK=n``.
> > +* The users of memblock with the nobootmem compatibility layer set
> > + ``CONFIG_NO_BOOTMEM=y && CONFIG_HAVE_MEMBLOCK=y``.
> > +* And for those that use both memblock and bootmem the configuration
> > + includes ``CONFIG_NO_BOOTMEM=n && CONFIG_HAVE_MEMBLOCK=y``.
> > +
> > +Whichever allocator is used, it is the responsibility of the
> > +architecture specific initialization to set it up in
> > +:c:func:`setup_arch` and tear it down in :c:func:`mem_init` functions.
> > +
> > +Once the early memory management is available it offers a variety of
> > +functions and macros for memory allocations. The allocation request
> > +may be directed to the first (and probably the only) node or to a
> > +particular node in a NUMA system. There are API variants that panic
> > +when an allocation fails and those that don't. And more recent and
> > +advanced memblock even allows controlling its own behaviour.
> > +
> > +.. _bootmem:
> > +
> > +Bootmem
> > +=======
> > +
> > +(mostly stolen from Mel Gorman's "Understanding the Linux Virtual
> > +Memory Manager" `book`_)
> > +
> > +.. _book: https://www.kernel.org/doc/gorman/
> > +
> > +.. kernel-doc:: mm/bootmem.c
> > + :doc: bootmem overview
> > +
> > +.. _memblock:
> > +
> > +Memblock
> > +========
> > +
> > +.. kernel-doc:: mm/memblock.c
> > + :doc: memblock overview
> > +
> > +
> > +Functions and structures
> > +========================
> > +
> > +Common API
> > +----------
> > +
> > +The functions that are described in this section are available
> > +regardless of what early memory manager is enabled.
> > +
> > +.. kernel-doc:: mm/nobootmem.c
> > +
> > +Bootmem specific API
> > +--------------------
> > +
> > +These interfaces available only with bootmem, i.e when ``CONFIG_NO_BOOTMEM=n``
> > +
> > +.. kernel-doc:: include/linux/bootmem.h
> > +.. kernel-doc:: mm/bootmem.c
> > + :nodocs:
> > +
> > +Memblock specific API
> > +---------------------
> > +
> > +Here is the description of memblock data structures, functions and
> > +macros. Some of them are actually internal, but since they are
> > +documented it would be silly to omit them. Besides, reading the
> > +descriptions for the internal functions can help to understand what
> > +really happens under the hood.
> > +
> > +.. kernel-doc:: include/linux/memblock.h
> > +.. kernel-doc:: mm/memblock.c
> > + :nodocs:
> > diff --git a/Documentation/core-api/index.rst b/Documentation/core-api/index.rst
> > index f5a66b7..93d5a46 100644
> > --- a/Documentation/core-api/index.rst
> > +++ b/Documentation/core-api/index.rst
> > @@ -28,6 +28,7 @@ Core utilities
> > printk-formats
> > circular-buffers
> > gfp_mask-from-fs-io
> > + boot-time-mm
> >
> > Interfaces for kernel debugging
> > ===============================
> > --
> > 2.7.4
>
> --
> Michal Hocko
> SUSE Labs
>
--
Sincerely yours,
Mike.
next prev parent reply other threads:[~2018-07-12 7:26 UTC|newest]
Thread overview: 44+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-06-30 14:54 [PATCH v2 00/11] docs/mm: add boot time memory management docs Mike Rapoport
2018-06-30 14:54 ` Mike Rapoport
2018-06-30 14:54 ` [PATCH v2 01/11] mm/bootmem: drop duplicated kernel-doc comments Mike Rapoport
2018-06-30 14:54 ` Mike Rapoport
2018-06-30 14:54 ` [PATCH v2 02/11] docs/mm: nobootmem: fixup " Mike Rapoport
2018-06-30 14:54 ` Mike Rapoport
2018-06-30 14:54 ` [PATCH v2 03/11] docs/mm: bootmem: fix kernel-doc warnings Mike Rapoport
2018-06-30 14:54 ` Mike Rapoport
2018-06-30 14:54 ` [PATCH v2 04/11] docs/mm: bootmem: add kernel-doc description of 'struct bootmem_data' Mike Rapoport
2018-06-30 14:54 ` Mike Rapoport
2018-06-30 14:55 ` [PATCH v2 05/11] docs/mm: bootmem: add overview documentation Mike Rapoport
2018-06-30 14:55 ` Mike Rapoport
2018-06-30 14:55 ` [PATCH v2 06/11] mm/memblock: add a name for memblock flags enumeration Mike Rapoport
2018-06-30 14:55 ` Mike Rapoport
2018-07-12 8:00 ` Michal Hocko
2018-07-12 8:00 ` Michal Hocko
2018-06-30 14:55 ` [PATCH v2 07/11] docs/mm: memblock: update kernel-doc comments Mike Rapoport
2018-06-30 14:55 ` Mike Rapoport
2018-06-30 14:55 ` [PATCH v2 08/11] docs/mm: memblock: add kernel-doc comments for memblock_add[_node] Mike Rapoport
2018-06-30 14:55 ` Mike Rapoport
2018-06-30 14:55 ` [PATCH v2 09/11] docs/mm: memblock: add kernel-doc description for memblock types Mike Rapoport
2018-06-30 14:55 ` Mike Rapoport
2018-06-30 14:55 ` [PATCH v2 10/11] docs/mm: memblock: add overview documentation Mike Rapoport
2018-06-30 14:55 ` Mike Rapoport
2018-06-30 14:55 ` [PATCH v2 11/11] docs/mm: add description of boot time memory management Mike Rapoport
2018-06-30 14:55 ` Mike Rapoport
2018-07-03 12:23 ` Michal Hocko
2018-07-03 12:23 ` Michal Hocko
2018-07-12 7:26 ` Mike Rapoport [this message]
2018-07-12 7:26 ` Mike Rapoport
2018-07-01 15:26 ` [PATCH v2 00/11] docs/mm: add boot time memory management docs Randy Dunlap
2018-07-01 15:26 ` Randy Dunlap
2018-07-02 17:32 ` Jonathan Corbet
2018-07-02 17:32 ` Jonathan Corbet
2018-07-18 11:47 ` Mike Rapoport
2018-07-18 11:47 ` Mike Rapoport
2018-07-18 12:02 ` Jonathan Corbet
2018-07-18 12:02 ` Jonathan Corbet
2018-07-18 17:00 ` Mike Rapoport
2018-07-18 17:00 ` Mike Rapoport
2018-07-26 21:45 ` Jonathan Corbet
2018-07-26 21:45 ` Jonathan Corbet
2018-08-02 18:36 ` Jonathan Corbet
2018-08-02 18:36 ` Jonathan Corbet
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20180712072606.GB4422@rapoport-lnx \
--to=rppt@linux.vnet.ibm.com \
--cc=corbet@lwn.net \
--cc=linux-doc@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=mhocko@kernel.org \
--cc=rdunlap@infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.