linux/drivers/of
Vijayanand Jitta 3c2f107ad2 ANDROID: mm: memblock: avoid to create memmap for memblock nomap regions
This 'commit 86588296ac ("fdt: Properly handle "no-map" field in the
memory region")' is keeping the no-map regions in memblock.memory with
MEMBLOCK_NOMAP flag set to use no-map memory for EFI using memblock
api's, but during the initialization sparse_init mark all memblock.memory
as present using for_each_mem_pfn_range, which is creating the memmap for
no-map memblock regions.

Upstream has suggested to make use of bootloader to pass this as not a
memory,but because of possibility that some bootloaders might not support
this and also due to time constraints in evaluating this approach on 5.10,
Use command line parameter as a temporary solution. Get in the appropriate
solution later after further discussion with upstream.

Add kernel param "android12_only.will_be_removed_soon.memblock_nomap_remove"
which when enabled will remove page structs for these regions using memblock_remove.
With this change we will be able to save ~11MB memory for ~612MB carve out.

android12_only.will_be_removed_soon.memblock_nomap_remove=true:
[    0.000000] memblock_alloc_exact_nid_raw: 115343360 bytes
align=0x200000 nid=0 from=0x0000000080000000 max_addr=0x0000000000000000
sparse_buffer_init+0x60/0x8c
[    0.000000] memblock_reserve: [0x0000000932c00000-0x00000009399fffff]
memblock_alloc_range_nid+0xbc/0x1a0
[    0.000000] On node 0 totalpages: 1627824
[    0.000000] DMA32 zone: 5383 pages used for memmap
[    0.000000] Normal zone: 20052 pages used for memmap

Default or android12_only.will_be_removed_soon.memblock_nomap_remove=false:
[    0.000000] memblock_alloc_exact_nid_raw: 117440512 bytes
align=0x200000 nid=0 from=0x0000000080000000 max_addr=0x0000000000000000
sparse_buffer_init+0x60/0x8c
[    0.000000] memblock_reserve: [0x0000000932a00000-0x00000009399fffff]
memblock_alloc_range_nid+0xbc/0x1a0
[    0.000000] On node 0 totalpages: 1788416
[    0.000000] DMA32 zone: 8192 pages used for memmap
[    0.000000] Normal zone: 20052 pages used for memmap.

Change-Id: I34a7d46f02a6df7c769af3e53e44e49d6fc515af
Bug: 227974747
Link: https://lore.kernel.org/all/20210115172949.GA1495225@robh.at.kernel.org
Signed-off-by: Faiyaz Mohammed <quic_faiyazm@quicinc.com>
Signed-off-by: Vijayanand Jitta <quic_vjitta@quicinc.com>
2022-08-23 22:09:33 +00:00
..
unittest-data
address.c of/address: Introduce of_dma_get_max_cpu_address() 2021-03-09 11:11:13 +01:00
base.c This is the 5.10.94 stable release 2022-01-27 11:49:22 +01:00
device.c of/device: Update dma_range_map only when dev has valid dma-ranges 2021-02-03 23:28:50 +01:00
dynamic.c UPSTREAM: driver core: Add fwnode link support 2021-01-21 18:02:51 -08:00
fdt_address.c
fdt.c ANDROID: mm: memblock: avoid to create memmap for memblock nomap regions 2022-08-23 22:09:33 +00:00
irq.c
Kconfig
kobj.c of: Don't allow __of_attached_node_sysfs() without CONFIG_SYSFS 2021-09-18 13:40:31 +02:00
Makefile
of_net.c
of_numa.c
of_private.h
of_reserved_mem.c of: Fix truncation of memory sizes on 32-bit platforms 2021-07-14 16:56:46 +02:00
overlay.c of: overlay: fix for_each_child.cocci warnings 2021-05-14 09:50:24 +02:00
pdt.c
platform.c UPSTREAM: Revert "of: platform: Batch fwnode parsing when adding all top level devices" 2021-01-21 18:00:32 -08:00
property.c Merge 5.10.30 into android12-5.10 2021-04-15 14:23:41 +02:00
resolver.c
unittest.c of: unittest: 64 bit dma address test requires arch support 2022-01-27 10:54:07 +01:00