Re: [PATCH 4/5] add isolate pages vmstat

From: Minchan Kim
Date: Sun Jul 05 2009 - 10:51:55 EST


On Sun, Jul 5, 2009 at 9:23 PM, KOSAKI
Motohiro<kosaki.motohiro@xxxxxxxxxxxxxx> wrote:
>> On Sun, Jul 05, 2009 at 05:25:32PM +0800, KOSAKI Motohiro wrote:
>> > Subject: [PATCH] add isolate pages vmstat
>> >
>> > If the system have plenty threads or processes, concurrent reclaim can
>> > isolate very much pages.
>> > Unfortunately, current /proc/meminfo and OOM log can't show it.
>> >
>> > This patch provide the way of showing this information.
>> >
>> >
>> > reproduce way
>> > -----------------------
>> > % ./hackbench 140 process 1000
>> > Â Â=> couse OOM
>> >
>> > Active_anon:4419 active_file:120 inactive_anon:1418
>> > Âinactive_file:61 unevictable:0 isolated:45311
>> > Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â^^^^^
>> > Âdirty:0 writeback:580 unstable:0
>> > Âfree:27 slab_reclaimable:297 slab_unreclaimable:4050
>> > Âmapped:221 kernel_stack:5758 pagetables:28219 bounce:0
>> >
>> >
>> >
>> > Signed-off-by: KOSAKI Motohiro <kosaki.motohiro@xxxxxxxxxxxxxx>
>> > ---
>> > Âdrivers/base/node.c  Â|  Â2 ++
>> > Âfs/proc/meminfo.c   Â|  Â2 ++
>> > Âinclude/linux/mmzone.h | Â Â1 +
>> > Âmm/page_alloc.c    Â|  Â6 ++++--
>> > Âmm/vmscan.c      Â|  Â4 ++++
>> > Âmm/vmstat.c      Â|  Â2 +-
>> > Â6 files changed, 14 insertions(+), 3 deletions(-)
>> >
>> > Index: b/fs/proc/meminfo.c
>> > ===================================================================
>> > --- a/fs/proc/meminfo.c
>> > +++ b/fs/proc/meminfo.c
>> > @@ -65,6 +65,7 @@ static int meminfo_proc_show(struct seq_
>> > Â Â Â Â Â Â "Active(file): Â %8lu kB\n"
>> > Â Â Â Â Â Â "Inactive(file): %8lu kB\n"
>> > Â Â Â Â Â Â "Unevictable: Â Â%8lu kB\n"
>> > + Â Â Â Â Â "IsolatedPages: Â%8lu kB\n"
>> > Â Â Â Â Â Â "Mlocked: Â Â Â Â%8lu kB\n"
>> > Â#ifdef CONFIG_HIGHMEM
>> > Â Â Â Â Â Â "HighTotal: Â Â Â%8lu kB\n"
>> > @@ -109,6 +110,7 @@ static int meminfo_proc_show(struct seq_
>> > Â Â Â Â Â Â K(pages[LRU_ACTIVE_FILE]),
>> > Â Â Â Â Â Â K(pages[LRU_INACTIVE_FILE]),
>> > Â Â Â Â Â Â K(pages[LRU_UNEVICTABLE]),
>> > + Â Â Â Â Â K(global_page_state(NR_ISOLATED)),
>>
>> Glad to see you renamed it to NR_ISOLATED :)
>> But for the user visible name, how about IsolatedLRU?
>
> Ah, nice. Âbelow is update patch.
>
> Changelog
> ----------------
> Âsince v1
> Â Â- rename "IsolatedPages" to "IsolatedLRU"
>
>
> =================================
> Subject: [PATCH] add isolate pages vmstat
>
> If the system have plenty threads or processes, concurrent reclaim can
> isolate very much pages.
> Unfortunately, current /proc/meminfo and OOM log can't show it.
>
> This patch provide the way of showing this information.
>
>
> reproduce way
> -----------------------
> % ./hackbench 140 process 1000
> Â => couse OOM
>
> Active_anon:4419 active_file:120 inactive_anon:1418
> Âinactive_file:61 unevictable:0 isolated:45311
> Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â ^^^^^
> Âdirty:0 writeback:580 unstable:0
> Âfree:27 slab_reclaimable:297 slab_unreclaimable:4050
> Âmapped:221 kernel_stack:5758 pagetables:28219 bounce:0
>
>
>
> Signed-off-by: KOSAKI Motohiro <kosaki.motohiro@xxxxxxxxxxxxxx>
> Acked-by: Wu Fengguang <fengguang.wu@xxxxxxxxx>
> ---
> Âdrivers/base/node.c  Â|  Â2 ++
> Âfs/proc/meminfo.c   Â|  Â2 ++
> Âinclude/linux/mmzone.h | Â Â1 +
> Âmm/page_alloc.c    Â|  Â6 ++++--
> Âmm/vmscan.c      Â|  Â4 ++++
> Âmm/vmstat.c      Â|  Â2 +-
> Â6 files changed, 14 insertions(+), 3 deletions(-)
>
> Index: b/fs/proc/meminfo.c
> ===================================================================
> --- a/fs/proc/meminfo.c
> +++ b/fs/proc/meminfo.c
> @@ -65,6 +65,7 @@ static int meminfo_proc_show(struct seq_
> Â Â Â Â Â Â Â Â"Active(file): Â %8lu kB\n"
> Â Â Â Â Â Â Â Â"Inactive(file): %8lu kB\n"
> Â Â Â Â Â Â Â Â"Unevictable: Â Â%8lu kB\n"
> + Â Â Â Â Â Â Â "IsolatedLRU: Â Â%8lu kB\n"
> Â Â Â Â Â Â Â Â"Mlocked: Â Â Â Â%8lu kB\n"
> Â#ifdef CONFIG_HIGHMEM
> Â Â Â Â Â Â Â Â"HighTotal: Â Â Â%8lu kB\n"
> @@ -109,6 +110,7 @@ static int meminfo_proc_show(struct seq_
> Â Â Â Â Â Â Â ÂK(pages[LRU_ACTIVE_FILE]),
> Â Â Â Â Â Â Â ÂK(pages[LRU_INACTIVE_FILE]),
> Â Â Â Â Â Â Â ÂK(pages[LRU_UNEVICTABLE]),
> + Â Â Â Â Â Â Â K(global_page_state(NR_ISOLATED)),
> Â Â Â Â Â Â Â ÂK(global_page_state(NR_MLOCK)),
> Â#ifdef CONFIG_HIGHMEM
> Â Â Â Â Â Â Â ÂK(i.totalhigh),
> Index: b/include/linux/mmzone.h
> ===================================================================
> --- a/include/linux/mmzone.h
> +++ b/include/linux/mmzone.h
> @@ -100,6 +100,7 @@ enum zone_stat_item {
> Â Â Â ÂNR_BOUNCE,
> Â Â Â ÂNR_VMSCAN_WRITE,
> Â Â Â ÂNR_WRITEBACK_TEMP, Â Â Â/* Writeback using temporary buffers */
> + Â Â Â NR_ISOLATED, Â Â Â Â Â Â/* Temporary isolated pages from lru */
> Â#ifdef CONFIG_NUMA
> Â Â Â ÂNUMA_HIT, Â Â Â Â Â Â Â /* allocated in intended node */
> Â Â Â ÂNUMA_MISS, Â Â Â Â Â Â Â/* allocated in non intended node */
> Index: b/mm/page_alloc.c
> ===================================================================
> --- a/mm/page_alloc.c
> +++ b/mm/page_alloc.c
> @@ -2116,8 +2116,7 @@ void show_free_areas(void)
> Â Â Â Â}
>
> Â Â Â Âprintk("Active_anon:%lu active_file:%lu inactive_anon:%lu\n"
> - Â Â Â Â Â Â Â " inactive_file:%lu"
> - Â Â Â Â Â Â Â " unevictable:%lu"
> + Â Â Â Â Â Â Â " inactive_file:%lu unevictable:%lu isolated:%lu\n"

It's good.
I have a one suggestion.

I know this patch came from David's OOM problem a few days ago.

I think total pages isolated of all lru doesn't help us much.
It just represents why [in]active[anon/file] is zero.

How about adding isolate page number per each lru ?

IsolatedPages(file)
IsolatedPages(anon)

It can help knowing exact number of each lru.

--
Kind regards,
Minchan Kim
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/