All of lore.kernel.org
 help / color / mirror / Atom feed
From: Minchan Kim <minchan@kernel.org>
To: Michael Kerrisk <mtk.manpages@gmail.com>
Cc: Andrew Morton <akpm@linux-foundation.org>,
	Linux Kernel <linux-kernel@vger.kernel.org>,
	linux-mm <linux-mm@kvack.org>, Mel Gorman <mgorman@suse.de>,
	Rik van Riel <riel@redhat.com>,
	Johannes Weiner <hannes@cmpxchg.org>,
	Hugh Dickins <hughd@google.com>,
	Sangseok Lee <sangseok.lee@lge.com>
Subject: Re: [RFC 1/4] mm: Per process reclaim
Date: Thu, 4 Apr 2013 08:46:44 +0900	[thread overview]
Message-ID: <20130403234644.GC7675@blaptop> (raw)
In-Reply-To: <CAHO5Pa0srsWS6ukpxUo=EqCOxRmYa7c_7PDg1YPh7gcMGWPpaw@mail.gmail.com>

On Wed, Apr 03, 2013 at 12:10:22PM +0200, Michael Kerrisk wrote:
> Hello Minchan,
> 
> On Mon, Mar 25, 2013 at 7:21 AM, Minchan Kim <minchan@kernel.org> wrote:
> > These day, there are many platforms avaiable in the embedded market
> > and they are smarter than kernel which has very limited information
> > about working set so they want to involve memory management more heavily
> > like android's lowmemory killer and ashmem or recent many lowmemory
> > notifier(there was several trial for various company NOKIA, SAMSUNG,
> > Linaro, Google ChromeOS, Redhat).
> >
> > One of the simple imagine scenario about userspace's intelligence is that
> > platform can manage tasks as forground and backgroud so it would be
> > better to reclaim background's task pages for end-user's *responsibility*
> > although it has frequent referenced pages.
> >
> > This patch adds new knob "reclaim under proc/<pid>/" so task manager
> > can reclaim any target process anytime, anywhere. It could give another
> > method to platform for using memory efficiently.
> >
> > It can avoid process killing for getting free memory, which was really
> > terrible experience because I lost my best score of game I had ever
> > after I switch the phone call while I enjoyed the game.
> >
> > Writing 1 to /proc/pid/reclaim reclaims only file pages.
> > Writing 2 to /proc/pid/reclaim reclaims only anonymous pages.
> > Writing 3 to /proc/pid/reclaim reclaims all pages from target process.
> 
> This interface seems to work as advertized, at least from some light
> testing that I've done.

Thanks for the testing!

> 
> However, the interface is a quite blunt instrument. Would there be any
> virtue in extending it so that an address range could be written to
> /proc/PID/reclaim? Used in conjunction with /proc/PID/maps, a manager
> process might then choose to trigger reclaim of just selected regions
> of a processes address space. Thus, one might reclaim file backed
> pages in a range using:
> 
>     echo '2 start-address end-address' > /proc/PID/reclaim
> 
> What do you think?

It is really nice idea because some platform use a address space with
mulitple object. Simply, multiple application could work in a address space
but they use separate virtual address range in a address space.
In such model, per-process reclaim isn't vaild any more so your idea
would be nice for it.

One nitpick is that I'd like to use (address, size) instead of (start_address
, end_address) because we always confuse that end_address itself is
inclusive or not in the range.

And I am thinking another options like this

RECLAIM_SOFT_[FILE|ANON] 

It reclaims pages which are not workset.

RECLAIM_HARD_[FILE|ANON]

It reclaims pages of range unconditionally although pages are shared by
several processes.

But before that, I'd like to hear other guys's opinion.

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

WARNING: multiple messages have this Message-ID (diff)
From: Minchan Kim <minchan@kernel.org>
To: Michael Kerrisk <mtk.manpages@gmail.com>
Cc: Andrew Morton <akpm@linux-foundation.org>,
	Linux Kernel <linux-kernel@vger.kernel.org>,
	linux-mm <linux-mm@kvack.org>, Mel Gorman <mgorman@suse.de>,
	Rik van Riel <riel@redhat.com>,
	Johannes Weiner <hannes@cmpxchg.org>,
	Hugh Dickins <hughd@google.com>,
	Sangseok Lee <sangseok.lee@lge.com>
Subject: Re: [RFC 1/4] mm: Per process reclaim
Date: Thu, 4 Apr 2013 08:46:44 +0900	[thread overview]
Message-ID: <20130403234644.GC7675@blaptop> (raw)
In-Reply-To: <CAHO5Pa0srsWS6ukpxUo=EqCOxRmYa7c_7PDg1YPh7gcMGWPpaw@mail.gmail.com>

