Skip to Content
Mastering Linux Kernel Development
book

Mastering Linux Kernel Development

by CH Raghav Maruthi
October 2017
Intermediate to advanced
354 pages
9h 28m
English
Packt Publishing
Content preview from Mastering Linux Kernel Development

Locating a VMA

The find_vma() routine locates the first region in the VMA list that satisfies the condition for a given address (addr < vm_area_struct->vm_end).

/* Look up the first VMA which satisfies addr < vm_end, NULL if none. */struct vm_area_struct *find_vma(struct mm_struct *mm, unsigned long addr){        struct rb_node *rb_node;        struct vm_area_struct *vma;        /* Check the cache first. */        vma = vmacache_find(mm, addr);        if (likely(vma))               return vma;           rb_node = mm->mm_rb.rb_node;       while (rb_node) {               struct vm_area_struct *tmp;               tmp = rb_entry(rb_node, struct vm_area_struct, vm_rb);               if (tmp->vm_end > addr) {                        vma = tmp;                        if (tmp->vm_start <= addr)                                 break;                        rb_node = rb_node->rb_left;               } else                        rb_node = rb_node->rb_right;        }        if (vma) vmacache_update(addr, ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Linux Kernel Development, Third Edition

Linux Kernel Development, Third Edition

Robert Love
Understanding the Linux Kernel

Understanding the Linux Kernel

Daniel P. Bovet, Marco Cesati
Linux Kernel Debugging

Linux Kernel Debugging

Kaiwan N. Billimoria

Publisher Resources

ISBN: 9781785883057Other