Skip to content

Commit d2c5231

Browse files
committed
Merge tag 'mm-hotfixes-stable-2023-10-01-08-34' of git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
Pull misc fixes from Andrew Morton: "Fourteen hotfixes, eleven of which are cc:stable. The remainder pertain to issues which were introduced after 6.5" * tag 'mm-hotfixes-stable-2023-10-01-08-34' of git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm: Crash: add lock to serialize crash hotplug handling selftests/mm: fix awk usage in charge_reserved_hugetlb.sh and hugetlb_reparenting_test.sh that may cause error mm: mempolicy: keep VMA walk if both MPOL_MF_STRICT and MPOL_MF_MOVE are specified mm/damon/vaddr-test: fix memory leak in damon_do_test_apply_three_regions() mm, memcg: reconsider kmem.limit_in_bytes deprecation mm: zswap: fix potential memory corruption on duplicate store arm64: hugetlb: fix set_huge_pte_at() to work with all swap entries mm: hugetlb: add huge page size param to set_huge_pte_at() maple_tree: add MAS_UNDERFLOW and MAS_OVERFLOW states maple_tree: add mas_is_active() to detect in-tree walks nilfs2: fix potential use after free in nilfs_gccache_submit_read_data() mm: abstract moving to the next PFN mm: report success more often from filemap_map_folio_range() fs: binfmt_elf_efpic: fix personality for ELF-FDPIC
2 parents 8f63336 + e2a8f20 commit d2c5231

File tree

38 files changed

+455
-169
lines changed

38 files changed

+455
-169
lines changed

Documentation/admin-guide/cgroup-v1/memory.rst

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,13 @@ Brief summary of control files.
9292
memory.oom_control set/show oom controls.
9393
memory.numa_stat show the number of memory usage per numa
9494
node
95+
memory.kmem.limit_in_bytes Deprecated knob to set and read the kernel
96+
memory hard limit. Kernel hard limit is not
97+
supported since 5.16. Writing any value to
98+
do file will not have any effect same as if
99+
nokmem kernel parameter was specified.
100+
Kernel memory is still charged and reported
101+
by memory.kmem.usage_in_bytes.
95102
memory.kmem.usage_in_bytes show current kernel memory allocation
96103
memory.kmem.failcnt show the number of kernel memory usage
97104
hits limits

