android_kernel_motorola_sm6375/fs
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
..
9p This is the 5.4.59 stable release 2020-08-19 08:40:57 +02:00
adfs
affs
afs This is the 5.4.61 stable release 2020-08-26 11:11:38 +02:00
autofs
befs
bfs
btrfs This is the 5.4.61 stable release 2020-08-26 11:11:38 +02:00
cachefiles cachefiles: Fix race between read_waiter and read_copier involving op->to_do 2020-06-03 08:21:11 +02:00
ceph This is the 5.4.61 stable release 2020-08-26 11:11:38 +02:00
cifs Revert "ANDROID: Revert: Merge 5.4.60 into android11-5.4" 2020-08-23 13:12:51 +02:00
coda
configfs configfs: fix config_item refcnt leak in configfs_rmdir() 2020-05-27 17:46:30 +02:00
cramfs
crypto ANDROID: fscrypt: fix DUN contiguity with inline encryption + IV_INO_LBLK_32 policies 2020-07-14 15:48:10 +00:00
debugfs debugfs: Check module state before warning in {full/open}_proxy_open() 2020-04-17 10:50:02 +02:00
devpts
dlm dlm: Fix kobject memleak 2020-08-19 08:16:21 +02:00
ecryptfs This is the 5.4.23 stable release 2020-03-01 10:17:44 +01:00
efivarfs
efs
erofs This is the 5.4.59 stable release 2020-08-19 08:40:57 +02:00
exportfs
ext2 Revert "ANDROID: Revert: Merge 5.4.60 into android11-5.4" 2020-08-23 13:12:51 +02:00
ext4 This is the 5.4.61 stable release 2020-08-26 11:11:38 +02:00
f2fs Merge android11-5.4.52 (c7725ae) into msm-5.4 2020-07-27 01:21:35 -07:00
fat fat: don't allow to mount if the FAT length == 0 2020-06-17 16:40:36 +02:00
freevxfs
fscache
fuse This is the 5.4.54 stable release 2020-07-29 13:27:01 +02:00
gfs2 This is the 5.4.61 stable release 2020-08-26 11:11:38 +02:00
hfs
hfsplus This is the 5.4.33 stable release 2020-04-17 11:26:58 +02:00
hostfs
hpfs
hugetlbfs Merge android-5.4.24 (ce5de62) into msm-5.4 2020-04-14 08:25:29 -07:00
incfs ANDROID: Incremental fs: fix magic compatibility again 2020-08-26 14:05:41 +00:00
iomap Merge android-5.4.8 (de197c5) into msm-5.4 2020-03-06 19:19:20 -08:00
isofs
jbd2 jbd2: add the missing unlock_buffer() in the error path of jbd2_write_superblock() 2020-08-26 10:40:52 +02:00
jffs2 This is the 5.4.61 stable release 2020-08-26 11:11:38 +02:00
jfs
kernfs This is the 5.4.59 stable release 2020-08-19 08:40:57 +02:00
lockd
minix Revert "ANDROID: Revert: Merge 5.4.60 into android11-5.4" 2020-08-23 13:12:51 +02:00
nfs Revert "ANDROID: Revert: Merge 5.4.60 into android11-5.4" 2020-08-23 13:12:51 +02:00
nfs_common
nfsd nfsd: Fix NFSv4 READ on RDMA when using readv 2020-08-11 15:33:42 +02:00
nilfs2 nilfs2: fix null pointer dereference at nilfs_segctor_do_construct() 2020-06-17 16:40:29 +02:00
nls
notify fanotify: fix ignore mask logic for events on child and on dir 2020-06-17 16:40:24 +02:00
ntfs utimes: Clamp the timestamps in notify_change() 2020-02-11 04:35:12 -08:00
ocfs2 Revert "ANDROID: Revert: Merge 5.4.60 into android11-5.4" 2020-08-23 13:12:51 +02:00
omfs
openpromfs
orangefs Revert "ANDROID: Revert: Merge 5.4.60 into android11-5.4" 2020-08-23 13:12:51 +02:00
overlayfs This is the 5.4.53 stable release 2020-07-23 12:36:54 +02:00
proc FROMGIT: mm, oom_adj: don't loop through tasks in __set_oom_adj when not necessary 2020-09-16 09:56:55 -07:00
pstore Merge "pstore: Register pstore reserved memory into Minidump" 2020-09-09 15:28:45 -07:00
qnx4
qnx6
quota
ramfs
reiserfs This is the 5.4.22 stable release 2020-02-24 09:16:10 +01:00
romfs romfs: fix uninitialized memory leak in romfs_dev_read() 2020-08-26 10:40:51 +02:00
squashfs
sysfs
sysv
tracefs
ubifs Revert "ANDROID: Revert: Merge 5.4.60 into android11-5.4" 2020-08-23 13:12:51 +02:00
udf udf: Fix free space reporting for metadata and virtual partitions 2020-02-24 08:36:44 +01:00
ufs Revert "ANDROID: Revert: Merge 5.4.60 into android11-5.4" 2020-08-23 13:12:51 +02:00
unicode FROMLIST: unicode: Add utf8_casefold_hash 2020-02-20 21:21:02 +00:00
verity fs-verity: remove unnecessary extern keywords 2020-06-16 14:06:46 -07:00
xfs This is the 5.4.61 stable release 2020-08-26 11:11:38 +02:00
aio.c aio: fix async fsync creds 2020-06-17 16:40:24 +02:00
anon_inodes.c
attr.c Revert "ANDROID: vfs: Add setattr2 for filesystems with per mount permissions" 2020-05-29 14:48:38 +02:00
bad_inode.c
binfmt_aout.c
binfmt_elf.c fs/binfmt_elf.c: allocate initialized memory in fill_thread_core_info() 2020-06-03 08:21:27 +02:00
binfmt_elf_fdpic.c
binfmt_em86.c
binfmt_flat.c
binfmt_misc.c
binfmt_script.c
block_dev.c block: Fix use-after-free in blkdev_get() 2020-06-24 17:50:47 +02:00
buffer.c Merge android-5.4-stable.45 (a9a13ee) into msm-5.4 2020-07-09 17:51:24 -07:00
char_dev.c
compat.c
compat_binfmt_elf.c
compat_ioctl.c
coredump.c Revert "ANDROID: vfs: Add setattr2 for filesystems with per mount permissions" 2020-05-29 14:48:38 +02:00
d_path.c
dax.c dax: pass NOWAIT flag to iomap_apply 2020-03-05 16:43:36 +01:00
dcache.c
dcookies.c
direct-io.c ANDROID: fscrypt: handle direct I/O with IV_INO_LBLK_32 2020-05-21 11:52:18 -07:00
drop_caches.c
eventfd.c eventfd: track eventfd_signal() recursion depth 2020-02-11 04:35:37 -08:00
eventpoll.c This is the 5.4.61 stable release 2020-08-26 11:11:38 +02:00
exec.c Revert "ANDROID: vfs: Add permission2 for filesystems with per mount permissions" 2020-05-29 14:48:37 +02:00
fcntl.c
fhandle.c
file.c fix multiplication overflow in copy_fdtable() 2020-05-27 17:46:12 +02:00
file_table.c
filesystems.c fs/filesystems.c: downgrade user-reachable WARN_ONCE() to pr_warn_once() 2020-04-17 10:50:21 +02:00
fs-writeback.c Merge remote-tracking branch 'aosp/upstream-f2fs-stable-linux-5.4.y' into android-5.4-stable 2020-06-24 11:13:19 -07:00
fs_context.c
fs_parser.c
fs_pin.c
fs_struct.c Revert "ANDROID: sdcardfs: Enable modular sdcardfs" 2020-05-29 15:08:00 +02:00
fs_types.c
fsopen.c
inode.c Revert "ANDROID: vfs: Add setattr2 for filesystems with per mount permissions" 2020-05-29 14:48:38 +02:00
internal.h Revert "ANDROID: fs: Restore vfs_path_lookup() export" 2020-05-29 14:48:37 +02:00
io_uring.c io_uring: Fix NULL pointer dereference in loop_rw_iter() 2020-08-19 08:16:29 +02:00
ioctl.c
Kconfig ANDROID: sdcardfs: remove sdcardfs from system 2020-05-29 14:48:37 +02:00
Kconfig.binfmt
libfs.c Merge remote-tracking branch 'aosp/upstream-f2fs-stable-linux-5.4.y' into android-5.4-stable 2020-06-15 13:22:44 -07:00
locks.c locks: reinstate locks_delete_block optimization 2020-03-25 08:25:41 +01:00
Makefile ANDROID: GKI: set vfs-only exports into their own namespace 2020-07-07 18:07:10 +02:00
mbcache.c
mount.h
mpage.c This is the 5.4.13 stable release 2020-01-17 23:38:39 +01:00
namei.c ANDROID: GKI: set vfs-only exports into their own namespace 2020-07-07 18:07:10 +02:00
namespace.c
no-block.c
nsfs.c
open.c ANDROID: GKI: set vfs-only exports into their own namespace 2020-07-07 18:07:10 +02:00
pipe.c
pnode.c This is the 5.4.37 stable release 2020-05-02 09:01:51 +02:00
pnode.h
posix_acl.c
proc_namespace.c
read_write.c ANDROID: GKI: set vfs-only exports into their own namespace 2020-07-07 18:07:10 +02:00
readdir.c readdir: be more conservative with directory entry names 2020-01-29 16:45:31 +01:00
select.c
seq_file.c
signalfd.c fs/signalfd.c: fix inconsistent return codes for signalfd4 2020-08-26 10:40:58 +02:00
splice.c
stack.c
stat.c ANDROID: GKI: set vfs-only exports into their own namespace 2020-07-07 18:07:10 +02:00
statfs.c
super.c Fix use after free in get_tree_bdev() 2020-05-06 08:15:15 +02:00
sync.c
timerfd.c
userfaultfd.c mm: protect VMA modifications using VMA sequence count 2020-06-09 10:55:00 +05:30
utimes.c Revert "ANDROID: vfs: Add setattr2 for filesystems with per mount permissions" 2020-05-29 14:48:38 +02:00
xattr.c This is the 5.4.58 stable release 2020-08-11 18:37:58 +02:00