From: Minchan Kim <minchan@kernel.org>
To: Hillf Danton <hillf.zj@alibaba-inc.com>
Cc: linux-kernel <linux-kernel@vger.kernel.org>, linux-mm@kvack.org
Subject: Re: [PATCH v1 3/3] mm: per-process reclaim
Date: Wed, 15 Jun 2016 09:46:33 +0900 [thread overview]
Message-ID: <20160615004633.GC17127@bbox> (raw)
In-Reply-To: <040601d1c55b$5934e6b0$0b9eb410$@alibaba-inc.com>
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.
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
WARNING: multiple messages have this Message-ID (diff)
From: Minchan Kim <minchan@kernel.org>
To: Hillf Danton <hillf.zj@alibaba-inc.com>
Cc: linux-kernel <linux-kernel@vger.kernel.org>, <linux-mm@kvack.org>
Subject: Re: [PATCH v1 3/3] mm: per-process reclaim
Date: Wed, 15 Jun 2016 09:46:33 +0900 [thread overview]
Message-ID: <20160615004633.GC17127@bbox> (raw)
In-Reply-To: <040601d1c55b$5934e6b0$0b9eb410$@alibaba-inc.com>
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.
next prev parent reply other threads:[~2016-06-15 0:46 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <040501d1c55a$81d51910$857f4b30$@alibaba-inc.com>
2016-06-13 10:07 ` [PATCH v1 3/3] mm: per-process reclaim Hillf Danton
2016-06-13 10:07 ` Hillf Danton
2016-06-15 0:46 ` Minchan Kim [this message]
2016-06-15 0:46 ` Minchan Kim
2016-06-13 7:50 [PATCH v1 0/3] " Minchan Kim
2016-06-13 7:50 ` [PATCH v1 3/3] mm: " Minchan Kim
2016-06-13 7:50 ` Minchan Kim
2016-06-13 15:06 ` Johannes Weiner
2016-06-13 15:06 ` Johannes Weiner
2016-06-15 0:40 ` Minchan Kim
2016-06-15 0:40 ` Minchan Kim
2016-06-16 11:07 ` Michal Hocko
2016-06-16 11:07 ` Michal Hocko
2016-06-16 14:41 ` Johannes Weiner
2016-06-16 14:41 ` Johannes Weiner
2016-06-17 6:43 ` Minchan Kim
2016-06-17 6:43 ` Minchan Kim
2016-06-17 7:24 ` Balbir Singh
2016-06-17 7:24 ` Balbir Singh
2016-06-17 7:57 ` Vinayak Menon
2016-06-17 7:57 ` Vinayak Menon
2016-06-13 17:06 ` Rik van Riel
2016-06-15 1:01 ` Minchan Kim
2016-06-15 1:01 ` Minchan Kim
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20160615004633.GC17127@bbox \
--to=minchan@kernel.org \
--cc=hillf.zj@alibaba-inc.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.