linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Minchan Kim <minchan@kernel.org>
To: Namhyung Kim <namhyung@kernel.org>
Cc: Andrew Morton <akpm@linux-foundation.org>,
	linux-mm@kvack.org, linux-kernel@vger.kernel.org,
	Michael Kerrisk <mtk.manpages@gmail.com>,
	Rik van Riel <riel@redhat.com>,
	Dave Hansen <dave.hansen@intel.com>
Subject: Re: [PATCH v2 5/6] mm: Support address range reclaim
Date: Thu, 25 Apr 2013 09:50:50 +0900	[thread overview]
Message-ID: <20130425005050.GD2978@blaptop> (raw)
In-Reply-To: <87wqrs9opv.fsf@sejong.aot.lge.com>

Hey Namhyung,

On Wed, Apr 24, 2013 at 08:01:48PM +0900, Namhyung Kim wrote:
> Hi Minchan,
> 
> On Wed, 24 Apr 2013 10:41:03 +0900, Minchan Kim wrote:
> > This patch adds address range reclaim of a process.
> > The requirement is following as,
> >
> > Like webkit1, it uses a address space for handling multi tabs.
> > IOW, it uses *one* process model so all tabs shares address space
> > of the process. In such scenario, per-process reclaim is rather
> > coarse-grained so this patch supports more fine-grained reclaim
> > for being able to reclaim target address range of the process.
> > For reclaim target range, you should use following format.
> >
> > 	echo [addr] [size-byte] > /proc/pid/reclaim
> >
> > addr should be page-aligned.
> >
> > So now reclaim konb's interface is following as.
> >
> > echo file > /proc/pid/reclaim
> > 	reclaim file-backed pages only
> >
> > echo anon > /proc/pid/reclaim
> > 	reclaim anonymous pages only
> >
> > echo all > /proc/pid/reclaim
> > 	reclaim all pages
> >
> > echo $((1<<20)) 8192 > /proc/pid/reclaim
> > 	reclaim pages in (0x100000 - 0x102000)
> >
> > Signed-off-by: Minchan Kim <minchan@kernel.org>
> > ---
> >  fs/proc/task_mmu.c | 88 ++++++++++++++++++++++++++++++++++++++++++++----------
> >  mm/internal.h      |  3 ++
> >  2 files changed, 76 insertions(+), 15 deletions(-)
> >
> > diff --git a/fs/proc/task_mmu.c b/fs/proc/task_mmu.c
> > index 79b674e..dff9756 100644
> > --- a/fs/proc/task_mmu.c
> > +++ b/fs/proc/task_mmu.c
> > @@ -12,6 +12,7 @@
> >  #include <linux/swap.h>
> >  #include <linux/swapops.h>
> >  #include <linux/mm_inline.h>
> > +#include <linux/ctype.h>
> >  
> >  #include <asm/elf.h>
> >  #include <asm/uaccess.h>
> > @@ -1239,11 +1240,14 @@ 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];
> > +	char buffer[200];
> >  	struct mm_struct *mm;
> >  	struct vm_area_struct *vma;
> >  	enum reclaim_type type;
> >  	char *type_buf;
> > +	struct mm_walk reclaim_walk = {};
> > +	unsigned long start = 0;
> > +	unsigned long end = 0;
> >  
> >  	memset(buffer, 0, sizeof(buffer));
> >  	if (count > sizeof(buffer) - 1)
> > @@ -1259,42 +1263,96 @@ static ssize_t reclaim_write(struct file *file, const char __user *buf,
> >  		type = RECLAIM_ANON;
> >  	else if (!strcmp(type_buf, "all"))
> >  		type = RECLAIM_ALL;
> > +	else if (isdigit(*type_buf))
> > +		type = RECLAIM_RANGE;
> >  	else
> > -		return -EINVAL;
> > +		goto out_err;
> > +
> > +	if (type == RECLAIM_RANGE) {
> > +		int ret;
> > +		size_t len;
> > +		unsigned long len_in;
> > +		char *token;
> > +
> > +		token = strsep(&type_buf, " ");
> > +		if (!token)
> > +			goto out_err;
> > +		ret = kstrtoul(token, 10, &start);
> 
> Why not using
> 
> 		start = memparse(token, NULL);
> 
> to support something like:
> 
>   # echo 0x100000 8K > /proc/pid/reclaim
> 

Because I'm brain-damage. :(
Thanks for noticing useful function.

> 
> Thanks,
> Namhyung
> 
> --
> 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>

-- 
Kind regards,
Minchan Kim

--
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>

  reply	other threads:[~2013-04-25  0:50 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-04-24  1:40 [PATCH v2 0/6] Per process reclaim Minchan Kim
2013-04-24  1:40 ` [PATCH v2 1/6] mm: " Minchan Kim
2013-04-24  1:41 ` [PATCH v2 2/6] mm: make shrink_page_list with pages work from multiple zones Minchan Kim
2013-04-24  1:41 ` [PATCH v2 3/6] mm: Remove shrink_page Minchan Kim
2013-04-24  1:41 ` [PATCH v2 4/6] mm: Enhance per process reclaim to consider shared pages Minchan Kim
2013-04-24  1:41 ` [PATCH v2 5/6] mm: Support address range reclaim Minchan Kim
2013-04-24 11:01   ` Namhyung Kim
2013-04-25  0:50     ` Minchan Kim [this message]
2013-04-24  1:41 ` [PATCH v2 6/6] add documentation on proc.txt Minchan Kim
2013-04-24  6:49   ` Rob Landley
2013-04-24  8:18     ` 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=20130425005050.GD2978@blaptop \
    --to=minchan@kernel.org \
    --cc=akpm@linux-foundation.org \
    --cc=dave.hansen@intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mtk.manpages@gmail.com \
    --cc=namhyung@kernel.org \
    --cc=riel@redhat.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).