Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge tag 'mm-stable-2023-09-04-14-00' of git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm

Pull more MM updates from Andrew Morton:

- Stefan Roesch has added ksm statistics to /proc/pid/smaps

- Also a number of singleton patches, mainly cleanups and leftovers

* tag 'mm-stable-2023-09-04-14-00' of git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm:
mm/kmemleak: move up cond_resched() call in page scanning loop
mm: page_alloc: remove stale CMA guard code
MAINTAINERS: add rmap.h to mm entry
rmap: remove anon_vma_link() nommu stub
proc/ksm: add ksm stats to /proc/pid/smaps
mm/hwpoison: rename hwp_walk* to hwpoison_walk*
mm: memory-failure: add PageOffline() check

+29 -30
+4
Documentation/filesystems/proc.rst
··· 461 461 Private_Dirty: 0 kB 462 462 Referenced: 892 kB 463 463 Anonymous: 0 kB 464 + KSM: 0 kB 464 465 LazyFree: 0 kB 465 466 AnonHugePages: 0 kB 466 467 ShmemPmdMapped: 0 kB ··· 501 500 "Anonymous" shows the amount of memory that does not belong to any file. Even 502 501 a mapping associated with a file may contain anonymous pages: when MAP_PRIVATE 503 502 and a page is modified, the file page is replaced by a private anonymous copy. 503 + 504 + "KSM" reports how many of the pages are KSM pages. Note that KSM-placed zeropages 505 + are not included, only actual KSM pages. 504 506 505 507 "LazyFree" shows the amount of memory which is marked by madvise(MADV_FREE). 506 508 The memory isn't freed immediately with madvise(). It's freed in memory
+1
MAINTAINERS
··· 13742 13742 F: include/linux/mm.h 13743 13743 F: include/linux/mmzone.h 13744 13744 F: include/linux/pagewalk.h 13745 + F: include/linux/rmap.h 13745 13746 F: include/trace/events/ksm.h 13746 13747 F: mm/ 13747 13748 F: tools/mm/
+6
fs/proc/task_mmu.c
··· 4 4 #include <linux/hugetlb.h> 5 5 #include <linux/huge_mm.h> 6 6 #include <linux/mount.h> 7 + #include <linux/ksm.h> 7 8 #include <linux/seq_file.h> 8 9 #include <linux/highmem.h> 9 10 #include <linux/ptrace.h> ··· 397 396 unsigned long swap; 398 397 unsigned long shared_hugetlb; 399 398 unsigned long private_hugetlb; 399 + unsigned long ksm; 400 400 u64 pss; 401 401 u64 pss_anon; 402 402 u64 pss_file; ··· 453 451 if (!PageSwapBacked(page) && !dirty && !PageDirty(page)) 454 452 mss->lazyfree += size; 455 453 } 454 + 455 + if (PageKsm(page)) 456 + mss->ksm += size; 456 457 457 458 mss->resident += size; 458 459 /* Accumulate the size in pages that have been accessed. */ ··· 830 825 SEQ_PUT_DEC(" kB\nPrivate_Dirty: ", mss->private_dirty); 831 826 SEQ_PUT_DEC(" kB\nReferenced: ", mss->referenced); 832 827 SEQ_PUT_DEC(" kB\nAnonymous: ", mss->anonymous); 828 + SEQ_PUT_DEC(" kB\nKSM: ", mss->ksm); 833 829 SEQ_PUT_DEC(" kB\nLazyFree: ", mss->lazyfree); 834 830 SEQ_PUT_DEC(" kB\nAnonHugePages: ", mss->anonymous_thp); 835 831 SEQ_PUT_DEC(" kB\nShmemPmdMapped: ", mss->shmem_thp);
-1
include/linux/rmap.h
··· 479 479 480 480 #define anon_vma_init() do {} while (0) 481 481 #define anon_vma_prepare(vma) (0) 482 - #define anon_vma_link(vma) do {} while (0) 483 482 484 483 static inline int folio_referenced(struct folio *folio, int is_locked, 485 484 struct mem_cgroup *memcg,
+3 -2
mm/kmemleak.c
··· 1584 1584 for (pfn = start_pfn; pfn < end_pfn; pfn++) { 1585 1585 struct page *page = pfn_to_online_page(pfn); 1586 1586 1587 + if (!(pfn & 63)) 1588 + cond_resched(); 1589 + 1587 1590 if (!page) 1588 1591 continue; 1589 1592 ··· 1597 1594 if (page_count(page) == 0) 1598 1595 continue; 1599 1596 scan_block(page, page + 1, NULL); 1600 - if (!(pfn & 63)) 1601 - cond_resched(); 1602 1597 } 1603 1598 } 1604 1599 put_online_mems();
+11 -10
mm/memory-failure.c
··· 717 717 collect_procs_file(page, tokill, force_early); 718 718 } 719 719 720 - struct hwp_walk { 720 + struct hwpoison_walk { 721 721 struct to_kill tk; 722 722 unsigned long pfn; 723 723 int flags; ··· 752 752 753 753 #ifdef CONFIG_TRANSPARENT_HUGEPAGE 754 754 static int check_hwpoisoned_pmd_entry(pmd_t *pmdp, unsigned long addr, 755 - struct hwp_walk *hwp) 755 + struct hwpoison_walk *hwp) 756 756 { 757 757 pmd_t pmd = *pmdp; 758 758 unsigned long pfn; ··· 770 770 } 771 771 #else 772 772 static int check_hwpoisoned_pmd_entry(pmd_t *pmdp, unsigned long addr, 773 - struct hwp_walk *hwp) 773 + struct hwpoison_walk *hwp) 774 774 { 775 775 return 0; 776 776 } ··· 779 779 static int hwpoison_pte_range(pmd_t *pmdp, unsigned long addr, 780 780 unsigned long end, struct mm_walk *walk) 781 781 { 782 - struct hwp_walk *hwp = walk->private; 782 + struct hwpoison_walk *hwp = walk->private; 783 783 int ret = 0; 784 784 pte_t *ptep, *mapped_pte; 785 785 spinlock_t *ptl; ··· 813 813 unsigned long addr, unsigned long end, 814 814 struct mm_walk *walk) 815 815 { 816 - struct hwp_walk *hwp = walk->private; 816 + struct hwpoison_walk *hwp = walk->private; 817 817 pte_t pte = huge_ptep_get(ptep); 818 818 struct hstate *h = hstate_vma(walk->vma); 819 819 ··· 824 824 #define hwpoison_hugetlb_range NULL 825 825 #endif 826 826 827 - static const struct mm_walk_ops hwp_walk_ops = { 827 + static const struct mm_walk_ops hwpoison_walk_ops = { 828 828 .pmd_entry = hwpoison_pte_range, 829 829 .hugetlb_entry = hwpoison_hugetlb_range, 830 830 .walk_lock = PGWALK_RDLOCK, ··· 847 847 int flags) 848 848 { 849 849 int ret; 850 - struct hwp_walk priv = { 850 + struct hwpoison_walk priv = { 851 851 .pfn = pfn, 852 852 }; 853 853 priv.tk.tsk = p; ··· 856 856 return -EFAULT; 857 857 858 858 mmap_read_lock(p->mm); 859 - ret = walk_page_range(p->mm, 0, TASK_SIZE, &hwp_walk_ops, 859 + ret = walk_page_range(p->mm, 0, TASK_SIZE, &hwpoison_walk_ops, 860 860 (void *)&priv); 861 861 if (ret == 1 && priv.tk.addr) 862 862 kill_proc(&priv.tk, pfn, flags); ··· 1562 1562 * Here we are interested only in user-mapped pages, so skip any 1563 1563 * other types of pages. 1564 1564 */ 1565 - if (PageReserved(p) || PageSlab(p) || PageTable(p)) 1565 + if (PageReserved(p) || PageSlab(p) || PageTable(p) || PageOffline(p)) 1566 1566 return true; 1567 1567 if (!(PageLRU(hpage) || PageHuge(p))) 1568 1568 return true; ··· 2533 2533 goto unlock_mutex; 2534 2534 } 2535 2535 2536 - if (folio_test_slab(folio) || PageTable(&folio->page) || folio_test_reserved(folio)) 2536 + if (folio_test_slab(folio) || PageTable(&folio->page) || 2537 + folio_test_reserved(folio) || PageOffline(&folio->page)) 2537 2538 goto unlock_mutex; 2538 2539 2539 2540 /*
+4 -17
mm/page_alloc.c
··· 2641 2641 do { 2642 2642 page = NULL; 2643 2643 spin_lock_irqsave(&zone->lock, flags); 2644 - /* 2645 - * order-0 request can reach here when the pcplist is skipped 2646 - * due to non-CMA allocation context. HIGHATOMIC area is 2647 - * reserved for high-order atomic allocation, so order-0 2648 - * request should skip it. 2649 - */ 2650 2644 if (alloc_flags & ALLOC_HIGHATOMIC) 2651 2645 page = __rmqueue_smallest(zone, order, MIGRATE_HIGHATOMIC); 2652 2646 if (!page) { ··· 2774 2780 WARN_ON_ONCE((gfp_flags & __GFP_NOFAIL) && (order > 1)); 2775 2781 2776 2782 if (likely(pcp_allowed_order(order))) { 2777 - /* 2778 - * MIGRATE_MOVABLE pcplist could have the pages on CMA area and 2779 - * we need to skip it when CMA area isn't allowed. 2780 - */ 2781 - if (!IS_ENABLED(CONFIG_CMA) || alloc_flags & ALLOC_CMA || 2782 - migratetype != MIGRATE_MOVABLE) { 2783 - page = rmqueue_pcplist(preferred_zone, zone, order, 2784 - migratetype, alloc_flags); 2785 - if (likely(page)) 2786 - goto out; 2787 - } 2783 + page = rmqueue_pcplist(preferred_zone, zone, order, 2784 + migratetype, alloc_flags); 2785 + if (likely(page)) 2786 + goto out; 2788 2787 } 2789 2788 2790 2789 page = rmqueue_buddy(preferred_zone, zone, order, alloc_flags,