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 branch 'mm-hotfixes-stable' into mm-stable in order to merge "mm/huge_memory: only get folio_order() once during __folio_split()" into mm-stable.

+63 -36
+2
.mailmap
··· 689 689 Sachin P Sant <ssant@in.ibm.com> 690 690 Sai Prakash Ranjan <quic_saipraka@quicinc.com> <saiprakash.ranjan@codeaurora.org> 691 691 Sakari Ailus <sakari.ailus@linux.intel.com> <sakari.ailus@iki.fi> 692 + Sam Protsenko <semen.protsenko@linaro.org> 693 + Sam Protsenko <semen.protsenko@linaro.org> <semen.protsenko@globallogic.com> 692 694 Sam Ravnborg <sam@mars.ravnborg.org> 693 695 Sankeerth Billakanti <quic_sbillaka@quicinc.com> <sbillaka@codeaurora.org> 694 696 Santosh Shilimkar <santosh.shilimkar@oracle.org>
+1
MAINTAINERS
··· 13801 13801 F: Documentation/core-api/kho/* 13802 13802 F: include/linux/kexec_handover.h 13803 13803 F: kernel/kexec_handover.c 13804 + F: lib/test_kho.c 13804 13805 F: tools/testing/selftests/kho/ 13805 13806 13806 13807 KEYS-ENCRYPTED
+14 -13
mm/filemap.c
··· 3691 3691 struct folio *folio, unsigned long start, 3692 3692 unsigned long addr, unsigned int nr_pages, 3693 3693 unsigned long *rss, unsigned short *mmap_miss, 3694 - bool can_map_large) 3694 + pgoff_t file_end) 3695 3695 { 3696 + struct address_space *mapping = folio->mapping; 3696 3697 unsigned int ref_from_caller = 1; 3697 3698 vm_fault_t ret = 0; 3698 3699 struct page *page = folio_page(folio, start); ··· 3702 3701 unsigned long addr0; 3703 3702 3704 3703 /* 3705 - * Map the large folio fully where possible. 3704 + * Map the large folio fully where possible: 3706 3705 * 3707 - * The folio must not cross VMA or page table boundary. 3706 + * - The folio is fully within size of the file or belong 3707 + * to shmem/tmpfs; 3708 + * - The folio doesn't cross VMA boundary; 3709 + * - The folio doesn't cross page table boundary; 3708 3710 */ 3709 3711 addr0 = addr - start * PAGE_SIZE; 3710 - if (can_map_large && folio_within_vma(folio, vmf->vma) && 3712 + if ((file_end >= folio_next_index(folio) || shmem_mapping(mapping)) && 3713 + folio_within_vma(folio, vmf->vma) && 3711 3714 (addr0 & PMD_MASK) == ((addr0 + folio_size(folio) - 1) & PMD_MASK)) { 3712 3715 vmf->pte -= start; 3713 3716 page -= start; ··· 3826 3821 unsigned long rss = 0; 3827 3822 unsigned int nr_pages = 0, folio_type; 3828 3823 unsigned short mmap_miss = 0, mmap_miss_saved; 3829 - bool can_map_large; 3830 3824 3831 3825 rcu_read_lock(); 3832 3826 folio = next_uptodate_folio(&xas, mapping, end_pgoff); ··· 3836 3832 end_pgoff = min(end_pgoff, file_end); 3837 3833 3838 3834 /* 3839 - * Do not allow to map with PTEs beyond i_size and with PMD 3840 - * across i_size to preserve SIGBUS semantics. 3835 + * Do not allow to map with PMD across i_size to preserve 3836 + * SIGBUS semantics. 3841 3837 * 3842 3838 * Make an exception for shmem/tmpfs that for long time 3843 3839 * intentionally mapped with PMDs across i_size. 3844 3840 */ 3845 - can_map_large = shmem_mapping(mapping) || 3846 - file_end >= folio_next_index(folio); 3847 - 3848 - if (can_map_large && filemap_map_pmd(vmf, folio, start_pgoff)) { 3841 + if ((file_end >= folio_next_index(folio) || shmem_mapping(mapping)) && 3842 + filemap_map_pmd(vmf, folio, start_pgoff)) { 3849 3843 ret = VM_FAULT_NOPAGE; 3850 3844 goto out; 3851 3845 } ··· 3872 3870 else 3873 3871 ret |= filemap_map_folio_range(vmf, folio, 3874 3872 xas.xa_index - folio->index, addr, 3875 - nr_pages, &rss, &mmap_miss, 3876 - can_map_large); 3873 + nr_pages, &rss, &mmap_miss, file_end); 3877 3874 3878 3875 folio_unlock(folio); 3879 3876 } while ((folio = next_uptodate_folio(&xas, mapping, end_pgoff)) != NULL);
+10 -12
mm/huge_memory.c
··· 3560 3560 if (folio != page_folio(split_at) || folio != page_folio(lock_at)) 3561 3561 return -EINVAL; 3562 3562 3563 + /* 3564 + * Folios that just got truncated cannot get split. Signal to the 3565 + * caller that there was a race. 3566 + * 3567 + * TODO: this will also currently refuse shmem folios that are in the 3568 + * swapcache. 3569 + */ 3570 + if (!is_anon && !folio->mapping) 3571 + return -EBUSY; 3572 + 3563 3573 if (new_order >= folio_order(folio)) 3564 3574 return -EINVAL; 3565 3575 ··· 3610 3600 gfp_t gfp; 3611 3601 3612 3602 mapping = folio->mapping; 3613 - 3614 - /* Truncated ? */ 3615 - /* 3616 - * TODO: add support for large shmem folio in swap cache. 3617 - * When shmem is in swap cache, mapping is NULL and 3618 - * folio_test_swapcache() is true. 3619 - */ 3620 - if (!mapping) { 3621 - ret = -EBUSY; 3622 - goto out; 3623 - } 3624 - 3625 3603 min_order = mapping_min_folio_order(folio->mapping); 3626 3604 if (new_order < min_order) { 3627 3605 ret = -EINVAL;
+27
mm/memfd.c
··· 96 96 NULL, 97 97 gfp_mask); 98 98 if (folio) { 99 + u32 hash; 100 + 101 + /* 102 + * Zero the folio to prevent information leaks to userspace. 103 + * Use folio_zero_user() which is optimized for huge/gigantic 104 + * pages. Pass 0 as addr_hint since this is not a faulting path 105 + * and we don't have a user virtual address yet. 106 + */ 107 + folio_zero_user(folio, 0); 108 + 109 + /* 110 + * Mark the folio uptodate before adding to page cache, 111 + * as required by filemap.c and other hugetlb paths. 112 + */ 113 + __folio_mark_uptodate(folio); 114 + 115 + /* 116 + * Serialize hugepage allocation and instantiation to prevent 117 + * races with concurrent allocations, as required by all other 118 + * callers of hugetlb_add_to_page_cache(). 119 + */ 120 + hash = hugetlb_fault_mutex_hash(memfd->f_mapping, idx); 121 + mutex_lock(&hugetlb_fault_mutex_table[hash]); 122 + 99 123 err = hugetlb_add_to_page_cache(folio, 100 124 memfd->f_mapping, 101 125 idx); 126 + 127 + mutex_unlock(&hugetlb_fault_mutex_table[hash]); 128 + 102 129 if (err) { 103 130 folio_put(folio); 104 131 goto err_unresv;
+1
mm/mmap_lock.c
··· 257 257 if (PTR_ERR(vma) == -EAGAIN) { 258 258 count_vm_vma_lock_event(VMA_LOCK_MISS); 259 259 /* The area was replaced with another one */ 260 + mas_set(&mas, address); 260 261 goto retry; 261 262 } 262 263
+1 -3
mm/swapfile.c
··· 2023 2023 local_lock(&percpu_swap_cluster.lock); 2024 2024 offset = cluster_alloc_swap_entry(si, 0, 1); 2025 2025 local_unlock(&percpu_swap_cluster.lock); 2026 - if (offset) { 2026 + if (offset) 2027 2027 entry = swp_entry(si->type, offset); 2028 - atomic_long_dec(&nr_swap_pages); 2029 - } 2030 2028 } 2031 2029 put_swap_device(si); 2032 2030 }
+7 -8
tools/testing/selftests/mm/uffd-unit-tests.c
··· 1758 1758 uffd_test_ops = mem_type->mem_ops; 1759 1759 uffd_test_case_ops = test->test_case_ops; 1760 1760 1761 - if (mem_type->mem_flag & (MEM_HUGETLB_PRIVATE | MEM_HUGETLB)) 1761 + if (mem_type->mem_flag & (MEM_HUGETLB_PRIVATE | MEM_HUGETLB)) { 1762 1762 gopts.page_size = default_huge_page_size(); 1763 - else 1763 + if (gopts.page_size == 0) { 1764 + uffd_test_skip("huge page size is 0, feature missing?"); 1765 + continue; 1766 + } 1767 + } else { 1764 1768 gopts.page_size = psize(); 1769 + } 1765 1770 1766 1771 /* Ensure we have at least 2 pages */ 1767 1772 gopts.nr_pages = MAX(UFFD_TEST_MEM_SIZE, gopts.page_size * 2) ··· 1781 1776 continue; 1782 1777 1783 1778 uffd_test_start("%s on %s", test->name, mem_type->name); 1784 - if ((mem_type->mem_flag == MEM_HUGETLB || 1785 - mem_type->mem_flag == MEM_HUGETLB_PRIVATE) && 1786 - (default_huge_page_size() == 0)) { 1787 - uffd_test_skip("huge page size is 0, feature missing?"); 1788 - continue; 1789 - } 1790 1779 if (!uffd_feature_supported(test)) { 1791 1780 uffd_test_skip("feature missing"); 1792 1781 continue;