LinuxÒÁµéÔ°ÂÛ̳'s Archiver

lc20046080 ·¢±íÓÚ 2007-12-23 00:31

struct vm_area_struct **pprev˫ָÕëµÄ ÎÊÌâ

//linux/mm/mmap.c
/* Insert vm structure into process list sorted by address
* and into the inode's i_mmap ring.  If vm_file is non-NULL
* then the i_shared_lock must be held here.
*/
void __insert_vm_struct(struct mm_struct *mm, struct vm_area_struct *vmp)
{
        struct vm_area_struct **pprev;
        struct file * file;

        if (!mm->mmap_avl) {
                pprev = &mm->mmap;
                while (*pprev && (*pprev)->vm_start <= vmp->vm_start)
                        pprev = &(*pprev)->vm_next;
        } else {
                struct vm_area_struct *prev, *next;
                avl_insert_neighbours(vmp, &mm->mmap_avl, &prev, &next);
                pprev = (prev ? &prev->vm_next : &mm->mmap);
                if (*pprev != next)
                        printk("insert_vm_struct: tree inconsistent with list\n");
        }
        vmp->vm_next = *pprev;
        *pprev = vmp;

        mm->map_count++;
        if (mm->map_count >= AVL_MIN_MAP_COUNT && !mm->mmap_avl)
                build_mmap_avl(mm);

        file = vmp->vm_file;
        if (file) {
                struct inode * inode = file->f_dentry->d_inode;
                struct address_space *mapping = inode->i_mapping;
                struct vm_area_struct **head;

                if (vmp->vm_flags & VM_DENYWRITE)
                        atomic_dec(&inode->i_writecount);

                head = &mapping->i_mmap;
                if (vmp->vm_flags & VM_SHARED)
                        head = &mapping->i_mmap_shared;
      
                /* insert vmp into inode's share list */
                if((vmp->vm_next_share = *head) != NULL)
                        (*head)->vm_pprev_share = &vmp->vm_next_share;
                *head = vmp;
                vmp->vm_pprev_share = head;
        }
}




ÇëÎÊÕâÀï struct vm_area_struct **pprev˫ָÕë ×öʲô Óà £¿²»ÓÃ˫ָÕë ²»ÐÐ Âð

[[i] ±¾Ìû×îºóÓÉ lc20046080 ÓÚ 2007-12-23 00:41 ±à¼­ [/i]]

cuzen ·¢±íÓÚ 2007-12-25 16:52

:Q ÐÂÊÖżҲÏëÖªµÀ´ð°¸¡£°ïÄã¶¥¡£
²»¹ýÓÃÖ¸ÕëµÄÖ¸ÕëͦºÃµÄ¡£Òª²»ÄÇЩ½á¹¹Ö¸ÕëÖеĽṹָÕë±íʾÆðÀ´ÂùÄÑ¿´µÄ¡£¡£¡£:L

Ò³: [1]

Powered by Discuz! Archiver 6.1.0  © 2001-2007 Comsenz Inc.