Skip to content

Commit 26e2878

Browse files
committed
Merge tag 'mm-hotfixes-stable-2023-03-14-16-51' of git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
Pull misc fixes from Andrew Morton: "Eleven hotfixes. Four of these are cc:stable and the remainder address post-6.2 issues or aren't considered suitable for backporting. Seven of these fixes are for MM" * tag 'mm-hotfixes-stable-2023-03-14-16-51' of git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm: mm/damon/paddr: fix folio_nr_pages() after folio_put() in damon_pa_mark_accessed_or_deactivate() mm/damon/paddr: fix folio_size() call after folio_put() in damon_pa_young() ocfs2: fix data corruption after failed write migrate_pages: try migrate in batch asynchronously firstly migrate_pages: move split folios processing out of migrate_pages_batch() migrate_pages: fix deadlock in batched migration .mailmap: add Alexandre Ghiti personal email address mailmap: correct Dikshita Agarwal's Qualcomm email address mailmap: updates for Jarkko Sakkinen mm/userfaultfd: propagate uffd-wp bit when PTE-mapping the huge zeropage mm: teach mincore_hugetlb about pte markers
2 parents 29db00c + dd52a61 commit 26e2878

File tree

6 files changed

+122
-99
lines changed

6 files changed

+122
-99
lines changed

.mailmap

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ Alexander Lobakin <[email protected]> <[email protected]>
2828
Alexander Mikhalitsyn <[email protected]> <[email protected]>
2929
Alexander Mikhalitsyn <[email protected]> <[email protected]>
3030
31+
3132
Alexei Starovoitov <[email protected]> <[email protected]>
3233
Alexei Starovoitov <[email protected]> <[email protected]>
3334
Alexei Starovoitov <[email protected]> <[email protected]>
@@ -121,7 +122,7 @@ Dengcheng Zhu <[email protected]> <[email protected]>
121122
122123
123124
124-
Dikshita Agarwal <[email protected].com> <[email protected]>
125+
Dikshita Agarwal <quic_dikshita@quicinc.com> <[email protected]>
125126
Dmitry Baryshkov <[email protected]>
126127
Dmitry Baryshkov <[email protected]> <[[email protected]]>
127128
@@ -194,6 +195,7 @@ Jan Glauber <[email protected]> <[email protected]>
194195
195196
196197
198+
197199
198200
199201

fs/ocfs2/aops.c

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1977,11 +1977,26 @@ int ocfs2_write_end_nolock(struct address_space *mapping,
19771977
}
19781978

19791979
if (unlikely(copied < len) && wc->w_target_page) {
1980+
loff_t new_isize;
1981+
19801982
if (!PageUptodate(wc->w_target_page))
19811983
copied = 0;
19821984

1983-
ocfs2_zero_new_buffers(wc->w_target_page, start+copied,
1984-
start+len);
1985+
new_isize = max_t(loff_t, i_size_read(inode), pos + copied);
1986+
if (new_isize > page_offset(wc->w_target_page))
1987+
ocfs2_zero_new_buffers(wc->w_target_page, start+copied,
1988+
start+len);
1989+
else {
1990+
/*
1991+
* When page is fully beyond new isize (data copy
1992+
* failed), do not bother zeroing the page. Invalidate
1993+
* it instead so that writeback does not get confused
1994+
* put page & buffer dirty bits into inconsistent
1995+
* state.
1996+
*/
1997+
block_invalidate_folio(page_folio(wc->w_target_page),
1998+
0, PAGE_SIZE);
1999+
}
19852000
}
19862001
if (wc->w_target_page)
19872002
flush_dcache_page(wc->w_target_page);

mm/damon/paddr.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,6 @@ static bool damon_pa_young(unsigned long paddr, unsigned long *folio_sz)
130130
accessed = false;
131131
else
132132
accessed = true;
133-
folio_put(folio);
134133
goto out;
135134
}
136135

@@ -144,10 +143,10 @@ static bool damon_pa_young(unsigned long paddr, unsigned long *folio_sz)
144143

145144
if (need_lock)
146145
folio_unlock(folio);
147-
folio_put(folio);
148146

149147
out:
150148
*folio_sz = folio_size(folio);
149+
folio_put(folio);
151150
return accessed;
152151
}
153152

@@ -281,8 +280,8 @@ static inline unsigned long damon_pa_mark_accessed_or_deactivate(
281280
folio_mark_accessed(folio);
282281
else
283282
folio_deactivate(folio);
284-
folio_put(folio);
285283
applied += folio_nr_pages(folio);
284+
folio_put(folio);
286285
}
287286
return applied * PAGE_SIZE;
288287
}

mm/huge_memory.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2037,7 +2037,7 @@ static void __split_huge_zero_page_pmd(struct vm_area_struct *vma,
20372037
{
20382038
struct mm_struct *mm = vma->vm_mm;
20392039
pgtable_t pgtable;
2040-
pmd_t _pmd;
2040+
pmd_t _pmd, old_pmd;
20412041
int i;
20422042

20432043
/*
@@ -2048,7 +2048,7 @@ static void __split_huge_zero_page_pmd(struct vm_area_struct *vma,
20482048
*
20492049
* See Documentation/mm/mmu_notifier.rst
20502050
*/
2051-
pmdp_huge_clear_flush(vma, haddr, pmd);
2051+
old_pmd = pmdp_huge_clear_flush(vma, haddr, pmd);
20522052

20532053
pgtable = pgtable_trans_huge_withdraw(mm, pmd);
20542054
pmd_populate(mm, &_pmd, pgtable);
@@ -2057,6 +2057,8 @@ static void __split_huge_zero_page_pmd(struct vm_area_struct *vma,
20572057
pte_t *pte, entry;
20582058
entry = pfn_pte(my_zero_pfn(haddr), vma->vm_page_prot);
20592059
entry = pte_mkspecial(entry);
2060+
if (pmd_uffd_wp(old_pmd))
2061+
entry = pte_mkuffd_wp(entry);
20602062
pte = pte_offset_map(&_pmd, haddr);
20612063
VM_BUG_ON(!pte_none(*pte));
20622064
set_pte_at(mm, haddr, pte, entry);

0 commit comments

Comments
 (0)