android_kernel_motorola_sm6375/mm
Repository files (latest commit first)
Filename Latest commit message Latest commit date
Suren Baghdasaryan 74cf1bc3a2 FROMGIT: mm, oom_adj: don't loop through tasks in __set_oom_adj when not necessary
Currently __set_oom_adj loops through all processes in the system to
keep oom_score_adj and oom_score_adj_min in sync between processes
sharing their mm. This is done for any task with more that one mm_users,
which includes processes with multiple threads (sharing mm and signals).
However for such processes the loop is unnecessary because their signal
structure is shared as well.
Android updates oom_score_adj whenever a tasks changes its role
(background/foreground/...) or binds to/unbinds from a service, making
it more/less important. Such operation can happen frequently.
We noticed that updates to oom_score_adj became more expensive and after
further investigation found out that the patch mentioned in "Fixes"
introduced a regression. Using Pixel 4 with a typical Android workload,
write time to oom_score_adj increased from ~3.57us to ~362us. Moreover
this regression linearly depends on the number of multi-threaded
processes running on the system.
Mark the mm with a new MMF_MULTIPROCESS flag bit when task is created with
(CLONE_VM && !CLONE_THREAD && !CLONE_VFORK). Change __set_oom_adj to use
MMF_MULTIPROCESS instead of mm_users to decide whether oom_score_adj
update should be synchronized between multiple processes. To prevent
races between clone() and __set_oom_adj(), when oom_score_adj of the
process being cloned might be modified from userspace, we use
oom_adj_mutex. Its scope is changed to global. The combination of
(CLONE_VM && !CLONE_THREAD) is rarely used except for the case of vfork().
To prevent performance regressions of vfork(), we skip taking oom_adj_mutex
and setting MMF_MULTIPROCESS when CLONE_VFORK is specified. Clearing the
MMF_MULTIPROCESS flag (when the last process sharing the mm exits) is left
out of this patch to keep it simple and because it is believed that this
threading model is rare. Should there ever be a need for optimizing that
case as well, it can be done by hooking into the exit path, likely
following the mm_update_next_owner pattern.
With the combination of (CLONE_VM && !CLONE_THREAD && !CLONE_VFORK) being
quite rare, the regression is gone after the change is applied.

