Skip to content

Commit b3dcc9d

Browse files
committed
memblock: fix kernel-doc for MEMBLOCK_RSRV_NOINIT
The kernel-doc description of MEMBLOCK_RSRV_NOINIT and memblock_reserved_mark_noinit() do not accurately describe their functionality. Expand their kernel doc to make it clear that the user of MEMBLOCK_RSRV_NOINIT is responsible to properly initialize the struct pages for such regions and add more details about effects of using this flag. Reviewed-by: David Hildenbrand <[email protected]> Link: https://lore.kernel.org/r/[email protected] Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Mike Rapoport (Microsoft) <[email protected]>
1 parent 4647c4d commit b3dcc9d

File tree

2 files changed

+14
-6
lines changed

2 files changed

+14
-6
lines changed

include/linux/memblock.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,9 @@ extern unsigned long long max_possible_pfn;
4040
* via a driver, and never indicated in the firmware-provided memory map as
4141
* system RAM. This corresponds to IORESOURCE_SYSRAM_DRIVER_MANAGED in the
4242
* kernel resource tree.
43-
* @MEMBLOCK_RSRV_NOINIT: memory region for which struct pages are
44-
* not initialized (only for reserved regions).
43+
* @MEMBLOCK_RSRV_NOINIT: reserved memory region for which struct pages are not
44+
* fully initialized. Users of this flag are responsible to properly initialize
45+
* struct pages of this region
4546
* @MEMBLOCK_RSRV_KERN: memory region that is reserved for kernel use,
4647
* either explictitly with memblock_reserve_kern() or via memblock
4748
* allocation APIs. All memblock allocations set this flag.

mm/memblock.c

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1091,13 +1091,20 @@ int __init_memblock memblock_clear_nomap(phys_addr_t base, phys_addr_t size)
10911091

10921092
/**
10931093
* memblock_reserved_mark_noinit - Mark a reserved memory region with flag
1094-
* MEMBLOCK_RSRV_NOINIT which results in the struct pages not being initialized
1095-
* for this region.
1094+
* MEMBLOCK_RSRV_NOINIT
1095+
*
10961096
* @base: the base phys addr of the region
10971097
* @size: the size of the region
10981098
*
1099-
* struct pages will not be initialized for reserved memory regions marked with
1100-
* %MEMBLOCK_RSRV_NOINIT.
1099+
* The struct pages for the reserved regions marked %MEMBLOCK_RSRV_NOINIT will
1100+
* not be fully initialized to allow the caller optimize their initialization.
1101+
*
1102+
* When %CONFIG_DEFERRED_STRUCT_PAGE_INIT is enabled, setting this flag
1103+
* completely bypasses the initialization of struct pages for such region.
1104+
*
1105+
* When %CONFIG_DEFERRED_STRUCT_PAGE_INIT is disabled, struct pages in this
1106+
* region will be initialized with default values but won't be marked as
1107+
* reserved.
11011108
*
11021109
* Return: 0 on success, -errno on failure.
11031110
*/

0 commit comments

Comments
 (0)