- allocate_mm() - Allocates a new struct mm_struct from the slab allocator.
- free_mm() - Frees a struct mm_struct from the slab allocator.
- copy_mm() - Initialises the specified struct task_struct with a copy of the current task's struct mm_struct.
- vma_is_anonymous() - Determines if the specified VMA is anonymous (i.e. does not map a file.)
void *allocate_mm(void)
allocate_mm() simply allocates a new struct mm_struct from the slab allocator via kmem_cache_alloc().
NOTE: Macro, inferring function signature.
N/A
A pointer to the newly allocated struct mm_struct.
void free_mm(struct mm_struct *mm)
free_mm() frees the specified struct mm_struct from the slab allocator via kmem_cache_free().
NOTE: Macro, inferring function signature.
mm
- A pointer to the struct mm_struct which is to be freed.
N/A
int copy_mm(unsigned long clone_flags, struct task_struct *tsk)
copy_mm() copies the current task's struct mm_struct to the specified struct task_struct, resetting statistics as it does so.
The bulk of the actual duplication is performed by dup_mm() and dup_mmap() which copy the page tables too.
There are some exceptions:
-
If
clone_flags & CLONE_VM
then the current task's struct mm_struct is shared rather than copied. -
If this is a kernel thread, i.e. there is no
current->mm
available, the copy is aborted.
-
clone_flags
- The clone flags associated with the copy, if it's the case thatclone_flags & CLONE_VM
, then the struct mm_struct is not copied and is instead shared. -
tsk
- The task whosemm
field we want to assign a copy of the current task's struct mm_struct to.
0 if successful, error code otherwise.
bool vma_is_anonymous(struct vm_area_struct *vma)
vma_is_anonymous() determines whether the specified VMA (i.e. struct vm_area_struct) is anonymous - an anonymous VMA is one that does not map a file but rather simply represents an area of memory unassociated with any file.
The function simply tests whether the VMA's vm_ops
fields is null - if so, no
operations are specified and so the VMA is anonymous, otherwise it is not.
vma
- The VMA whose anonymity we wish to determine.
true
if the VMA is anonymous, otherwise false
.