From: Minchan Kim <minchan@kernel.org>
To: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
Cc: linux-mm <linux-mm@kvack.org>,
LKML <linux-kernel@vger.kernel.org>,
leonid.moiseichuk@nokia.com, penberg@kernel.org,
Rik van Riel <riel@redhat.com>,
mel@csn.ul.ie, rientjes@google.com,
KOSAKI Motohiro <kosaki.motohiro@gmail.com>,
Johannes Weiner <hannes@cmpxchg.org>,
Marcelo Tosatti <mtosatti@redhat.com>,
Andrew Morton <akpm@linux-foundation.org>,
Ronen Hod <rhod@redhat.com>
Subject: Re: [RFC 2/3] vmscan hook
Date: Tue, 17 Jan 2012 18:13:56 +0900 [thread overview]
Message-ID: <20120117091356.GA29736@barrios-desktop.redhat.com> (raw)
In-Reply-To: <20120117173932.1c058ba4.kamezawa.hiroyu@jp.fujitsu.com>
On Tue, Jan 17, 2012 at 05:39:32PM +0900, KAMEZAWA Hiroyuki wrote:
> On Tue, 17 Jan 2012 17:13:57 +0900
> Minchan Kim <minchan@kernel.org> wrote:
>
> > This patch insert memory pressure notify point into vmscan.c
> > Most problem in system slowness is swap-in. swap-in is a synchronous
> > opeartion so that it affects heavily system response.
> >
> > This patch alert it when reclaimer start to reclaim inactive anon list.
> > It seems rather earlier but not bad than too late.
> >
> > Other alert point is when there is few cache pages
> > In this implementation, if it is (cache < free pages),
> > memory pressure notify happens. It has to need more testing and tuning
> > or other hueristic. Any suggesion are welcome.
> >
> > Signed-off-by: Minchan Kim <minchan@kernel.org>
>
> In my 1st impression, isn't this too simple ?
I agree It's too simple. It would be good start point rather than
unnecessary complicated things.
>
>
> > ---
> > mm/vmscan.c | 28 ++++++++++++++++++++++++++++
> > 1 files changed, 28 insertions(+), 0 deletions(-)
> >
> > diff --git a/mm/vmscan.c b/mm/vmscan.c
> > index 2880396..cfa2e2d 100644
> > --- a/mm/vmscan.c
> > +++ b/mm/vmscan.c
> > @@ -43,6 +43,7 @@
> > #include <linux/sysctl.h>
> > #include <linux/oom.h>
> > #include <linux/prefetch.h>
> > +#include <linux/low_mem_notify.h>
> >
> > #include <asm/tlbflush.h>
> > #include <asm/div64.h>
> > @@ -2082,16 +2083,43 @@ static void shrink_mem_cgroup_zone(int priority, struct mem_cgroup_zone *mz,
> > {
> > unsigned long nr[NR_LRU_LISTS];
> > unsigned long nr_to_scan;
> > +
> > enum lru_list lru;
> > unsigned long nr_reclaimed, nr_scanned;
> > unsigned long nr_to_reclaim = sc->nr_to_reclaim;
> > struct blk_plug plug;
> > +#ifdef CONFIG_LOW_MEM_NOTIFY
> > + bool low_mem = false;
> > + unsigned long free, file;
> > +#endif
> >
> > restart:
> > nr_reclaimed = 0;
> > nr_scanned = sc->nr_scanned;
> > get_scan_count(mz, sc, nr, priority);
> > +#ifdef CONFIG_LOW_MEM_NOTIFY
> > + /* We want to avoid swapout */
> > + if (nr[LRU_INACTIVE_ANON])
> > + low_mem = true;
>
> IIUC, nr[LRU_INACTIVE_ANON] can be easily > 0.
Yes. But I thought it would be better than late notification.
Late notification ends up swap out which is a big concern about this patch.
More proper timing suggestion helps me a lot.
> And get_scan_count() now check per-memcg-lru. So, this only works when
> memcg is not used.
Hmm, I didn't look at recent memcg/global reclaim unify patch of Johannes.
I need time to look at it.
Thanks.
>
>
> > + /*
> > + * We want to avoid dropping page cache excessively
> > + * in no swap system
> > + */
> > + if (nr_swap_pages <= 0) {
> > + free = zone_page_state(mz->zone, NR_FREE_PAGES);
> > + file = zone_page_state(mz->zone, NR_ACTIVE_FILE) +
> > + zone_page_state(mz->zone, NR_INACTIVE_FILE);
> > + /*
> > + * If we have very few page cache pages,
> > + * notify to user
> > + */
> > + if (file < free)
> > + low_mem = true;
> > + }
>
> I can't understand why you think you can check lowmem condition by "file < free".
The reason I thought so is I want to maintain some page cache to some degree.
But I admit It's very naive heuristic and should be improved.
> And I don't think using per-zone data is good.
> (I'm not sure how many zones embeded guys using..)
Agree. In case of swapless system, we need another heuristic.
>
> Another idea:
> 1. can't we use some technique like cleancache to detect the condition ?
I totally forgot cleancache approach. Could you remind that?
> 2. can't we measure page-in/page-out distance by recording something ?
I can't understand your point. What's relation does it with swapout prevent?
> 3. NR_ANON + NR_FILE_MAPPED can't mean the amount of core memory if we can
> ignore the data file cache ?
It's good but how do we define some amount?
It's very vague but I guess we can get a good idea from that.
Perhaps, you already has it.
> 4. how about checking kswapd's busy status ?
Could you elaborate on your idea?
Kame, Thanks for reply,
>
>
>
> Thanks,
> -Kame
>
--
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/ .
Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
next prev parent reply other threads:[~2012-01-17 9:14 UTC|newest]
Thread overview: 62+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-01-17 8:13 [RFC 0/3] low memory notify Minchan Kim
2012-01-17 8:13 ` [RFC 1/3] /dev/low_mem_notify Minchan Kim
2012-01-17 9:27 ` Pekka Enberg
2012-01-17 16:35 ` Rik van Riel
2012-01-17 18:51 ` Pekka Enberg
2012-01-17 19:30 ` Rik van Riel
2012-01-17 19:49 ` Pekka Enberg
2012-01-17 19:54 ` Pekka Enberg
2012-01-17 19:57 ` Pekka Enberg
2012-01-17 23:20 ` Minchan Kim
2012-01-18 7:16 ` Pekka Enberg
2012-01-18 7:49 ` Minchan Kim
2012-01-18 9:06 ` leonid.moiseichuk
2012-01-18 9:15 ` Pekka Enberg
2012-01-18 9:41 ` leonid.moiseichuk
2012-01-18 10:40 ` Pekka Enberg
2012-01-18 10:44 ` leonid.moiseichuk
2012-01-18 23:34 ` Ronen Hod
2012-01-19 7:25 ` Pekka Enberg
2012-01-19 9:05 ` Ronen Hod
2012-01-19 9:10 ` Pekka Enberg
2012-01-19 9:20 ` Ronen Hod
2012-01-19 10:53 ` leonid.moiseichuk
2012-01-19 11:07 ` Pekka Enberg
2012-01-19 11:54 ` leonid.moiseichuk
2012-01-19 11:59 ` Pekka Enberg
2012-01-19 12:06 ` Pekka Enberg
2012-01-24 15:38 ` Marcelo Tosatti
2012-01-24 16:08 ` Ronen Hod
2012-01-24 18:10 ` Marcelo Tosatti
2012-01-25 8:52 ` Ronen Hod
2012-01-25 10:12 ` Marcelo Tosatti
2012-01-25 10:48 ` Ronen Hod
2012-01-26 16:17 ` Marcelo Tosatti
2012-01-24 16:10 ` Pekka Enberg
2012-01-24 18:29 ` Marcelo Tosatti
2012-01-25 8:19 ` leonid.moiseichuk
2012-01-19 7:34 ` Pekka Enberg
2012-01-24 16:22 ` Arnd Bergmann
2012-01-18 14:30 ` Rik van Riel
2012-01-18 15:29 ` Pekka Enberg
2012-01-24 15:40 ` Marcelo Tosatti
2012-01-24 16:01 ` Pekka Enberg
2012-01-24 16:25 ` Arnd Bergmann
2012-01-24 18:32 ` Marcelo Tosatti
2012-01-24 21:57 ` Jonathan Corbet
2012-01-17 9:45 ` Pekka Enberg
2012-01-17 8:13 ` [RFC 2/3] vmscan hook Minchan Kim
2012-01-17 8:39 ` KAMEZAWA Hiroyuki
2012-01-17 9:13 ` Minchan Kim [this message]
2012-01-17 10:05 ` KAMEZAWA Hiroyuki
2012-01-17 23:08 ` Minchan Kim
2012-01-18 0:18 ` KAMEZAWA Hiroyuki
2012-01-18 14:17 ` Rik van Riel
2012-01-19 2:25 ` KAMEZAWA Hiroyuki
2012-01-19 14:42 ` Rik van Riel
2012-01-20 0:24 ` KAMEZAWA Hiroyuki
2012-01-17 8:13 ` [RFC 3/3] test program Minchan Kim
2012-01-17 14:38 ` [RFC 0/3] low memory notify Colin Walters
2012-01-17 15:04 ` Pekka Enberg
2012-01-17 16:44 ` Rik van Riel
2012-01-17 17:16 ` Olof Johansson
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=20120117091356.GA29736@barrios-desktop.redhat.com \
--to=minchan@kernel.org \
--cc=akpm@linux-foundation.org \
--cc=hannes@cmpxchg.org \
--cc=kamezawa.hiroyu@jp.fujitsu.com \
--cc=kosaki.motohiro@gmail.com \
--cc=leonid.moiseichuk@nokia.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=mel@csn.ul.ie \
--cc=mtosatti@redhat.com \
--cc=penberg@kernel.org \
--cc=rhod@redhat.com \
--cc=riel@redhat.com \
--cc=rientjes@google.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).