162306a36Sopenharmony_ci# SPDX-License-Identifier: GPL-2.0
262306a36Sopenharmony_ci#
362306a36Sopenharmony_ci# Makefile for the linux memory manager.
462306a36Sopenharmony_ci#
562306a36Sopenharmony_ci
662306a36Sopenharmony_ciKASAN_SANITIZE_slab_common.o := n
762306a36Sopenharmony_ciKASAN_SANITIZE_slab.o := n
862306a36Sopenharmony_ciKASAN_SANITIZE_slub.o := n
962306a36Sopenharmony_ciKCSAN_SANITIZE_kmemleak.o := n
1062306a36Sopenharmony_ci
1162306a36Sopenharmony_ci# These produce frequent data race reports: most of them are due to races on
1262306a36Sopenharmony_ci# the same word but accesses to different bits of that word. Re-enable KCSAN
1362306a36Sopenharmony_ci# for these when we have more consensus on what to do about them.
1462306a36Sopenharmony_ciKCSAN_SANITIZE_slab_common.o := n
1562306a36Sopenharmony_ciKCSAN_SANITIZE_slab.o := n
1662306a36Sopenharmony_ciKCSAN_SANITIZE_slub.o := n
1762306a36Sopenharmony_ciKCSAN_SANITIZE_page_alloc.o := n
1862306a36Sopenharmony_ci# But enable explicit instrumentation for memory barriers.
1962306a36Sopenharmony_ciKCSAN_INSTRUMENT_BARRIERS := y
2062306a36Sopenharmony_ci
2162306a36Sopenharmony_ci# These files are disabled because they produce non-interesting and/or
2262306a36Sopenharmony_ci# flaky coverage that is not a function of syscall inputs. E.g. slab is out of
2362306a36Sopenharmony_ci# free pages, or a task is migrated between nodes.
2462306a36Sopenharmony_ciKCOV_INSTRUMENT_slab_common.o := n
2562306a36Sopenharmony_ciKCOV_INSTRUMENT_slab.o := n
2662306a36Sopenharmony_ciKCOV_INSTRUMENT_slub.o := n
2762306a36Sopenharmony_ciKCOV_INSTRUMENT_page_alloc.o := n
2862306a36Sopenharmony_ciKCOV_INSTRUMENT_debug-pagealloc.o := n
2962306a36Sopenharmony_ciKCOV_INSTRUMENT_kmemleak.o := n
3062306a36Sopenharmony_ciKCOV_INSTRUMENT_memcontrol.o := n
3162306a36Sopenharmony_ciKCOV_INSTRUMENT_mmzone.o := n
3262306a36Sopenharmony_ciKCOV_INSTRUMENT_vmstat.o := n
3362306a36Sopenharmony_ciKCOV_INSTRUMENT_failslab.o := n
3462306a36Sopenharmony_ci
3562306a36Sopenharmony_ciCFLAGS_init-mm.o += $(call cc-disable-warning, override-init)
3662306a36Sopenharmony_ciCFLAGS_init-mm.o += $(call cc-disable-warning, initializer-overrides)
3762306a36Sopenharmony_ci
3862306a36Sopenharmony_cimmu-y			:= nommu.o
3962306a36Sopenharmony_cimmu-$(CONFIG_MMU)	:= highmem.o memory.o mincore.o \
4062306a36Sopenharmony_ci			   mlock.o mmap.o mmu_gather.o mprotect.o mremap.o \
4162306a36Sopenharmony_ci			   msync.o page_vma_mapped.o pagewalk.o \
4262306a36Sopenharmony_ci			   pgtable-generic.o rmap.o vmalloc.o
4362306a36Sopenharmony_ci
4462306a36Sopenharmony_ci
4562306a36Sopenharmony_ciifdef CONFIG_CROSS_MEMORY_ATTACH
4662306a36Sopenharmony_cimmu-$(CONFIG_MMU)	+= process_vm_access.o
4762306a36Sopenharmony_ciendif
4862306a36Sopenharmony_ci
4962306a36Sopenharmony_ciobj-y			:= filemap.o mempool.o oom_kill.o fadvise.o \
5062306a36Sopenharmony_ci			   maccess.o page-writeback.o folio-compat.o \
5162306a36Sopenharmony_ci			   readahead.o swap.o truncate.o vmscan.o shmem.o \
5262306a36Sopenharmony_ci			   util.o mmzone.o vmstat.o backing-dev.o \
5362306a36Sopenharmony_ci			   mm_init.o percpu.o slab_common.o \
5462306a36Sopenharmony_ci			   compaction.o show_mem.o shmem_quota.o\
5562306a36Sopenharmony_ci			   interval_tree.o list_lru.o workingset.o \
5662306a36Sopenharmony_ci			   debug.o gup.o mmap_lock.o $(mmu-y)
5762306a36Sopenharmony_ci
5862306a36Sopenharmony_ci# Give 'page_alloc' its own module-parameter namespace
5962306a36Sopenharmony_cipage-alloc-y := page_alloc.o
6062306a36Sopenharmony_cipage-alloc-$(CONFIG_SHUFFLE_PAGE_ALLOCATOR) += shuffle.o
6162306a36Sopenharmony_ci
6262306a36Sopenharmony_ci# Give 'memory_hotplug' its own module-parameter namespace
6362306a36Sopenharmony_cimemory-hotplug-$(CONFIG_MEMORY_HOTPLUG) += memory_hotplug.o
6462306a36Sopenharmony_ci
6562306a36Sopenharmony_ciobj-y += page-alloc.o
6662306a36Sopenharmony_ciobj-y += init-mm.o
6762306a36Sopenharmony_ciobj-y += memblock.o
6862306a36Sopenharmony_ciobj-y += $(memory-hotplug-y)
6962306a36Sopenharmony_ci
7062306a36Sopenharmony_ciifdef CONFIG_MMU
7162306a36Sopenharmony_ci	obj-$(CONFIG_ADVISE_SYSCALLS)	+= madvise.o
7262306a36Sopenharmony_ciendif
7362306a36Sopenharmony_ci
7462306a36Sopenharmony_ciobj-$(CONFIG_SWAP)	+= page_io.o swap_state.o swapfile.o swap_slots.o
7562306a36Sopenharmony_ciobj-$(CONFIG_ZSWAP)	+= zswap.o
7662306a36Sopenharmony_ciobj-$(CONFIG_HAS_DMA)	+= dmapool.o
7762306a36Sopenharmony_ciobj-$(CONFIG_HUGETLBFS)	+= hugetlb.o
7862306a36Sopenharmony_ciobj-$(CONFIG_HUGETLB_PAGE_OPTIMIZE_VMEMMAP)	+= hugetlb_vmemmap.o
7962306a36Sopenharmony_ciobj-$(CONFIG_NUMA) 	+= mempolicy.o
8062306a36Sopenharmony_ciobj-$(CONFIG_SPARSEMEM)	+= sparse.o
8162306a36Sopenharmony_ciobj-$(CONFIG_SPARSEMEM_VMEMMAP) += sparse-vmemmap.o
8262306a36Sopenharmony_ciobj-$(CONFIG_MMU_NOTIFIER) += mmu_notifier.o
8362306a36Sopenharmony_ciobj-$(CONFIG_KSM) += ksm.o
8462306a36Sopenharmony_ciobj-$(CONFIG_PAGE_POISONING) += page_poison.o
8562306a36Sopenharmony_ciobj-$(CONFIG_SLAB) += slab.o
8662306a36Sopenharmony_ciobj-$(CONFIG_SLUB) += slub.o
8762306a36Sopenharmony_ciobj-$(CONFIG_KASAN)	+= kasan/
8862306a36Sopenharmony_ciobj-$(CONFIG_KFENCE) += kfence/
8962306a36Sopenharmony_ciobj-$(CONFIG_KMSAN)	+= kmsan/
9062306a36Sopenharmony_ciobj-$(CONFIG_FAILSLAB) += failslab.o
9162306a36Sopenharmony_ciobj-$(CONFIG_FAIL_PAGE_ALLOC) += fail_page_alloc.o
9262306a36Sopenharmony_ciobj-$(CONFIG_MEMTEST)		+= memtest.o
9362306a36Sopenharmony_ciobj-$(CONFIG_MIGRATION) += migrate.o
9462306a36Sopenharmony_ciobj-$(CONFIG_NUMA) += memory-tiers.o
9562306a36Sopenharmony_ciobj-$(CONFIG_DEVICE_MIGRATION) += migrate_device.o
9662306a36Sopenharmony_ciobj-$(CONFIG_TRANSPARENT_HUGEPAGE) += huge_memory.o khugepaged.o
9762306a36Sopenharmony_ciobj-$(CONFIG_PAGE_COUNTER) += page_counter.o
9862306a36Sopenharmony_ciobj-$(CONFIG_MEMCG) += memcontrol.o vmpressure.o
9962306a36Sopenharmony_ciifdef CONFIG_SWAP
10062306a36Sopenharmony_ciobj-$(CONFIG_MEMCG) += swap_cgroup.o
10162306a36Sopenharmony_ciendif
10262306a36Sopenharmony_ciobj-$(CONFIG_CGROUP_HUGETLB) += hugetlb_cgroup.o
10362306a36Sopenharmony_ciobj-$(CONFIG_GUP_TEST) += gup_test.o
10462306a36Sopenharmony_ciobj-$(CONFIG_DMAPOOL_TEST) += dmapool_test.o
10562306a36Sopenharmony_ciobj-$(CONFIG_MEMORY_FAILURE) += memory-failure.o
10662306a36Sopenharmony_ciobj-$(CONFIG_HWPOISON_INJECT) += hwpoison-inject.o
10762306a36Sopenharmony_ciobj-$(CONFIG_DEBUG_KMEMLEAK) += kmemleak.o
10862306a36Sopenharmony_ciobj-$(CONFIG_DEBUG_RODATA_TEST) += rodata_test.o
10962306a36Sopenharmony_ciobj-$(CONFIG_DEBUG_VM_PGTABLE) += debug_vm_pgtable.o
11062306a36Sopenharmony_ciobj-$(CONFIG_PAGE_OWNER) += page_owner.o
11162306a36Sopenharmony_ciobj-$(CONFIG_MEMORY_ISOLATION) += page_isolation.o
11262306a36Sopenharmony_ciobj-$(CONFIG_ZPOOL)	+= zpool.o
11362306a36Sopenharmony_ciobj-$(CONFIG_ZBUD)	+= zbud.o
11462306a36Sopenharmony_ciobj-$(CONFIG_ZSMALLOC)	+= zsmalloc.o
11562306a36Sopenharmony_ciobj-$(CONFIG_Z3FOLD)	+= z3fold.o
11662306a36Sopenharmony_ciobj-$(CONFIG_GENERIC_EARLY_IOREMAP) += early_ioremap.o
11762306a36Sopenharmony_ciobj-$(CONFIG_CMA)	+= cma.o
11862306a36Sopenharmony_ciobj-$(CONFIG_MEMORY_BALLOON) += balloon_compaction.o
11962306a36Sopenharmony_ciobj-$(CONFIG_PAGE_EXTENSION) += page_ext.o
12062306a36Sopenharmony_ciobj-$(CONFIG_PAGE_TABLE_CHECK) += page_table_check.o
12162306a36Sopenharmony_ciobj-$(CONFIG_CMA_DEBUGFS) += cma_debug.o
12262306a36Sopenharmony_ciobj-$(CONFIG_SECRETMEM) += secretmem.o
12362306a36Sopenharmony_ciobj-$(CONFIG_CMA_SYSFS) += cma_sysfs.o
12462306a36Sopenharmony_ciobj-$(CONFIG_USERFAULTFD) += userfaultfd.o
12562306a36Sopenharmony_ciobj-$(CONFIG_IDLE_PAGE_TRACKING) += page_idle.o
12662306a36Sopenharmony_ciobj-$(CONFIG_DEBUG_PAGEALLOC) += debug_page_alloc.o
12762306a36Sopenharmony_ciobj-$(CONFIG_DEBUG_PAGE_REF) += debug_page_ref.o
12862306a36Sopenharmony_ciobj-$(CONFIG_DAMON) += damon/
12962306a36Sopenharmony_ciobj-$(CONFIG_HARDENED_USERCOPY) += usercopy.o
13062306a36Sopenharmony_ciobj-$(CONFIG_PERCPU_STATS) += percpu-stats.o
13162306a36Sopenharmony_ciobj-$(CONFIG_ZONE_DEVICE) += memremap.o
13262306a36Sopenharmony_ciobj-$(CONFIG_HMM_MIRROR) += hmm.o
13362306a36Sopenharmony_ciobj-$(CONFIG_MEMFD_CREATE) += memfd.o
13462306a36Sopenharmony_ciobj-$(CONFIG_MAPPING_DIRTY_HELPERS) += mapping_dirty_helpers.o
13562306a36Sopenharmony_ciobj-$(CONFIG_PTDUMP_CORE) += ptdump.o
13662306a36Sopenharmony_ciobj-$(CONFIG_PAGE_REPORTING) += page_reporting.o
13762306a36Sopenharmony_ciobj-$(CONFIG_IO_MAPPING) += io-mapping.o
13862306a36Sopenharmony_ciobj-$(CONFIG_HAVE_BOOTMEM_INFO_NODE) += bootmem_info.o
13962306a36Sopenharmony_ciobj-$(CONFIG_GENERIC_IOREMAP) += ioremap.o
14062306a36Sopenharmony_ciobj-$(CONFIG_SHRINKER_DEBUG) += shrinker_debug.o
14162306a36Sopenharmony_ciobj-$(CONFIG_HYPERHOLD_FILE_LRU) += memcg_reclaim.o
14262306a36Sopenharmony_ciobj-$(CONFIG_HYPERHOLD_MEMCG) += memcg_control.o
14362306a36Sopenharmony_ciobj-$(CONFIG_HYPERHOLD_ZSWAPD) += zswapd.o zswapd_control.o
14462306a36Sopenharmony_ciobj-$(CONFIG_MEM_PURGEABLE) += purgeable.o
14562306a36Sopenharmony_ciobj-$(CONFIG_PURGEABLE_ASHMEM) += purgeable_ashmem_trigger.o
14662306a36Sopenharmony_ciobj-$(CONFIG_MEMORY_MONITOR) += memory_monitor.o
147