Skip to content

Commit

Permalink
Merge mm-hotfixes-stable into mm-stable to pick up depended-upon chan…
Browse files Browse the repository at this point in the history
…ges.
  • Loading branch information
akpm00 committed Oct 18, 2023
2 parents b054020 + fc7f04d commit 5ef8f1b
Show file tree
Hide file tree
Showing 20 changed files with 261 additions and 74 deletions.
6 changes: 4 additions & 2 deletions .mailmap
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ Baolin Wang <[email protected]> <[email protected]>
Baolin Wang <[email protected]> <[email protected]>
Bart Van Assche <[email protected]> <[email protected]>
Bart Van Assche <[email protected]> <[email protected]>
Bartosz Golaszewski <[email protected]> <[email protected]>
Ben Dooks <[email protected]> <[email protected]>
Ben Dooks <[email protected]> <[email protected]>
Ben Gardner <[email protected]>
Expand Down Expand Up @@ -449,9 +450,10 @@ Oleksandr Natalenko <[email protected]> <[email protected]>
Oleksij Rempel <[email protected]> <[email protected]>
Oleksij Rempel <[email protected]> <[email protected]>
Oleksij Rempel <[email protected]> <[email protected]>
Oleksij Rempel <[email protected]> <[email protected]>
Oleksij Rempel <linux@rempel-privat.de> <[email protected]>
Oleksij Rempel <[email protected]>
Oleksij Rempel <o.rempel@pengutronix.de> <[email protected]>
Oliver Upton <[email protected]> <[email protected]>
Ondřej Jirman <[email protected]> <[email protected]>
Oza Pawandeep <[email protected]> <[email protected]>
Pali Rohár <[email protected]> <[email protected]>
Paolo 'Blaisorblade' Giarrusso <[email protected]>
Expand Down
2 changes: 1 addition & 1 deletion MAINTAINERS
Original file line number Diff line number Diff line change
Expand Up @@ -6748,7 +6748,7 @@ F: drivers/gpu/drm/panel/panel-sitronix-st7701.c
DRM DRIVER FOR SITRONIX ST7703 PANELS
M: Guido Günther <[email protected]>
R: Purism Kernel Team <[email protected]>
R: Ondrej Jirman <[email protected]>
R: Ondrej Jirman <[email protected]>
S: Maintained
F: Documentation/devicetree/bindings/display/panel/rocktech,jh057n00900.yaml
F: drivers/gpu/drm/panel/panel-sitronix-st7703.c
Expand Down
2 changes: 1 addition & 1 deletion arch/riscv/mm/fault.c
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ static inline void mm_fault_error(struct pt_regs *regs, unsigned long addr, vm_f
}
pagefault_out_of_memory();
return;
} else if (fault & VM_FAULT_SIGBUS) {
} else if (fault & (VM_FAULT_SIGBUS | VM_FAULT_HWPOISON | VM_FAULT_HWPOISON_LARGE)) {
/* Kernel mode? Handle exceptions or die */
if (!user_mode(regs)) {
no_context(regs, addr);
Expand Down
19 changes: 13 additions & 6 deletions arch/riscv/mm/hugetlbpage.c
Original file line number Diff line number Diff line change
Expand Up @@ -183,15 +183,22 @@ void set_huge_pte_at(struct mm_struct *mm,
pte_t pte,
unsigned long sz)
{
unsigned long hugepage_shift;
int i, pte_num;

if (!pte_napot(pte)) {
set_pte_at(mm, addr, ptep, pte);
return;
}
if (sz >= PGDIR_SIZE)
hugepage_shift = PGDIR_SHIFT;
else if (sz >= P4D_SIZE)
hugepage_shift = P4D_SHIFT;
else if (sz >= PUD_SIZE)
hugepage_shift = PUD_SHIFT;
else if (sz >= PMD_SIZE)
hugepage_shift = PMD_SHIFT;
else
hugepage_shift = PAGE_SHIFT;

pte_num = napot_pte_num(napot_cont_order(pte));
for (i = 0; i < pte_num; i++, ptep++, addr += PAGE_SIZE)
pte_num = sz >> hugepage_shift;
for (i = 0; i < pte_num; i++, ptep++, addr += (1 << hugepage_shift))
set_pte_at(mm, addr, ptep, pte);
}

Expand Down
41 changes: 39 additions & 2 deletions include/linux/hugetlb.h
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ struct resv_map {
long adds_in_progress;
struct list_head region_cache;
long region_cache_count;
struct rw_semaphore rw_sema;
#ifdef CONFIG_CGROUP_HUGETLB
/*
* On private mappings, the counter to uncharge reservations is stored
Expand Down Expand Up @@ -138,7 +139,7 @@ struct page *hugetlb_follow_page_mask(struct vm_area_struct *vma,
void unmap_hugepage_range(struct vm_area_struct *,
unsigned long, unsigned long, struct page *,
zap_flags_t);
void __unmap_hugepage_range_final(struct mmu_gather *tlb,
void __unmap_hugepage_range(struct mmu_gather *tlb,
struct vm_area_struct *vma,
unsigned long start, unsigned long end,
struct page *ref_page, zap_flags_t zap_flags);
Expand Down Expand Up @@ -245,6 +246,25 @@ int huge_pmd_unshare(struct mm_struct *mm, struct vm_area_struct *vma,
void adjust_range_if_pmd_sharing_possible(struct vm_area_struct *vma,
unsigned long *start, unsigned long *end);

extern void __hugetlb_zap_begin(struct vm_area_struct *vma,
unsigned long *begin, unsigned long *end);
extern void __hugetlb_zap_end(struct vm_area_struct *vma,
struct zap_details *details);

static inline void hugetlb_zap_begin(struct vm_area_struct *vma,
unsigned long *start, unsigned long *end)
{
if (is_vm_hugetlb_page(vma))
__hugetlb_zap_begin(vma, start, end);
}

static inline void hugetlb_zap_end(struct vm_area_struct *vma,
struct zap_details *details)
{
if (is_vm_hugetlb_page(vma))
__hugetlb_zap_end(vma, details);
}

void hugetlb_vma_lock_read(struct vm_area_struct *vma);
void hugetlb_vma_unlock_read(struct vm_area_struct *vma);
void hugetlb_vma_lock_write(struct vm_area_struct *vma);
Expand Down Expand Up @@ -296,6 +316,18 @@ static inline void adjust_range_if_pmd_sharing_possible(
{
}

static inline void hugetlb_zap_begin(
struct vm_area_struct *vma,
unsigned long *start, unsigned long *end)
{
}

static inline void hugetlb_zap_end(
struct vm_area_struct *vma,
struct zap_details *details)
{
}

static inline struct page *hugetlb_follow_page_mask(
struct vm_area_struct *vma, unsigned long address, unsigned int flags,
unsigned int *page_mask)
Expand Down Expand Up @@ -441,7 +473,7 @@ static inline long hugetlb_change_protection(
return 0;
}

static inline void __unmap_hugepage_range_final(struct mmu_gather *tlb,
static inline void __unmap_hugepage_range(struct mmu_gather *tlb,
struct vm_area_struct *vma, unsigned long start,
unsigned long end, struct page *ref_page,
zap_flags_t zap_flags)
Expand Down Expand Up @@ -1245,6 +1277,11 @@ static inline bool __vma_shareable_lock(struct vm_area_struct *vma)
return (vma->vm_flags & VM_MAYSHARE) && vma->vm_private_data;
}

static inline bool __vma_private_lock(struct vm_area_struct *vma)
{
return (!(vma->vm_flags & VM_MAYSHARE)) && vma->vm_private_data;
}

/*
* Safe version of huge_pte_offset() to check the locks. See comments
* above huge_pte_offset().
Expand Down
6 changes: 3 additions & 3 deletions include/linux/kasan.h
Original file line number Diff line number Diff line change
Expand Up @@ -466,10 +466,10 @@ static inline void kasan_free_module_shadow(const struct vm_struct *vm) {}

#endif /* (CONFIG_KASAN_GENERIC || CONFIG_KASAN_SW_TAGS) && !CONFIG_KASAN_VMALLOC */

#ifdef CONFIG_KASAN_INLINE
#if defined(CONFIG_KASAN_GENERIC) || defined(CONFIG_KASAN_SW_TAGS)
void kasan_non_canonical_hook(unsigned long addr);
#else /* CONFIG_KASAN_INLINE */
#else /* CONFIG_KASAN_GENERIC || CONFIG_KASAN_SW_TAGS */
static inline void kasan_non_canonical_hook(unsigned long addr) { }
#endif /* CONFIG_KASAN_INLINE */
#endif /* CONFIG_KASAN_GENERIC || CONFIG_KASAN_SW_TAGS */

#endif /* LINUX_KASAN_H */
2 changes: 1 addition & 1 deletion lib/maple_tree.c
Original file line number Diff line number Diff line change
Expand Up @@ -5627,7 +5627,7 @@ int mas_expected_entries(struct ma_state *mas, unsigned long nr_entries)
/* Internal nodes */
nr_nodes += DIV_ROUND_UP(nr_nodes, nonleaf_cap);
/* Add working room for split (2 nodes) + new parents */
mas_node_count(mas, nr_nodes + 3);
mas_node_count_gfp(mas, nr_nodes + 3, GFP_KERNEL);

/* Detect if allocations run out */
mas->mas_flags |= MA_STATE_PREALLOC;
Expand Down
35 changes: 24 additions & 11 deletions lib/test_maple_tree.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@

#include <linux/maple_tree.h>
#include <linux/module.h>
#include <linux/rwsem.h>

#define MTREE_ALLOC_MAX 0x2000000000000Ul
#define CONFIG_MAPLE_SEARCH
Expand Down Expand Up @@ -1841,17 +1842,21 @@ static noinline void __init check_forking(struct maple_tree *mt)
void *val;
MA_STATE(mas, mt, 0, 0);
MA_STATE(newmas, mt, 0, 0);
struct rw_semaphore newmt_lock;

init_rwsem(&newmt_lock);

for (i = 0; i <= nr_entries; i++)
mtree_store_range(mt, i*10, i*10 + 5,
xa_mk_value(i), GFP_KERNEL);

mt_set_non_kernel(99999);
mt_init_flags(&newmt, MT_FLAGS_ALLOC_RANGE);
mt_init_flags(&newmt, MT_FLAGS_ALLOC_RANGE | MT_FLAGS_LOCK_EXTERN);
mt_set_external_lock(&newmt, &newmt_lock);
newmas.tree = &newmt;
mas_reset(&newmas);
mas_reset(&mas);
mas_lock(&newmas);
down_write(&newmt_lock);
mas.index = 0;
mas.last = 0;
if (mas_expected_entries(&newmas, nr_entries)) {
Expand All @@ -1866,10 +1871,10 @@ static noinline void __init check_forking(struct maple_tree *mt)
}
rcu_read_unlock();
mas_destroy(&newmas);
mas_unlock(&newmas);
mt_validate(&newmt);
mt_set_non_kernel(0);
mtree_destroy(&newmt);
__mt_destroy(&newmt);
up_write(&newmt_lock);
}

static noinline void __init check_iteration(struct maple_tree *mt)
Expand Down Expand Up @@ -1980,6 +1985,10 @@ static noinline void __init bench_forking(struct maple_tree *mt)
void *val;
MA_STATE(mas, mt, 0, 0);
MA_STATE(newmas, mt, 0, 0);
struct rw_semaphore newmt_lock;

init_rwsem(&newmt_lock);
mt_set_external_lock(&newmt, &newmt_lock);

for (i = 0; i <= nr_entries; i++)
mtree_store_range(mt, i*10, i*10 + 5,
Expand All @@ -1994,7 +2003,7 @@ static noinline void __init bench_forking(struct maple_tree *mt)
mas.index = 0;
mas.last = 0;
rcu_read_lock();
mas_lock(&newmas);
down_write(&newmt_lock);
if (mas_expected_entries(&newmas, nr_entries)) {
printk("OOM!");
BUG_ON(1);
Expand All @@ -2005,11 +2014,11 @@ static noinline void __init bench_forking(struct maple_tree *mt)
mas_store(&newmas, val);
}
mas_destroy(&newmas);
mas_unlock(&newmas);
rcu_read_unlock();
mt_validate(&newmt);
mt_set_non_kernel(0);
mtree_destroy(&newmt);
__mt_destroy(&newmt);
up_write(&newmt_lock);
}
}
#endif
Expand Down Expand Up @@ -2616,6 +2625,10 @@ static noinline void __init check_dup_gaps(struct maple_tree *mt,
void *tmp;
MA_STATE(mas, mt, 0, 0);
MA_STATE(newmas, &newmt, 0, 0);
struct rw_semaphore newmt_lock;

init_rwsem(&newmt_lock);
mt_set_external_lock(&newmt, &newmt_lock);

if (!zero_start)
i = 1;
Expand All @@ -2625,9 +2638,9 @@ static noinline void __init check_dup_gaps(struct maple_tree *mt,
mtree_store_range(mt, i*10, (i+1)*10 - gap,
xa_mk_value(i), GFP_KERNEL);

mt_init_flags(&newmt, MT_FLAGS_ALLOC_RANGE);
mt_init_flags(&newmt, MT_FLAGS_ALLOC_RANGE | MT_FLAGS_LOCK_EXTERN);
mt_set_non_kernel(99999);
mas_lock(&newmas);
down_write(&newmt_lock);
ret = mas_expected_entries(&newmas, nr_entries);
mt_set_non_kernel(0);
MT_BUG_ON(mt, ret != 0);
Expand All @@ -2640,9 +2653,9 @@ static noinline void __init check_dup_gaps(struct maple_tree *mt,
}
rcu_read_unlock();
mas_destroy(&newmas);
mas_unlock(&newmas);

mtree_destroy(&newmt);
__mt_destroy(&newmt);
up_write(&newmt_lock);
}

/* Duplicate many sizes of trees. Mainly to test expected entry values */
Expand Down
7 changes: 5 additions & 2 deletions mm/damon/sysfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -1208,6 +1208,8 @@ static int damon_sysfs_set_targets(struct damon_ctx *ctx,
return 0;
}

static bool damon_sysfs_schemes_regions_updating;

static void damon_sysfs_before_terminate(struct damon_ctx *ctx)
{
struct damon_target *t, *next;
Expand All @@ -1219,8 +1221,10 @@ static void damon_sysfs_before_terminate(struct damon_ctx *ctx)
cmd = damon_sysfs_cmd_request.cmd;
if (kdamond && ctx == kdamond->damon_ctx &&
(cmd == DAMON_SYSFS_CMD_UPDATE_SCHEMES_TRIED_REGIONS ||
cmd == DAMON_SYSFS_CMD_UPDATE_SCHEMES_TRIED_BYTES)) {
cmd == DAMON_SYSFS_CMD_UPDATE_SCHEMES_TRIED_BYTES) &&
damon_sysfs_schemes_regions_updating) {
damon_sysfs_schemes_update_regions_stop(ctx);
damon_sysfs_schemes_regions_updating = false;
mutex_unlock(&damon_sysfs_lock);
}

Expand Down Expand Up @@ -1340,7 +1344,6 @@ static int damon_sysfs_commit_input(struct damon_sysfs_kdamond *kdamond)
static int damon_sysfs_cmd_request_callback(struct damon_ctx *c)
{
struct damon_sysfs_kdamond *kdamond;
static bool damon_sysfs_schemes_regions_updating;
bool total_bytes_only = false;
int err = 0;

Expand Down
Loading

0 comments on commit 5ef8f1b

Please sign in to comment.