Fixes: 44a70adec9 ("mm, oom_adj: make sure processes sharing mm have same view of oom_score_adj")
Reported-by: Tim Murray <[email protected]>
Debugged-by: Minchan Kim <[email protected]>
Suggested-by: Michal Hocko <[email protected]>
Signed-off-by: Suren Baghdasaryan <[email protected]>
Bug: 168521639
Link: https://lore.kernel.org/linux-fsdevel/[email protected]/
[isaacm: upstream bound, no cherry-pick info because patch is in mm tree]
Change-Id: I20352a77815fbc358c36e686bb1503fdeea658ed
Signed-off-by: Isaac J. Manjarres <[email protected]>
Git-commit: 40f057fb2d
Git-repo: https://android.googlesource.com/kernel/common/
Signed-off-by: Isaac J. Manjarres <[email protected]>
2020-09-16 09:56:55 -07:00
..
kasan Merge android-5.4-stable.45 (a9a13ee) into msm-5.4 2020-07-09 17:51:24 -07:00
backing-dev.c bdi: add a ->dev_name field to struct backing_dev_info 2020-05-14 07:58:30 +02:00
balloon_compaction.c mm/balloon_compaction: suppress allocation warnings 2019-09-04 07:42:01 -04:00
cleancache.c
cma.c Merge "mm: cma: Print region name on failure" 2019-12-09 14:12:05 -08:00
cma.h
cma_debug.c Revert "mm: cma: make writeable CMA debugfs optional" 2020-01-16 13:16:30 -08:00
compaction.c mem-offline: improve the effective utilization of movable zone 2020-09-04 06:15:14 -07:00
debug.c mm/debug.c: always print flags in dump_page() 2020-03-05 16:43:51 +01:00
debug_page_ref.c
dmapool.c
early_ioremap.c
fadvise.c fs: Export generic_fadvise() 2019-08-30 22:43:58 -07:00
failslab.c
filemap.c Merge android11-5.4.56 (fcb0d3e) into msm-5.4 2020-08-06 17:12:45 -07:00
frame_vector.c mm: untag user pointers in get_vaddr_frames 2019-09-25 17:51:41 -07:00
frontswap.c
gup.c gup: document and work around "COW can break either way" issue 2020-06-17 16:40:30 +02:00
gup_benchmark.c mm/gup: fix memory leak in __gup_benchmark_ioctl 2020-01-09 10:20:00 +01:00
highmem.c
hmm.c pagewalk: separate function pointers from iterator data 2019-09-07 04:28:04 -03:00
huge_memory.c Merge android-5.4-stable.50 (a200ad5) into msm-5.4 2020-07-20 19:22:16 -07:00
hugetlb.c Merge android11-5.4.61+ (0d36496) into msm-5.4 2020-09-02 16:54:52 -07:00
hugetlb_cgroup.c mm: hugetlb: switch to css_tryget() in hugetlb_cgroup_charge_cgroup() 2019-11-15 18:34:00 -08:00
hwpoison-inject.c
init-mm.c mm: protect mm_rb tree with a rwlock 2020-06-11 16:02:05 +05:30
internal.h mm: provide speculative fault infrastructure 2020-06-11 16:02:05 +05:30
interval_tree.c
Kconfig mm/Kconfig: Default Enable LIMIT_MOVABLE_ZONE_ALLOC 2020-09-10 02:35:09 -07:00
Kconfig.debug mm, page_owner: set page owner info for tail pages 2020-02-27 15:13:14 -08:00
khugepaged.c Merge android11-5.4.61+ (0d36496) into msm-5.4 2020-09-02 16:54:52 -07:00
kmemleak-test.c
kmemleak.c kmemleak: Do not corrupt the object_list during clean-up 2019-10-14 08:56:16 -07:00
ksm.c Merge android-5.4-stable.45 (a9a13ee) into msm-5.4 2020-07-09 17:51:24 -07:00
list_lru.c
maccess.c uaccess: Add non-pagefault user-space write function 2020-01-17 19:48:40 +01:00
madvise.c Merge "mm: Fix sleeping while atomic during speculative page fault" 2020-06-25 19:09:40 -07:00
Makefile Merge "mm: Add notifier framework for showing memory" 2019-10-11 23:42:08 -07:00
memblock.c mm: memblock: Add more debug logs 2020-08-14 09:21:40 +05:30
memcontrol.c mm/memcg: fix refcount error while moving and swapping 2020-07-29 10:18:43 +02:00
memfd.c mm: page cache: store only head pages in i_pages 2019-09-24 15:54:08 -07:00
memory-failure.c mm: Enhance per process reclaim to consider shared pages 2020-06-02 21:31:03 -07:00
memory.c mm: Allow pages that are swapped in to come from the movable zone 2020-08-19 10:36:06 -07:00
memory_hotplug.c Merge android11-5.4.60 (8ae87ad) into msm-5.4 2020-08-31 13:04:44 -07:00
mempolicy.c Merge "mm: Fix sleeping while atomic during speculative page fault" 2020-06-25 19:09:40 -07:00
mempool.c
memremap.c mm/memory_hotplug: shrink zones when offlining memory 2020-01-09 10:19:56 +01:00
memtest.c
migrate.c mm/migrate: Pass vm_fault pointer to migrate_misplaced_page() 2020-06-11 16:02:03 +05:30
mincore.c mm: untag user pointers passed to memory syscalls 2019-09-25 17:51:41 -07:00
mlock.c mm: protect VMA modifications using VMA sequence count 2020-06-09 10:55:00 +05:30
mm_init.c
mmap.c Merge android11-5.4.60 (8ae87ad) into msm-5.4 2020-08-31 13:04:44 -07:00
mmu_context.c
mmu_gather.c mm/mmu_gather: invalidate TLB correctly on batch allocation failure and flush 2020-02-11 04:35:42 -08:00
mmu_notifier.c mm/mmu_notifiers: use the right return code for WARN_ON 2019-11-06 08:47:50 -08:00
mmzone.c
mprotect.c mm: protect VMA modifications using VMA sequence count 2020-06-09 10:55:00 +05:30
mremap.c Merge android-5.4-stable.45 (a9a13ee) into msm-5.4 2020-07-09 17:51:24 -07:00
msync.c mm: untag user pointers passed to memory syscalls 2019-09-25 17:51:41 -07:00
nommu.c x86/mm: split vmalloc_sync_all() 2020-03-25 08:25:58 +01:00
oom_kill.c FROMGIT: mm, oom_adj: don't loop through tasks in __set_oom_adj when not necessary 2020-09-16 09:56:55 -07:00
page-writeback.c mm/page-writeback.c: avoid potential division by zero in wb_min_max_ratio() 2020-01-23 08:22:41 +01:00
page_alloc.c mm: page_alloc: avoid fatal sig check for GFP_NOFS 2020-09-13 22:43:37 -07:00
page_counter.c Revert "ANDROID: Revert: Merge 5.4.60 into android11-5.4" 2020-08-23 13:12:51 +02:00
page_ext.c mm, page_owner: fix off-by-one error in __set_page_owner_handle() 2019-10-14 15:04:00 -07:00
page_idle.c
page_io.c Merge android-5.4.24 (ce5de62) into msm-5.4 2020-04-14 08:25:29 -07:00
page_isolation.c
page_owner.c soc: qcom: Enable pageowner support in minidump 2020-09-10 11:34:13 +05:30
page_poison.c debug-pagealloc: Panic on pagealloc corruption 2020-08-25 11:46:48 -07:00
page_vma_mapped.c mm: introduce page_size() 2019-09-24 15:54:08 -07:00
pagewalk.c pagewalk: use lockdep_assert_held for locking validation 2019-09-07 04:28:04 -03:00
percpu-internal.h
percpu-km.c
percpu-stats.c
percpu-vm.c
percpu.c percpu: Use struct_size() helper 2019-09-04 13:40:49 -07:00
pgtable-generic.c
process_vm_access.c
readahead.c
rmap.c mm: introduce __page_add_new_anon_rmap() 2020-06-11 16:02:04 +05:30
rodata_test.c
shmem.c Merge android-5.4-stable.45 (a9a13ee) into msm-5.4 2020-07-09 17:51:24 -07:00
showmem.c mm: showmem: make the notifiers atomic 2019-10-10 12:39:04 -07:00
shuffle.c mm: fix -Wmissing-prototypes warnings 2019-10-07 15:47:19 -07:00
shuffle.h
slab.c soc: qcom: Enable slabinfo support in minidump 2020-09-07 09:23:52 -07:00
slab.h mm: slab: make page_cgroup_ino() to recognize non-compound slab pages properly 2019-11-06 08:47:50 -08:00
slab_common.c soc: qcom: Enable slabinfo support in minidump 2020-09-07 09:23:52 -07:00
slob.c mm, sl[aou]b: guarantee natural alignment for kmalloc(power-of-two) 2019-10-07 15:47:20 -07:00
slub.c soc: qcom: Enable slabowner support in minidump 2020-09-10 11:48:20 +05:30
sparse-vmemmap.c
sparse.c mm/sparse: fix kernel crash with pfn_section_valid check 2020-04-01 11:02:03 +02:00
swap.c mm: introduce __lru_cache_add_active_or_unevictable 2020-06-11 16:02:03 +05:30
swap_cgroup.c
swap_slots.c mm: swap: Add null pointer check 2020-01-10 11:23:22 -08:00
swap_state.c Merge android11-5.4.52 (c7725ae) into msm-5.4 2020-07-27 01:21:35 -07:00
swapfile.c UPSTREAM: Merge remote-tracking branch 'aosp/upstream-f2fs-stable-linux-5.4.y' into android-5.4 (v5.7-rc1) 2020-04-15 03:11:03 +00:00
truncate.c mm/thp: allow dropping THP from page cache 2019-10-19 06:32:33 -04:00
usercopy.c mm: usercopy: skip stack page span check 2019-12-02 15:36:05 -08:00
userfaultfd.c Merge android-5.4.24 (ce5de62) into msm-5.4 2020-04-14 08:25:29 -07:00
util.c mm: add kvfree_sensitive() for freeing sensitive data objects 2020-06-17 16:40:23 +02:00
vmacache.c
vmalloc.c vmalloc: fix remap_vmalloc_range() bounds checks 2020-04-29 16:33:14 +02:00
vmpressure.c mm/vmpressure.c: fix a signedness bug in vmpressure_register_event() 2019-10-07 15:47:19 -07:00
vmscan.c mm: reduce the time spend by killed tasks in alloc path 2020-07-07 05:16:51 -07:00
vmstat.c Merge "mm: allow vmas with vm_ops to be speculatively handled" 2020-07-03 12:28:55 -07:00
workingset.c mm: workingset: remove zero-seek setting for shadow node shrinker 2020-04-06 23:51:59 -07:00
z3fold.c mm/z3fold.c: claim page in the beginning of free 2019-10-07 15:47:19 -07:00
zbud.c
zpool.c zpool: add malloc_support_movable to zpool_driver 2019-09-24 15:54:12 -07:00
zsmalloc.c mm: direct previous __GFP_CMA allocations to offlinable memory 2020-06-16 20:17:34 -07:00
zswap.c zswap: do not map same object twice 2019-09-24 15:54:12 -07:00