Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 16849674 authored by Linux Build Service Account's avatar Linux Build Service Account Committed by Gerrit - the friendly Code Review server
Browse files

Merge "mm, oom_reaper: gather each vma to prevent leaking TLB entry"

parents abb83ced 37f5d92a
Loading
Loading
Loading
Loading
+0 −2
Original line number Diff line number Diff line
@@ -1164,8 +1164,6 @@ struct zap_details {
	struct address_space *check_mapping;	/* Check page->mapping if set */
	pgoff_t	first_index;			/* Lowest page->index to unmap */
	pgoff_t last_index;			/* Highest page->index to unmap */
	bool ignore_dirty;			/* Ignore dirty pages */
	bool check_swap_entries;		/* Check also swap entries */
};

struct page *vm_normal_page(struct vm_area_struct *vma, unsigned long addr,
+79 −0
Original line number Diff line number Diff line
@@ -27,6 +27,85 @@ TRACE_EVENT(oom_score_adj_update,
		__entry->pid, __entry->comm, __entry->oom_score_adj)
);

TRACE_EVENT(mark_victim,
	TP_PROTO(int pid),

	TP_ARGS(pid),

	TP_STRUCT__entry(
		__field(int, pid)
	),

	TP_fast_assign(
		__entry->pid = pid;
	),

	TP_printk("pid=%d", __entry->pid)
);

TRACE_EVENT(wake_reaper,
	TP_PROTO(int pid),

	TP_ARGS(pid),

	TP_STRUCT__entry(
		__field(int, pid)
	),

	TP_fast_assign(
		__entry->pid = pid;
	),

	TP_printk("pid=%d", __entry->pid)
);

TRACE_EVENT(start_task_reaping,
	TP_PROTO(int pid),

	TP_ARGS(pid),

	TP_STRUCT__entry(
		__field(int, pid)
	),

	TP_fast_assign(
		__entry->pid = pid;
	),

	TP_printk("pid=%d", __entry->pid)
);

TRACE_EVENT(finish_task_reaping,
	TP_PROTO(int pid),

	TP_ARGS(pid),

	TP_STRUCT__entry(
		__field(int, pid)
	),

	TP_fast_assign(
		__entry->pid = pid;
	),

	TP_printk("pid=%d", __entry->pid)
);

TRACE_EVENT(skip_task_reaping,
	TP_PROTO(int pid),

	TP_ARGS(pid),

	TP_STRUCT__entry(
		__field(int, pid)
	),

	TP_fast_assign(
		__entry->pid = pid;
	),

	TP_printk("pid=%d", __entry->pid)
);
#endif

/* This part must be outside protection */
+0 −1
Original line number Diff line number Diff line
@@ -879,7 +879,6 @@ static inline void __mmput(struct mm_struct *mm)
	}
	if (mm->binfmt)
		module_put(mm->binfmt->module);
	set_bit(MMF_OOM_SKIP, &mm->flags);
	mmdrop(mm);
}

+5 −0
Original line number Diff line number Diff line
@@ -41,6 +41,11 @@ int do_swap_page(struct fault_env *fe, pte_t orig_pte);
void free_pgtables(struct mmu_gather *tlb, struct vm_area_struct *start_vma,
		unsigned long floor, unsigned long ceiling);

static inline bool can_madv_dontneed_vma(struct vm_area_struct *vma)
{
	return !(vma->vm_flags & (VM_LOCKED|VM_HUGETLB|VM_PFNMAP));
}

void unmap_page_range(struct mmu_gather *tlb,
			     struct vm_area_struct *vma,
			     unsigned long addr, unsigned long end,
+3 −1
Original line number Diff line number Diff line
@@ -25,6 +25,8 @@

#include <asm/tlb.h>

#include "internal.h"

/*
 * Any behaviour which results in changes to the vma->vm_flags needs to
 * take mmap_sem for writing. Others, which simply traverse vmas, need
@@ -474,7 +476,7 @@ static long madvise_dontneed(struct vm_area_struct *vma,
			     unsigned long start, unsigned long end)
{
	*prev = vma;
	if (vma->vm_flags & (VM_LOCKED|VM_HUGETLB|VM_PFNMAP))
	if (!can_madv_dontneed_vma(vma))
		return -EINVAL;

	zap_page_range(vma, start, end - start, NULL);
Loading