arch/arm64/include/asm/hugetlb.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ pte_t arch_make_huge_pte(pte_t entry, unsigned int shift, vm_flags_t flags);
2828
#define arch_make_huge_pte arch_make_huge_pte
2929
#define __HAVE_ARCH_HUGE_SET_HUGE_PTE_AT
3030
extern void set_huge_pte_at(struct mm_struct *mm, unsigned long addr,
31-
pte_t *ptep, pte_t pte);
31+
pte_t *ptep, pte_t pte, unsigned long sz);
3232
#define __HAVE_ARCH_HUGE_PTEP_SET_ACCESS_FLAGS
3333
extern int huge_ptep_set_access_flags(struct vm_area_struct *vma,
3434
unsigned long addr, pte_t *ptep,

arch/arm64/mm/hugetlbpage.c

Lines changed: 7 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -241,29 +241,19 @@ static void clear_flush(struct mm_struct *mm,
241241
flush_tlb_range(&vma, saddr, addr);
242242
}
243243

244-
static inline struct folio *hugetlb_swap_entry_to_folio(swp_entry_t entry)
245-
{
246-
VM_BUG_ON(!is_migration_entry(entry) && !is_hwpoison_entry(entry));
247-
248-
return page_folio(pfn_to_page(swp_offset_pfn(entry)));
249-
}
250-
251244
void set_huge_pte_at(struct mm_struct *mm, unsigned long addr,
252-
pte_t *ptep, pte_t pte)
245+
pte_t *ptep, pte_t pte, unsigned long sz)
253246
{
254247
size_t pgsize;
255248
int i;
256249
int ncontig;
257250
unsigned long pfn, dpfn;
258251
pgprot_t hugeprot;
259252

260-
if (!pte_present(pte)) {
261-
struct folio *folio;
262-
263-
folio = hugetlb_swap_entry_to_folio(pte_to_swp_entry(pte));
264-
ncontig = num_contig_ptes(folio_size(folio), &pgsize);
253+
ncontig = num_contig_ptes(sz, &pgsize);
265254

266-
for (i = 0; i < ncontig; i++, ptep++)
255+
if (!pte_present(pte)) {
256+
for (i = 0; i < ncontig; i++, ptep++, addr += pgsize)
267257
set_pte_at(mm, addr, ptep, pte);
268258
return;
269259
}
@@ -273,7 +263,6 @@ void set_huge_pte_at(struct mm_struct *mm, unsigned long addr,
273263
return;
274264
}
275265

276-
ncontig = find_num_contig(mm, addr, ptep, &pgsize);
277266
pfn = pte_pfn(pte);
278267
dpfn = pgsize >> PAGE_SHIFT;
279268
hugeprot = pte_pgprot(pte);
@@ -571,5 +560,7 @@ pte_t huge_ptep_modify_prot_start(struct vm_area_struct *vma, unsigned long addr
571560
void huge_ptep_modify_prot_commit(struct vm_area_struct *vma, unsigned long addr, pte_t *ptep,
572561
pte_t old_pte, pte_t pte)
573562
{
574-
set_huge_pte_at(vma->vm_mm, addr, ptep, pte);
563+
unsigned long psize = huge_page_size(hstate_vma(vma));
564+
565+
set_huge_pte_at(vma->vm_mm, addr, ptep, pte, psize);
575566
}

arch/parisc/include/asm/hugetlb.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
#define __HAVE_ARCH_HUGE_SET_HUGE_PTE_AT
88
void set_huge_pte_at(struct mm_struct *mm, unsigned long addr,
9-
pte_t *ptep, pte_t pte);
9+
pte_t *ptep, pte_t pte, unsigned long sz);
1010

1111
#define __HAVE_ARCH_HUGE_PTEP_GET_AND_CLEAR
1212
pte_t huge_ptep_get_and_clear(struct mm_struct *mm, unsigned long addr,

arch/parisc/mm/hugetlbpage.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ static void __set_huge_pte_at(struct mm_struct *mm, unsigned long addr,
140140
}
141141

142142
void set_huge_pte_at(struct mm_struct *mm, unsigned long addr,
143-
pte_t *ptep, pte_t entry)
143+
pte_t *ptep, pte_t entry, unsigned long sz)
144144
{
145145
__set_huge_pte_at(mm, addr, ptep, entry);
146146
}

arch/powerpc/include/asm/nohash/32/hugetlb-8xx.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,8 @@ static inline int check_and_get_huge_psize(int shift)
4646
}
4747

4848
#define __HAVE_ARCH_HUGE_SET_HUGE_PTE_AT
49-
void set_huge_pte_at(struct mm_struct *mm, unsigned long addr, pte_t *ptep, pte_t pte);
49+
void set_huge_pte_at(struct mm_struct *mm, unsigned long addr, pte_t *ptep,
50+
pte_t pte, unsigned long sz);
5051

5152
#define __HAVE_ARCH_HUGE_PTE_CLEAR
5253
static inline void huge_pte_clear(struct mm_struct *mm, unsigned long addr,

arch/powerpc/mm/book3s64/hugetlbpage.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,11 +143,14 @@ pte_t huge_ptep_modify_prot_start(struct vm_area_struct *vma,
143143
void huge_ptep_modify_prot_commit(struct vm_area_struct *vma, unsigned long addr,
144144
pte_t *ptep, pte_t old_pte, pte_t pte)
145145
{
146+
unsigned long psize;
146147

147148
if (radix_enabled())
148149
return radix__huge_ptep_modify_prot_commit(vma, addr, ptep,
149150
old_pte, pte);
150-
set_huge_pte_at(vma->vm_mm, addr, ptep, pte);
151+
152+
psize = huge_page_size(hstate_vma(vma));
153+
set_huge_pte_at(vma->vm_mm, addr, ptep, pte, psize);
151154
}
152155

153156
void __init hugetlbpage_init_defaultsize(void)

arch/powerpc/mm/book3s64/radix_hugetlbpage.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ void radix__huge_ptep_modify_prot_commit(struct vm_area_struct *vma,
4747
pte_t old_pte, pte_t pte)
4848
{
4949
struct mm_struct *mm = vma->vm_mm;
50+
unsigned long psize = huge_page_size(hstate_vma(vma));
5051

5152
/*
5253
* POWER9 NMMU must flush the TLB after clearing the PTE before
@@ -58,5 +59,5 @@ void radix__huge_ptep_modify_prot_commit(struct vm_area_struct *vma,
5859
atomic_read(&mm->context.copros) > 0)
5960
radix__flush_hugetlb_page(vma, addr);
6061

61-
set_huge_pte_at(vma->vm_mm, addr, ptep, pte);
62+
set_huge_pte_at(vma->vm_mm, addr, ptep, pte, psize);
6263
}

arch/powerpc/mm/nohash/8xx.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,8 @@ static int __ref __early_map_kernel_hugepage(unsigned long va, phys_addr_t pa,
9191
if (new && WARN_ON(pte_present(*ptep) && pgprot_val(prot)))
9292
return -EINVAL;
9393

94-
set_huge_pte_at(&init_mm, va, ptep, pte_mkhuge(pfn_pte(pa >> PAGE_SHIFT, prot)));
94+
set_huge_pte_at(&init_mm, va, ptep,
95+
pte_mkhuge(pfn_pte(pa >> PAGE_SHIFT, prot)), psize);
9596

9697
return 0;
9798
}

arch/powerpc/mm/pgtable.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -288,7 +288,8 @@ int huge_ptep_set_access_flags(struct vm_area_struct *vma,
288288
}
289289

290290
#if defined(CONFIG_PPC_8xx)
291-
void set_huge_pte_at(struct mm_struct *mm, unsigned long addr, pte_t *ptep, pte_t pte)
291+
void set_huge_pte_at(struct mm_struct *mm, unsigned long addr, pte_t *ptep,
292+
pte_t pte, unsigned long sz)
292293
{
293294
pmd_t *pmd = pmd_off(mm, addr);
294295
pte_basic_t val;

0 commit comments

Comments
 (0)