Mike Kravetz
22146c3ce9
hugetlbfs: dirty pages as they are added to pagecache
...
Some test systems were experiencing negative huge page reserve counts and
incorrect file block counts. This was traced to /proc/sys/vm/drop_caches
removing clean pages from hugetlbfs file pagecaches. When non-hugetlbfs
explicit code removes the pages, the appropriate accounting is not
performed.
This can be recreated as follows:
fallocate -l 2M /dev/hugepages/foo
echo 1 > /proc/sys/vm/drop_caches
fallocate -l 2M /dev/hugepages/foo
grep -i huge /proc/meminfo
AnonHugePages: 0 kB
ShmemHugePages: 0 kB
HugePages_Total: 2048
HugePages_Free: 2047
HugePages_Rsvd: 18446744073709551615
HugePages_Surp: 0
Hugepagesize: 2048 kB
Hugetlb: 4194304 kB
ls -lsh /dev/hugepages/foo
4.0M -rw-r--r--. 1 root root 2.0M Oct 17 20:05 /dev/hugepages/foo
To address this issue, dirty pages as they are added to pagecache. This
can easily be reproduced with fallocate as shown above. Read faulted
pages will eventually end up being marked dirty. But there is a window
where they are clean and could be impacted by code such as drop_caches.
So, just dirty them all as they are added to the pagecache.
Link: http://lkml.kernel.org/r/[email protected]
Fixes: 6bda666a03 ("hugepages: fold find_or_alloc_pages into huge_no_page()")
Signed-off-by: Mike Kravetz <[email protected] >
Acked-by: Mihcla Hocko <[email protected] >
Reviewed-by: Khalid Aziz <[email protected] >
Cc: Hugh Dickins <[email protected] >
Cc: Naoya Horiguchi <[email protected] >
Cc: "Aneesh Kumar K . V" <[email protected] >
Cc: Andrea Arcangeli <[email protected] >
Cc: "Kirill A . Shutemov" <[email protected] >
Cc: Davidlohr Bueso <[email protected] >
Cc: Alexander Viro <[email protected] >
Cc: <[email protected] >
Signed-off-by: Andrew Morton <[email protected] >
Signed-off-by: Linus Torvalds <[email protected] >
2018-10-26 16:38:16 -07:00
..
kasan
mm/kasan/quarantine.c: make quarantine_lock a raw_spinlock_t
2018-10-26 16:38:15 -07:00
backing-dev.c
blkcg: delay blkg destruction until after writeback has finished
2018-08-31 14:48:56 -06:00
balloon_compaction.c
bootmem.c
docs/mm: bootmem: add overview documentation
2018-08-02 12:17:27 -06:00
cleancache.c
mm: use octal not symbolic permissions
2018-06-15 07:55:25 +09:00
cma.c
mm/cma: remove unsupported gfp_mask parameter from cma_alloc()
2018-08-17 16:20:32 -07:00
cma.h
cma_debug.c
mm/cma: remove unsupported gfp_mask parameter from cma_alloc()
2018-08-17 16:20:32 -07:00
compaction.c
psi: pressure stall information for CPU, memory, and IO
2018-10-26 16:26:32 -07:00
debug.c
mm: provide kernel parameter to allow disabling page init poisoning
2018-10-26 16:26:34 -07:00
debug_page_ref.c
dmapool.c
mm: use octal not symbolic permissions
2018-06-15 07:55:25 +09:00
early_ioremap.c
fadvise.c
vfs: implement readahead(2) using POSIX_FADV_WILLNEED
2018-08-30 20:01:32 +02:00
failslab.c
mm: use octal not symbolic permissions
2018-06-15 07:55:25 +09:00
filemap.c
mm/filemap.c: use vmf_error()
2018-10-26 16:26:35 -07:00
frame_vector.c
frontswap.c
mm: use octal not symbolic permissions
2018-06-15 07:55:25 +09:00
gup.c
mm/gup: cache dev_pagemap while pinning pages
2018-10-26 16:38:15 -07:00
gup_benchmark.c
mm/gup_benchmark.c: add additional pinning methods
2018-10-26 16:38:15 -07:00
highmem.c
hmm.c
mm: defer ZONE_DEVICE page initialization to the point where we init pgmap
2018-10-26 16:26:34 -07:00
huge_memory.c
mm: thp: fix mmu_notifier in migrate_misplaced_transhuge_page()
2018-10-26 16:38:15 -07:00
hugetlb.c
hugetlbfs: dirty pages as they are added to pagecache
2018-10-26 16:38:16 -07:00
hugetlb_cgroup.c
hwpoison-inject.c
init-mm.c
mm: Allocate the mm_cpumask (mm->cpu_bitmap[]) dynamically based on nr_cpu_ids
2018-07-17 09:35:30 +02:00
internal.h
mm: Change return type int to vm_fault_t for fault handlers
2018-08-23 18:48:44 -07:00
interval_tree.c
Kconfig
mm: disable deferred struct page for 32-bit arches
2018-09-20 22:01:11 +02:00
Kconfig.debug
mm: clarify CONFIG_PAGE_POISONING and usage
2018-08-22 10:52:44 -07:00
khugepaged.c
mm: Change return type int to vm_fault_t for fault handlers
2018-08-23 18:48:44 -07:00
kmemleak-test.c
kmemleak.c
kmemleak: add module param to print warnings to dmesg
2018-10-26 16:25:19 -07:00
ksm.c
include/linux/compiler*.h: make compiler-*.h mutually exclusive
2018-08-22 17:31:34 -07:00
list_lru.c
mm/list_lru: introduce list_lru_shrink_walk_irq()
2018-08-17 16:20:32 -07:00
maccess.c
x86/fault: BUG() when uaccess helpers fault on kernel addresses
2018-09-03 15:12:09 +02:00
madvise.c
mm: madvise(MADV_DODUMP): allow hugetlbfs pages
2018-10-05 16:32:05 -07:00
Makefile
arm64 updates for 4.20:
2018-10-22 17:30:06 +01:00
memblock.c
mm: provide kernel parameter to allow disabling page init poisoning
2018-10-26 16:26:34 -07:00
memcontrol.c
mm: don't raise MEMCG_OOM event due to failed high-order allocation
2018-10-26 16:38:14 -07:00
memfd.c
alloc_file(): switch to passing O_... flags instead of FMODE_... mode
2018-07-12 10:02:57 -04:00
memory-failure.c
libnvdimm-for-4.19_dax-memory-failure
2018-08-25 18:43:59 -07:00
memory.c
mm/memory.c: recheck page table entry with page table lock held
2018-10-26 16:26:35 -07:00
memory_hotplug.c
mm/memory_hotplug.c: clean up node_states_check_changes_offline()
2018-10-26 16:26:33 -07:00
mempolicy.c
mm/mempolicy.c: use match_string() helper to simplify the code
2018-10-26 16:26:33 -07:00
mempool.c
mm/mempool.c: add missing parameter description
2018-08-22 10:52:44 -07:00
memtest.c
migrate.c
mm: thp: relocate flush_cache_range() in migrate_misplaced_transhuge_page()
2018-10-26 16:38:15 -07:00
mincore.c
mlock.c
dax: remove VM_MIXEDMAP for fsdax and device dax
2018-08-17 16:20:27 -07:00
mm_init.c
mm: access zone->node via zone_to_nid() and zone_set_nid()
2018-08-22 10:52:45 -07:00
mmap.c
mm: brk: downgrade mmap_sem to read when shrinking
2018-10-26 16:26:35 -07:00
mmu_context.c
mmu_gather.c
mm/memory: Move mmu_gather and TLB invalidation code into its own file
2018-09-07 15:19:25 +01:00
mmu_notifier.c
Revert "mm, mmu_notifier: annotate mmu notifiers with blockable invalidate callbacks"
2018-10-26 16:25:19 -07:00
mmzone.c
mprotect.c
x86/speculation/l1tf: Disallow non privileged high MMIO PROT_NONE mappings
2018-06-20 19:10:01 +02:00
mremap.c
mm: mremap: downgrade mmap_sem to read when shrinking
2018-10-26 16:26:35 -07:00
msync.c
nobootmem.c
mm/memblock: add a name for memblock flags enumeration
2018-08-02 12:17:27 -06:00
nommu.c
mm/gup: cache dev_pagemap while pinning pages
2018-10-26 16:38:15 -07:00
oom_kill.c
Merge branch 'siginfo-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/ebiederm/user-namespace
2018-10-24 11:22:39 +01:00
page-writeback.c
mm/page-writeback.c: fix range_cyclic writeback vs writepages deadlock
2018-10-26 16:38:14 -07:00
page_alloc.c
mm: return zero_resv_unavail optimization
2018-10-26 16:38:15 -07:00
page_counter.c
memcg: introduce memory.min
2018-06-07 17:34:36 -07:00
page_ext.c
mm/page_ext.c: constify lookup_page_ext() argument
2018-08-17 16:20:28 -07:00
page_idle.c
mm: use octal not symbolic permissions
2018-06-15 07:55:25 +09:00
page_io.c
mm: split SWP_FILE into SWP_ACTIVATED and SWP_FS
2018-10-26 16:38:15 -07:00
page_isolation.c
page_owner.c
mm: use octal not symbolic permissions
2018-06-15 07:55:25 +09:00
page_poison.c
page_vma_mapped.c
pagewalk.c
percpu-internal.h
percpu-km.c
percpu-stats.c
treewide: Use array_size() in vmalloc()
2018-06-12 16:19:22 -07:00
percpu-vm.c
percpu.c
percpu: stop leaking bitmap metadata blocks
2018-10-07 14:50:12 -07:00
pgtable-generic.c
x86/mm: Page size aware flush_tlb_mm_range()
2018-10-09 16:51:11 +02:00
process_vm_access.c
quicklist.c
readahead.c
vfs: implement readahead(2) using POSIX_FADV_WILLNEED
2018-08-30 20:01:32 +02:00
rmap.c
mm: migration: fix migration of huge PMD shared pages
2018-10-05 16:32:04 -07:00
rodata_test.c
shmem.c
mm: shmem.c: Correctly annotate new inodes for lockdep
2018-09-20 22:01:11 +02:00
slab.c
mm, slab: combine kmalloc_caches and kmalloc_dma_caches
2018-10-26 16:26:31 -07:00
slab.h
mm: introduce CONFIG_MEMCG_KMEM as combination of CONFIG_MEMCG && !CONFIG_SLOB
2018-08-17 16:20:30 -07:00
slab_common.c
mm, slab: shorten kmalloc cache names for large sizes
2018-10-26 16:26:32 -07:00
slob.c
slub.c
mm, slab: combine kmalloc_caches and kmalloc_dma_caches
2018-10-26 16:26:31 -07:00
sparse-vmemmap.c
mm/sparse: delete old sparse_init and enable new one
2018-08-17 16:20:32 -07:00
sparse.c
mm: provide kernel parameter to allow disabling page init poisoning
2018-10-26 16:26:34 -07:00
swap.c
mm/swap.c: remove duplicated include
2018-10-26 16:26:33 -07:00
swap_cgroup.c
swap_slots.c
mm, swap, get_swap_pages: use entry_size instead of cluster in parameter
2018-08-22 10:52:44 -07:00
swap_state.c
mm: workingset: tell cache transitions from workingset thrashing
2018-10-26 16:26:32 -07:00
swapfile.c
mm: export add_swap_extent()
2018-10-26 16:38:15 -07:00
truncate.c
usercopy.c
usercopy: Allow boot cmdline disabling of hardening
2018-07-04 08:04:52 -07:00
userfaultfd.c
userfaultfd: prevent non-cooperative events vs mcopy_atomic races
2018-06-07 17:34:38 -07:00
util.c
kvfree(): fix misleading comment
2018-10-26 16:26:33 -07:00
vmacache.c
mm: get rid of vmacache_flush_all() entirely
2018-09-13 15:18:04 -10:00
vmalloc.c
vfree: add debug might_sleep()
2018-10-26 16:26:33 -07:00
vmpressure.c
mm/vmpressure.c: convert to use match_string() helper
2018-06-07 17:34:36 -07:00
vmscan.c
mm: zero-seek shrinkers
2018-10-26 16:26:33 -07:00
vmstat.c
mm/vmstat.c: assert that vmstat_text is in sync with stat_items_size
2018-10-26 16:26:35 -07:00
workingset.c
mm: zero-seek shrinkers
2018-10-26 16:26:33 -07:00
z3fold.c
zbud.c
zpool.c
zsmalloc.c
mm/zsmalloc.c: fix fall-through annotation
2018-10-26 16:26:35 -07:00
zswap.c
zswap: re-check zswap_is_full() after do zswap_shrink()
2018-07-26 19:38:03 -07:00