Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1420677 > unrolled thread
| Started by | "Hillf Danton" <hillf.zj@alibaba-inc.com> |
|---|---|
| First post | 2016-06-13 12:10 +0200 |
| Last post | 2016-06-15 02:50 +0200 |
| Articles | 2 — 2 participants |
Back to article view | Back to linux.kernel
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
Re: [PATCH v1 3/3] mm: per-process reclaim "Hillf Danton" <hillf.zj@alibaba-inc.com> - 2016-06-13 12:10 +0200
Re: [PATCH v1 3/3] mm: per-process reclaim Minchan Kim <minchan@kernel.org> - 2016-06-15 02:50 +0200
| From | "Hillf Danton" <hillf.zj@alibaba-inc.com> |
|---|---|
| Date | 2016-06-13 12:10 +0200 |
| Subject | Re: [PATCH v1 3/3] mm: per-process reclaim |
| Message-ID | <rJwYF-4R0-7@gated-at.bofh.it> |
> +static ssize_t reclaim_write(struct file *file, const char __user *buf,
> + size_t count, loff_t *ppos)
> +{
> + struct task_struct *task;
> + char buffer[PROC_NUMBUF];
> + struct mm_struct *mm;
> + struct vm_area_struct *vma;
> + int itype;
> + int rv;
> + enum reclaim_type type;
> +
> + memset(buffer, 0, sizeof(buffer));
> + if (count > sizeof(buffer) - 1)
> + count = sizeof(buffer) - 1;
> + if (copy_from_user(buffer, buf, count))
> + return -EFAULT;
> + rv = kstrtoint(strstrip(buffer), 10, &itype);
> + if (rv < 0)
> + return rv;
> + type = (enum reclaim_type)itype;
> + if (type < RECLAIM_FILE || type > RECLAIM_ALL)
> + return -EINVAL;
> +
> + task = get_proc_task(file->f_path.dentry->d_inode);
> + if (!task)
> + return -ESRCH;
> +
> + mm = get_task_mm(task);
> + if (mm) {
> + struct mm_walk reclaim_walk = {
> + .pmd_entry = reclaim_pte_range,
> + .mm = mm,
> + };
> +
> + down_read(&mm->mmap_sem);
> + for (vma = mm->mmap; vma; vma = vma->vm_next) {
> + reclaim_walk.private = vma;
> +
> + if (is_vm_hugetlb_page(vma))
> + continue;
> +
> + if (!vma_is_anonymous(vma) && !(type & RECLAIM_FILE))
> + continue;
> +
> + if (vma_is_anonymous(vma) && !(type & RECLAIM_ANON))
> + continue;
> +
> + walk_page_range(vma->vm_start, vma->vm_end,
> + &reclaim_walk);
Check fatal signal after reclaiming a mapping?
> + }
> + flush_tlb_mm(mm);
> + up_read(&mm->mmap_sem);
> + mmput(mm);
> + }
> + put_task_struct(task);
> +
> + return count;
> +}
[toc] | [next] | [standalone]
| From | Minchan Kim <minchan@kernel.org> |
|---|---|
| Date | 2016-06-15 02:50 +0200 |
| Message-ID | <rK7bP-3Jm-7@gated-at.bofh.it> |
| In reply to | #1420677 |
On Mon, Jun 13, 2016 at 06:07:09PM +0800, Hillf Danton wrote:
> > +static ssize_t reclaim_write(struct file *file, const char __user *buf,
> > + size_t count, loff_t *ppos)
> > +{
> > + struct task_struct *task;
> > + char buffer[PROC_NUMBUF];
> > + struct mm_struct *mm;
> > + struct vm_area_struct *vma;
> > + int itype;
> > + int rv;
> > + enum reclaim_type type;
> > +
> > + memset(buffer, 0, sizeof(buffer));
> > + if (count > sizeof(buffer) - 1)
> > + count = sizeof(buffer) - 1;
> > + if (copy_from_user(buffer, buf, count))
> > + return -EFAULT;
> > + rv = kstrtoint(strstrip(buffer), 10, &itype);
> > + if (rv < 0)
> > + return rv;
> > + type = (enum reclaim_type)itype;
> > + if (type < RECLAIM_FILE || type > RECLAIM_ALL)
> > + return -EINVAL;
> > +
> > + task = get_proc_task(file->f_path.dentry->d_inode);
> > + if (!task)
> > + return -ESRCH;
> > +
> > + mm = get_task_mm(task);
> > + if (mm) {
> > + struct mm_walk reclaim_walk = {
> > + .pmd_entry = reclaim_pte_range,
> > + .mm = mm,
> > + };
> > +
> > + down_read(&mm->mmap_sem);
> > + for (vma = mm->mmap; vma; vma = vma->vm_next) {
> > + reclaim_walk.private = vma;
> > +
> > + if (is_vm_hugetlb_page(vma))
> > + continue;
> > +
> > + if (!vma_is_anonymous(vma) && !(type & RECLAIM_FILE))
> > + continue;
> > +
> > + if (vma_is_anonymous(vma) && !(type & RECLAIM_ANON))
> > + continue;
> > +
> > + walk_page_range(vma->vm_start, vma->vm_end,
> > + &reclaim_walk);
>
> Check fatal signal after reclaiming a mapping?
Yeb, We might need it in page_walker.
Thanks.
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web