diff --git a/drivers/firmware/efi/efi.c b/drivers/firmware/efi/efi.c index c406de00883aea7044a14fda3338b82fcdb8cc94..97a0916d6502cb6e8e01d92fb25e3d799cd548ac 100644 --- a/drivers/firmware/efi/efi.c +++ b/drivers/firmware/efi/efi.c @@ -31,6 +31,7 @@ #include #include #include +#include #include @@ -446,6 +447,11 @@ void __init efi_find_mirror(void) if (!mirrored_kernelcore) return; + if (is_kdump_kernel()) { + mirrored_kernelcore = false; + return; + } + for_each_efi_memory_desc(md) { unsigned long long start = md->phys_addr; unsigned long long size = md->num_pages << EFI_PAGE_SHIFT; diff --git a/include/linux/mem_reliable.h b/include/linux/mem_reliable.h index 79228a1b2f0b8f21641794133baf499bbd3dab08..dc1344b843b08176980d5a6b5ed405db2ee9ac5d 100644 --- a/include/linux/mem_reliable.h +++ b/include/linux/mem_reliable.h @@ -132,8 +132,19 @@ static inline bool reliable_allow_fb_enabled(void) static inline void reliable_page_counter(struct page *page, struct mm_struct *mm, int val) { - if (page_reliable(page)) - atomic_long_add(val, &mm->reliable_nr_page); + if (!page_reliable(page)) + return; + + atomic_long_add(val, &mm->reliable_nr_page); + + /* + * Update reliable page counter to zero if underflows. + * + * Since reliable page counter is used for debug purpose only, + * there is no real function problem by doing this. + */ + if (unlikely(atomic_long_read(&mm->reliable_nr_page) < 0)) + atomic_long_set(&mm->reliable_nr_page, 0); } static inline void reliable_clear_page_counter(struct mm_struct *mm) diff --git a/mm/memory.c b/mm/memory.c index 5941a4f4ea4b154243a368f73f2925814f1cf45d..5893c178251a03881d2d14eb67dda50ca822f7f4 100644 --- a/mm/memory.c +++ b/mm/memory.c @@ -887,6 +887,7 @@ copy_present_pte(struct vm_area_struct *dst_vma, struct vm_area_struct *src_vma, get_page(page); page_dup_rmap(page, false); rss[mm_counter(page)]++; + reliable_page_counter(page, dst_vma->vm_mm, 1); } /*