--- /dev/null
+/* SPDX-License-Identifier: GPL-2.0 */
+#undef TRACE_SYSTEM
+#define TRACE_SYSTEM mm
+
+#if !defined(_TRACE_MM_H) || defined(TRACE_HEADER_MULTI_READ)
+#define _TRACE_MM_H
+
+
+#include <linux/tracepoint.h>
+
+struct mm_struct;
+struct vm_area_struct;
+
+TRACE_EVENT(__vma_mt_erase,
+ TP_PROTO(struct mm_struct *mm, struct vm_area_struct *vma),
+
+ TP_ARGS(mm, vma),
+
+ TP_STRUCT__entry(
+ __field( struct mm_struct, mm)
+ __field( struct vma_area_struct vma)
+ ),
+
+ TP_fast_assign(
+ __entry->mm = mm;
+ __entry->vma = vma;
+ __entry->vm_start = vma->vm_start;
+ __entry->vm_end = vma->vm_end;
+ ),
+
+ TP_printk("mt_mod %p, (%p), ERASE, %lu, %lu\n",
+ __entry->mm, __entry->vma,
+ (unsigned long) __entry->vm_start,
+ (unsigned long) __entry->vm_end - 1
+ )
+);
+
+TRACE_EVENT(__vma_mt_szero,
+ TP_PROTO(struct mm_struct *mm, struct vm_area_struct *vma),
+
+ TP_ARGS(mm, vma),
+
+ TP_STRUCT__entry(
+ __field( struct mm_struct, mm)
+ __field( struct vma_area_struct vma)
+ ),
+
+ TP_fast_assign(
+ __entry->mm = mm;
+ __entry->vma = vma;
+ __entry->vm_start = vma->vm_start;
+ __entry->vm_end = vma->vm_end;
+ ),
+
+ TP_printk("mt_mod %p, (%p), SNULL, %lu, %lu\n",
+ __entry->mm, __entry->vma,
+ (unsigned long) __entry->vm_start,
+ (unsigned long) __entry->vm_end
+ )
+);
+
+TRACE_EVENT(__vma_mt_store,
+ TP_PROTO(struct mm_struct *mm, struct vm_area_struct *vma),
+
+ TP_ARGS(mm, vma),
+
+ TP_STRUCT__entry(
+ __field( struct mm_struct, mm)
+ __field( struct vma_area_struct vma)
+ ),
+
+ TP_fast_assign(
+ __entry->mm = mm;
+ __entry->vma = vma;
+ __entry->vm_start = vma->vm_start;
+ __entry->vm_end = vma->vm_end;
+ ),
+
+ TP_printk("mt_mod %p, (%p), STORE, %lu, %lu\n",
+ __entry->mm, __entry->vma,
+ (unsigned long) __entry->vm_start,
+ (unsigned long) __entry->vm_end - 1
+ )
+);
+
+
+TRACE_EVENT(exit_mmap,
+ TP_PROTO(struct mm_struct *mm),
+
+ TP_ARGS(mm),
+
+ TP_STRUCT__entry(
+ __field( struct mm_struct, mm)
+ ),
+
+ TP_fast_assign(
+ __entry->mm = mm;
+ ),
+
+ TP_printk("mt_mod %p, DESTROY\n",
+ __entry->mm
+ )
+);
+
+#endif /* _TRACE_MM_H */
+
+/* This part must be outside protection */
+#include <trace/define_trace.h>
#include <trace/events/mmap.h>
#include "internal.h"
+#include <trace/events/mm.h>
#define CONFIG_DEBUG_MAPLE_TREE
#define CONFIG_DEBUG_VM_RB 1
extern void mt_validate(struct maple_tree *mt);
{
struct maple_tree *mt = &mm->mm_mt;
struct vm_area_struct *vma_mt, *vma = mm->mmap;
- unsigned long count = 0;
MA_STATE(mas, mt, 0, 0);
rcu_read_lock();
flush_dcache_mmap_unlock(mapping);
}
}
-#define MT_DEBUG 0
static void __vma_mt_erase(struct mm_struct *mm, struct vm_area_struct *vma)
{
-#if MT_DEBUG
- printk("%s: mt_mod %px (%px): ERASE, %lu, %lu,\n", __func__, mm, vma,
- vma->vm_start, vma->vm_end - 1);
-#endif
mtree_erase(&mm->mm_mt, vma->vm_start);
mt_validate(&mm->mm_mt);
}
static void __vma_mt_szero(struct mm_struct *mm, unsigned long start,
unsigned long end)
{
-#if MT_DEBUG
- printk("%s: mt_mod %px (%px): SNULL, %lu, %lu,\n", __func__, mm, NULL,
- start, end - 1);
-#endif
mtree_store_range(&mm->mm_mt, start, end - 1, NULL, GFP_KERNEL);
}
static void __vma_mt_store(struct mm_struct *mm, struct vm_area_struct *vma)
{
-#if MT_DEBUG
- printk("%s: mt_mod %px (%px): STORE, %lu, %lu,\n", __func__, mm, vma,
- vma->vm_start, vma->vm_end - 1);
-#endif
mtree_store_range(&mm->mm_mt, vma->vm_start, vma->vm_end - 1, vma,
GFP_KERNEL);
mt_validate(&mm->mm_mt);
static unsigned long unmapped_area_topdown(struct vm_unmapped_area_info *info)
{
struct mm_struct *mm = current->mm;
- struct vm_area_struct *vma;
+ struct vm_area_struct *vma = NULL;
unsigned long length, low_limit, high_limit, gap_start, gap_end;
unsigned long gap;
MA_STATE(mas, &mm->mm_mt, 0, 0);
vma = remove_vma(vma);
cond_resched();
}
-#if MT_DEBUG
- printk("mt_mod: %px DESTROY\n", mm);
-#endif
mtree_destroy(&mm->mm_mt);
vm_unacct_memory(nr_accounted);
}