*参照元 [#e6c0500c]
#backlinks

*説明 [#x6be4081]
-パス: [[linux-2.6.33/mm/mlock.c]]

-FIXME: これは何?
--説明


**引数 [#z2dcd0bc]
-struct vm_area_struct *vma
--
--[[linux-2.6.33/vm_area_struct]]
-struct vm_area_struct **prev
--
-unsigned long start
--
-unsigned long end
--
-unsigned int newflags
--


**返り値 [#wce0a0f4]
-int
--


**参考 [#qd0ec07f]


*実装 [#ib5d70e3]
 /*
  * mlock_fixup  - handle mlock[all]/munlock[all] requests.
  *
  * Filters out "special" vmas -- VM_LOCKED never gets set for these, and
  * munlock is a no-op.  However, for some special vmas, we go ahead and
  * populate the ptes via make_pages_present().
  *
  * For vmas that pass the filters, merge/split as appropriate.
  */
 static int mlock_fixup(struct vm_area_struct *vma, struct vm_area_struct **prev,
 	unsigned long start, unsigned long end, unsigned int newflags)
 {
 	struct mm_struct *mm = vma->vm_mm;
 	pgoff_t pgoff;
 	int nr_pages;
 	int ret = 0;
 	int lock = newflags & VM_LOCKED;
 
-
--[[linux-2.6.33/mm_struct]]
-
--[[linux-2.6.33/pgoff_t]]
-
--[[linux-2.6.33/VM_LOCKED]]

 	if (newflags == vma->vm_flags ||
 			(vma->vm_flags & (VM_IO | VM_PFNMAP)))
 		goto out;	/* don't set VM_LOCKED,  don't count */
 
-
--[[linux-2.6.33/VM_IO]]
-
--[[linux-2.6.33/VM_PFNMAP]]

 	if ((vma->vm_flags & (VM_DONTEXPAND | VM_RESERVED)) ||
 			is_vm_hugetlb_page(vma) ||
 			vma == get_gate_vma(current)) {
 		if (lock)
 			make_pages_present(start, end);
 		goto out;	/* don't set VM_LOCKED,  don't count */
 	}
 
-
--[[linux-2.6.33/VM_DONTEXPAND]]
-
--[[linux-2.6.33/VM_RESERVED]]
-
--[[linux-2.6.33/is_vm_hugetlb_page()]]
-
--[[linux-2.6.33/get_gate_vma()]]
-
--[[linux-2.6.33/current(global)]]
-
--[[linux-2.6.33/make_pages_present()]]

 	pgoff = vma->vm_pgoff + ((start - vma->vm_start) >> PAGE_SHIFT);
 	*prev = vma_merge(mm, *prev, start, end, newflags, vma->anon_vma,
 			  vma->vm_file, pgoff, vma_policy(vma));
 	if (*prev) {
 		vma = *prev;
 		goto success;
 	}
 
-
--[[linux-2.6.33/PAGE_SHIFT]]
-
--[[linux-2.6.33/vma_merge()]]
-
--[[linux-2.6.33/vma_policy()]]

 	if (start != vma->vm_start) {
 		ret = split_vma(mm, vma, start, 1);
 		if (ret)
 			goto out;
 	}
 
-
--[[linux-2.6.33/split_vma()]]

 	if (end != vma->vm_end) {
 		ret = split_vma(mm, vma, end, 0);
 		if (ret)
 			goto out;
 	}
 
 success:
 	/*
 	 * Keep track of amount of locked VM.
 	 */
 	nr_pages = (end - start) >> PAGE_SHIFT;
 	if (!lock)
 		nr_pages = -nr_pages;
 	mm->locked_vm += nr_pages;
 
 	/*
 	 * vm_flags is protected by the mmap_sem held in write mode.
 	 * It's okay if try_to_unmap_one unmaps a page just after we
 	 * set VM_LOCKED, __mlock_vma_pages_range will bring it back.
 	 */
 
 	if (lock) {
 		vma->vm_flags = newflags;
 		ret = __mlock_vma_pages_range(vma, start, end);
 		if (ret < 0)
 			ret = __mlock_posix_error_return(ret);
 	} else {
 		munlock_vma_pages_range(vma, start, end);
 	}
 
-
--[[linux-2.6.33/__mlock_vma_pages_range()]]
-
--[[linux-2.6.33/__mlock_posix_error_return()]]
-
--[[linux-2.6.33/munlock_vma_pages_range()]]

 out:
 	*prev = vma;
 	return ret;
 }


*コメント [#gfc516fa]


トップ   編集 差分 履歴 添付 複製 名前変更 リロード   新規 一覧 検索 最終更新   ヘルプ   最終更新のRSS