android_kernel_google_msm/fs
Igor Redko 37e62218c3 mm/page_alloc.c: calculate 'available' memory in a separate function
commit d02bd27bd33dd7e8d22594cd568b81be0cb584cd upstream.

Add a new field, VIRTIO_BALLOON_S_AVAIL, to virtio_balloon memory
statistics protocol, corresponding to 'Available' in /proc/meminfo.

It indicates to the hypervisor how big the balloon can be inflated
without pushing the guest system to swap.  This metric would be very
useful in VM orchestration software to improve memory management of
different VMs under overcommit.

This patch (of 2):

Factor out calculation of the available memory counter into a separate
exportable function, in order to be able to use it in other parts of the
kernel.

In particular, it appears a relevant metric to report to the hypervisor
via virtio-balloon statistics interface (in a followup patch).

Signed-off-by: Igor Redko <redkoi@virtuozzo.com>
Signed-off-by: Denis V. Lunev <den@openvz.org>
Reviewed-by: Roman Kagan <rkagan@virtuozzo.com>
Cc: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
[bwh: Backported to 4.4 as dependency of commit a1078e821b60
 "xen: let alloc_xenballooned_pages() fail if not enough memory free"]
Signed-off-by: Ben Hutchings <ben.hutchings@codethink.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
Change-Id: Ib8cae94ddd9742752ecc795129be642c57f8cc15
2020-12-01 19:08:20 +01:00
..
9p mm: kill vma flag VM_CAN_NONLINEAR 2020-11-19 11:23:37 +01:00
adfs fs: push sync_filesystem() down to the file system's remount_fs() 2020-11-19 11:23:46 +01:00
affs fs: push sync_filesystem() down to the file system's remount_fs() 2020-11-19 11:23:46 +01:00
afs don't pass nameidata to ->create() 2018-12-07 22:28:00 +04:00
autofs4 stop passing nameidata to ->lookup() 2018-12-07 22:26:28 +04:00
befs fs: push sync_filesystem() down to the file system's remount_fs() 2020-11-19 11:23:46 +01:00
bfs don't pass nameidata to ->create() 2018-12-07 22:28:00 +04:00
btrfs fs: push sync_filesystem() down to the file system's remount_fs() 2020-11-19 11:23:46 +01:00
cachefiles don't pass nameidata * to vfs_create() 2018-12-07 22:28:48 +04:00
ceph mm: kill vma flag VM_CAN_NONLINEAR 2020-11-19 11:23:37 +01:00
cifs fs: push sync_filesystem() down to the file system's remount_fs() 2020-11-19 11:23:46 +01:00
coda fs: push sync_filesystem() down to the file system's remount_fs() 2020-11-19 11:23:46 +01:00
configfs stop passing nameidata to ->lookup() 2018-12-07 22:26:28 +04:00
cramfs fs: push sync_filesystem() down to the file system's remount_fs() 2020-11-19 11:23:46 +01:00
crypto ext4/fscrypto: avoid RCU lookup in d_revalidate 2016-10-29 23:12:37 +08:00
debugfs fs: push sync_filesystem() down to the file system's remount_fs() 2020-11-19 11:23:46 +01:00
devpts fs: push sync_filesystem() down to the file system's remount_fs() 2020-11-19 11:23:46 +01:00
dlm
ecryptfs don't pass nameidata * to vfs_create() 2018-12-07 22:28:48 +04:00
efs fs: push sync_filesystem() down to the file system's remount_fs() 2020-11-19 11:23:46 +01:00
exfat exfat: don't pass nameidata to ->create() / stop passing nameidata to ->lookup() 2020-10-05 12:24:49 +02:00
exofs don't pass nameidata to ->create() 2018-12-07 22:28:00 +04:00
exportfs move d_rcu from overlapping d_child to overlapping d_alias 2017-09-22 19:11:55 +03:00
ext2 fs: push sync_filesystem() down to the file system's remount_fs() 2020-11-19 11:23:46 +01:00
ext3 fs: push sync_filesystem() down to the file system's remount_fs() 2020-11-19 11:23:46 +01:00
ext4 fs: push sync_filesystem() down to the file system's remount_fs() 2020-11-19 11:23:46 +01:00
f2fs fs: push sync_filesystem() down to the file system's remount_fs() 2020-11-19 11:23:46 +01:00
fat fs: push sync_filesystem() down to the file system's remount_fs() 2020-11-19 11:23:46 +01:00
freevxfs fs: push sync_filesystem() down to the file system's remount_fs() 2020-11-19 11:23:46 +01:00
fscache FS-Cache: Handle a write to the page immediately beyond the EOF marker 2016-10-26 23:15:25 +08:00
fuse fs: push sync_filesystem() down to the file system's remount_fs() 2020-11-19 11:23:46 +01:00
gfs2 fs: push sync_filesystem() down to the file system's remount_fs() 2020-11-19 11:23:46 +01:00
hfs fs: push sync_filesystem() down to the file system's remount_fs() 2020-11-19 11:23:46 +01:00
hfsplus fs: push sync_filesystem() down to the file system's remount_fs() 2020-11-19 11:23:46 +01:00
hostfs don't pass nameidata to ->create() 2018-12-07 22:28:00 +04:00
hpfs fs: push sync_filesystem() down to the file system's remount_fs() 2020-11-19 11:23:46 +01:00
hppfs stop passing nameidata to ->lookup() 2018-12-07 22:26:28 +04:00
hugetlbfs don't pass nameidata to ->create() 2018-12-07 22:28:00 +04:00
isofs stop passing nameidata to ->lookup() 2018-12-07 22:26:28 +04:00
jbd
jbd2 jbd2: Fix unreclaimed pages after truncate in data=journal mode 2016-10-26 23:15:34 +08:00
jffs2 fs: push sync_filesystem() down to the file system's remount_fs() 2020-11-19 11:23:46 +01:00
jfs fs: push sync_filesystem() down to the file system's remount_fs() 2020-11-19 11:23:46 +01:00
lockd lockd: Try to reconnect if statd has moved 2015-02-02 17:04:42 +08:00
logfs don't pass nameidata to ->create() 2018-12-07 22:28:00 +04:00
minix fs: push sync_filesystem() down to the file system's remount_fs() 2020-11-19 11:23:46 +01:00
ncpfs fs: push sync_filesystem() down to the file system's remount_fs() 2020-11-19 11:23:46 +01:00
nfs fs: push sync_filesystem() down to the file system's remount_fs() 2020-11-19 11:23:46 +01:00
nfs_common
nfsd don't pass nameidata * to vfs_create() 2018-12-07 22:28:48 +04:00
nilfs2 fs: push sync_filesystem() down to the file system's remount_fs() 2020-11-19 11:23:46 +01:00
nls
notify fanotify: check file flags passed in fanotify_init 2018-12-07 22:28:48 +04:00
ntfs fs: push sync_filesystem() down to the file system's remount_fs() 2020-11-19 11:23:46 +01:00
ocfs2 fs: push sync_filesystem() down to the file system's remount_fs() 2020-11-19 11:23:46 +01:00
omfs don't pass nameidata to ->create() 2018-12-07 22:28:00 +04:00
openpromfs fs: push sync_filesystem() down to the file system's remount_fs() 2020-11-19 11:23:46 +01:00
proc mm/page_alloc.c: calculate 'available' memory in a separate function 2020-12-01 19:08:20 +01:00
pstore fs: push sync_filesystem() down to the file system's remount_fs() 2020-11-19 11:23:46 +01:00
qnx4 fs: push sync_filesystem() down to the file system's remount_fs() 2020-11-19 11:23:46 +01:00
qnx6 fs: push sync_filesystem() down to the file system's remount_fs() 2020-11-19 11:23:46 +01:00
quota vfs: define struct filename and have getname() return it 2018-12-07 22:28:48 +04:00
ramfs don't pass nameidata to ->create() 2018-12-07 22:28:00 +04:00
reiserfs fs: push sync_filesystem() down to the file system's remount_fs() 2020-11-19 11:23:46 +01:00
romfs fs: push sync_filesystem() down to the file system's remount_fs() 2020-11-19 11:23:46 +01:00
sdcardfs mm: kill vma flag VM_CAN_NONLINEAR 2020-11-19 11:23:37 +01:00
squashfs fs: push sync_filesystem() down to the file system's remount_fs() 2020-11-19 11:23:46 +01:00
sysfs stop passing nameidata to ->lookup() 2018-12-07 22:26:28 +04:00
sysv fs: push sync_filesystem() down to the file system's remount_fs() 2020-11-19 11:23:46 +01:00
ubifs fs: push sync_filesystem() down to the file system's remount_fs() 2020-11-19 11:23:46 +01:00
udf fs: push sync_filesystem() down to the file system's remount_fs() 2020-11-19 11:23:46 +01:00
ufs fs: push sync_filesystem() down to the file system's remount_fs() 2020-11-19 11:23:46 +01:00
xfs fs: push sync_filesystem() down to the file system's remount_fs() 2020-11-19 11:23:46 +01:00
yaffs2
aio.c Merge remote-tracking branch 'stable/linux-3.4.y' into lineage-15.1 2017-12-27 17:13:15 +03:00
anon_inodes.c
attr.c Merge remote-tracking branch 'stable/linux-3.4.y' into lineage-15.1 2017-12-27 17:13:15 +03:00
bad_inode.c don't pass nameidata to ->create() 2018-12-07 22:28:00 +04:00
binfmt_aout.c
binfmt_elf.c binfmt_elf: Don't clobber passed executable's file header 2016-10-26 23:15:28 +08:00
binfmt_elf_fdpic.c
binfmt_em86.c
binfmt_flat.c
binfmt_misc.c Merge remote-tracking branch 'stable/linux-3.4.y' into lineage-15.1 2017-12-27 17:13:15 +03:00
binfmt_script.c
binfmt_som.c
bio-integrity.c
bio.c
block_dev.c
buffer.c Merge remote-tracking branch 'stable/linux-3.4.y' into lineage-15.1 2017-12-27 17:13:15 +03:00
char_dev.c
compat.c vfs: define struct filename and have getname() return it 2018-12-07 22:28:48 +04:00
compat_binfmt_elf.c
compat_ioctl.c Merge remote-tracking branch 'stable/linux-3.4.y' into lineage-15.1 2017-12-27 17:13:15 +03:00
dcache.c [O_TMPFILE] it's still short a few helpers, but infrastructure should be OK now... 2018-12-07 22:28:48 +04:00
dcookies.c
direct-io.c
drop_caches.c
eventfd.c
eventpoll.c Merge remote-tracking branch 'stable/linux-3.4.y' into lineage-15.1 2017-12-27 17:13:15 +03:00
exec.c vfs: make path_openat take a struct filename pointer 2018-12-07 22:28:48 +04:00
fcntl.c vfs: add missing check for __O_TMPFILE in fcntl_init() 2018-12-07 22:28:48 +04:00
fhandle.c vfs: read file_handle only once in handle_to_path 2016-10-29 23:12:11 +08:00
fifo.c
file.c
file_table.c get rid of s_files and files_lock 2016-03-21 09:17:55 +08:00
filesystems.c vfs: define struct filename and have getname() return it 2018-12-07 22:28:48 +04:00
fs-writeback.c Merge remote-tracking branch 'stable/linux-3.4.y' into lineage-15.1 2017-12-27 17:13:15 +03:00
fs_struct.c sdcardfs: override umask on mkdir and create 2017-09-22 19:12:02 +03:00
generic_acl.c BACKPORT: posix_acl: Clear SGID bit when setting file permissions 2017-06-26 20:26:17 +03:00
inode.c allow the temp files created by open() to be linked to 2018-12-07 22:28:48 +04:00
internal.h vfs: make path_openat take a struct filename pointer 2018-12-07 22:28:48 +04:00
ioctl.c
ioprio.c Merge remote-tracking branch 'stable/linux-3.4.y' into lineage-15.1 2017-12-27 17:13:15 +03:00
Kconfig exFAT support 2020-10-05 11:42:38 +02:00
Kconfig.binfmt
libfs.c stop passing nameidata to ->lookup() 2018-12-07 22:26:28 +04:00
locks.c
Makefile exFAT support 2020-10-05 11:42:38 +02:00
mbcache.c
mount.h proc: Usable inode numbers for the namespace file descriptors. 2015-07-13 11:18:01 -07:00
mpage.c
namei.c path_openat(): fix double fput() 2018-12-07 22:28:48 +04:00
namespace.c vfs: define struct filename and have getname() return it 2018-12-07 22:28:48 +04:00
no-block.c
open.c fs: Fix file mode for O_TMPFILE 2018-12-07 22:28:48 +04:00
pipe.c Merge remote-tracking branch 'stable/linux-3.4.y' into lineage-15.1 2017-12-27 17:13:15 +03:00
pnode.c Merge remote-tracking branch 'stable/linux-3.4.y' into lineage-15.1 2017-12-27 17:13:15 +03:00
pnode.h ANDROID: mnt: remount should propagate to slaves of slaves 2017-09-22 19:12:11 +03:00
posix_acl.c Merge remote-tracking branch 'stable/linux-3.4.y' into lineage-15.1 2017-12-27 17:13:15 +03:00
proc_namespace.c vfs: Allow filesystems to access their private mount data 2017-09-22 19:12:06 +03:00
read_write.c
read_write.h
readdir.c kernel: Only expose su when daemon is running 2017-05-19 18:41:25 -06:00
select.c Merge remote-tracking branch 'stable/linux-3.4.y' into lineage-15.1 2017-12-27 17:13:15 +03:00
seq_file.c fs/seq_file: Use vmalloc by default for allocations > PAGE_SIZE 2014-11-18 15:13:24 -08:00
signalfd.c
splice.c Merge remote-tracking branch 'stable/linux-3.4.y' into lineage-15.1 2017-12-27 17:13:15 +03:00
stack.c
stat.c vfs: make O_PATH file descriptors usable for 'fstat()' 2020-11-24 22:49:23 +01:00
statfs.c
super.c vmscan: remove obsolete shrink_control comment 2020-11-18 10:38:32 +01:00
sync.c fs/sync.c: make sync_file_range(2) use WB_SYNC_NONE writeback 2017-12-31 13:02:49 +03:00
timerfd.c timerfd: support CLOCK_BOOTTIME clock 2017-08-27 19:07:23 +03:00
utimes.c vfs: Add setattr2 for filesystems with per mount permissions 2017-09-22 19:12:07 +03:00
xattr.c
xattr_acl.c