clear_refs: introduce private struct for mm_walk
In the next patch the clear-refs-type will be required in clear_refs_pte_range funciton, so prepare the walk->private to carry this info. Signed-off-by: Pavel Emelyanov <xemul@parallels.com> Cc: Matt Mackall <mpm@selenic.com> Cc: Xiao Guangrong <xiaoguangrong@linux.vnet.ibm.com> Cc: Glauber Costa <glommer@parallels.com> Cc: Marcelo Tosatti <mtosatti@redhat.com> Cc: KOSAKI Motohiro <kosaki.motohiro@gmail.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This commit is contained in:
committed by
Linus Torvalds
parent
040fa02077
commit
af9de7eb18
@@ -695,10 +695,15 @@ enum clear_refs_types {
|
|||||||
CLEAR_REFS_LAST,
|
CLEAR_REFS_LAST,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
struct clear_refs_private {
|
||||||
|
struct vm_area_struct *vma;
|
||||||
|
};
|
||||||
|
|
||||||
static int clear_refs_pte_range(pmd_t *pmd, unsigned long addr,
|
static int clear_refs_pte_range(pmd_t *pmd, unsigned long addr,
|
||||||
unsigned long end, struct mm_walk *walk)
|
unsigned long end, struct mm_walk *walk)
|
||||||
{
|
{
|
||||||
struct vm_area_struct *vma = walk->private;
|
struct clear_refs_private *cp = walk->private;
|
||||||
|
struct vm_area_struct *vma = cp->vma;
|
||||||
pte_t *pte, ptent;
|
pte_t *pte, ptent;
|
||||||
spinlock_t *ptl;
|
spinlock_t *ptl;
|
||||||
struct page *page;
|
struct page *page;
|
||||||
@@ -753,13 +758,16 @@ static ssize_t clear_refs_write(struct file *file, const char __user *buf,
|
|||||||
return -ESRCH;
|
return -ESRCH;
|
||||||
mm = get_task_mm(task);
|
mm = get_task_mm(task);
|
||||||
if (mm) {
|
if (mm) {
|
||||||
|
struct clear_refs_private cp = {
|
||||||
|
};
|
||||||
struct mm_walk clear_refs_walk = {
|
struct mm_walk clear_refs_walk = {
|
||||||
.pmd_entry = clear_refs_pte_range,
|
.pmd_entry = clear_refs_pte_range,
|
||||||
.mm = mm,
|
.mm = mm,
|
||||||
|
.private = &cp,
|
||||||
};
|
};
|
||||||
down_read(&mm->mmap_sem);
|
down_read(&mm->mmap_sem);
|
||||||
for (vma = mm->mmap; vma; vma = vma->vm_next) {
|
for (vma = mm->mmap; vma; vma = vma->vm_next) {
|
||||||
clear_refs_walk.private = vma;
|
cp.vma = vma;
|
||||||
if (is_vm_hugetlb_page(vma))
|
if (is_vm_hugetlb_page(vma))
|
||||||
continue;
|
continue;
|
||||||
/*
|
/*
|
||||||
|
Reference in New Issue
Block a user