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

Commit ead04c98 authored by Laurent Dufour's avatar Laurent Dufour Committed by Gerrit - the friendly Code Review server
Browse files

mm: introduce INIT_VMA()



Some VMA struct fields need to be initialized once the VMA structure is
allocated.
Currently this only concerns anon_vma_chain field but some other will be
added to support the speculative page fault.

Instead of spreading the initialization calls all over the code, let's
introduce a dedicated inline function.

Change-Id: I9f6b29dc74055354318b548e2b6b22c37d4c61bb
Signed-off-by: default avatarLaurent Dufour <ldufour@linux.vnet.ibm.com>
Patch-mainline: linux-mm @ Tue, 17 Apr 2018 16:33:13
[vinmenon@codeaurora.org: trivial merge conflict fixes]
Signed-off-by: default avatarVinayak Menon <vinmenon@codeaurora.org>
[charante@codeaurora.org: merge conflict fixes]
Signed-off-by: default avatarCharan Teja Reddy <charante@codeaurora.org>
parent 976415c6
Loading
Loading
Loading
Loading
+6 −1
Original line number Diff line number Diff line
@@ -453,6 +453,11 @@ struct vm_operations_struct {
					  unsigned long addr);
};

static inline void INIT_VMA(struct vm_area_struct *vma)
{
	INIT_LIST_HEAD(&vma->anon_vma_chain);
}

static inline void vma_init(struct vm_area_struct *vma, struct mm_struct *mm)
{
	static const struct vm_operations_struct dummy_vm_ops = {};
@@ -460,7 +465,7 @@ static inline void vma_init(struct vm_area_struct *vma, struct mm_struct *mm)
	memset(vma, 0, sizeof(*vma));
	vma->vm_mm = mm;
	vma->vm_ops = &dummy_vm_ops;
	INIT_LIST_HEAD(&vma->anon_vma_chain);
	INIT_VMA(vma);
}

static inline void vma_set_anonymous(struct vm_area_struct *vma)
+1 −1
Original line number Diff line number Diff line
@@ -325,7 +325,7 @@ struct vm_area_struct *vm_area_dup(struct vm_area_struct *orig)

	if (new) {
		*new = *orig;
		INIT_LIST_HEAD(&new->anon_vma_chain);
		INIT_VMA(new);
	}
	return new;
}