On Wed, Apr 03, 2013 at 12:10:22PM +0200, Michael Kerrisk wrote:
> Hello Minchan,
> 
> On Mon, Mar 25, 2013 at 7:21 AM, Minchan Kim <minchan@kernel.org> wrote:
> > These day, there are many platforms avaiable in the embedded market
> > and they are smarter than kernel which has very limited information
> > about working set so they want to involve memory management more heavily
> > like android's lowmemory killer and ashmem or recent many lowmemory
> > notifier(there was several trial for various company NOKIA, SAMSUNG,
> > Linaro, Google ChromeOS, Redhat).
> >
> > One of the simple imagine scenario about userspace's intelligence is that
> > platform can manage tasks as forground and backgroud so it would be
> > better to reclaim background's task pages for end-user's *responsibility*
> > although it has frequent referenced pages.
> >
> > This patch adds new knob "reclaim under proc/<pid>/" so task manager
> > can reclaim any target process anytime, anywhere. It could give another
> > method to platform for using memory efficiently.
> >
> > It can avoid process killing for getting free memory, which was really
> > terrible experience because I lost my best score of game I had ever
> > after I switch the phone call while I enjoyed the game.
> >
> > Writing 1 to /proc/pid/reclaim reclaims only file pages.
> > Writing 2 to /proc/pid/reclaim reclaims only anonymous pages.
> > Writing 3 to /proc/pid/reclaim reclaims all pages from target process.
> 
> This interface seems to work as advertized, at least from some light
> testing that I've done.

Thanks for the testing!

> 
> However, the interface is a quite blunt instrument. Would there be any
> virtue in extending it so that an address range could be written to
> /proc/PID/reclaim? Used in conjunction with /proc/PID/maps, a manager
> process might then choose to trigger reclaim of just selected regions
> of a processes address space. Thus, one might reclaim file backed
> pages in a range using:
> 
>     echo '2 start-address end-address' > /proc/PID/reclaim
> 
> What do you think?

It is really nice idea because some platform use a address space with
mulitple object. Simply, multiple application could work in a address space
but they use separate virtual address range in a address space.
In such model, per-process reclaim isn't vaild any more so your idea
would be nice for it.

One nitpick is that I'd like to use (address, size) instead of (start_address
, end_address) because we always confuse that end_address itself is
inclusive or not in the range.

And I am thinking another options like this

RECLAIM_SOFT_[FILE|ANON] 

It reclaims pages which are not workset.

RECLAIM_HARD_[FILE|ANON]

It reclaims pages of range unconditionally although pages are shared by
several processes.

But before that, I'd like to hear other guys's opinion.

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

  parent reply	other threads:[~2013-04-03 23:46 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-03-25  6:21 [RFC 1/4] mm: Per process reclaim Minchan Kim
2013-03-25  6:21 ` Minchan Kim
2013-03-25  6:21 ` [RFC 2/4] mm: make shrink_page_list with pages from multiple zones Minchan Kim
2013-03-25  6:21   ` Minchan Kim
2013-03-25  6:21 ` [RFC 3/4] mm: Remove shrink_page Minchan Kim
2013-03-25  6:21   ` Minchan Kim
2013-03-25  6:21 ` [RFC 4/4] mm: Enhance per process reclaim Minchan Kim
2013-03-25  6:21   ` Minchan Kim
2013-04-02 13:25   ` Michael Kerrisk
2013-04-02 13:25     ` Michael Kerrisk
2013-04-03  0:23     ` Minchan Kim
2013-04-03  0:23       ` Minchan Kim
2013-04-03  6:16       ` Michael Kerrisk (man-pages)
2013-04-03  6:16         ` Michael Kerrisk (man-pages)
2013-04-03  6:47         ` Michael Kerrisk (man-pages)
2013-04-03  6:47           ` Michael Kerrisk (man-pages)
2013-04-03  9:17 ` [RFC 1/4] mm: Per " Michael Kerrisk
2013-04-03  9:17   ` Michael Kerrisk
2013-04-03 23:31   ` Minchan Kim
2013-04-03 23:31     ` Minchan Kim
2013-04-03 10:10 ` Michael Kerrisk
2013-04-03 10:10   ` Michael Kerrisk
2013-04-03 10:12   ` Michael Kerrisk
2013-04-03 10:12     ` Michael Kerrisk
2013-04-03 23:46   ` Minchan Kim [this message]
2013-04-03 23:46     ` 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=20130403234644.GC7675@blaptop \
    --to=minchan@kernel.org \
    --cc=akpm@linux-foundation.org \
    --cc=hannes@cmpxchg.org \
    --cc=hughd@google.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mgorman@suse.de \
    --cc=mtk.manpages@gmail.com \
    --cc=riel@redhat.com \
    --cc=sangseok.lee@lge.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 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.