From: Minchan Kim <minchan.kim@gmail.com>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>,
LKML <linux-kernel@vger.kernel.org>,
linux-mm <linux-mm@kvack.org>,
Wu Fengguang <fengguang.wu@intel.com>,
Rik van Riel <riel@redhat.com>,
Christoph Lameter <cl@linux-foundation.org>
Subject: Re: [PATCH 3/3] add isolate pages vmstat
Date: Thu, 16 Jul 2009 13:22:32 +0900 [thread overview]
Message-ID: <28c262360907152122v4f30594cr677b744df3aaefcc@mail.gmail.com> (raw)
In-Reply-To: <20090715201657.b01edccd.akpm@linux-foundation.org>
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset=UTF-8, Size: 8754 bytes --]
On Thu, Jul 16, 2009 at 12:16 PM, Andrew
Morton<akpm@linux-foundation.org> wrote:
> On Thu, 16 Jul 2009 09:55:47 +0900 (JST) KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com> wrote:
>
>> ChangeLog
>> Â Since v5
>> Â Â - Rewrote the description
>> Â Â - Treat page migration
>> Â Since v4
>> Â Â - Changed displaing order in show_free_areas() (as Wu's suggested)
>> Â Since v3
>> Â Â - Fixed misaccount page bug when lumby reclaim occur
>> Â Since v2
>> Â Â - Separated IsolateLRU field to Isolated(anon) and Isolated(file)
>> Â Since v1
>> Â Â - Renamed IsolatePages to IsolatedLRU
>>
>> ==================================
>> Subject: [PATCH] add isolate pages vmstat
>>
>> If the system is running a heavy load of processes then concurrent reclaim
>> can isolate a large numbe of pages from the LRU. /proc/meminfo and the
>> output generated for an OOM do not show how many pages were isolated.
>>
>> This patch shows the information about isolated pages.
>>
>>
>> reproduce way
>> -----------------------
>> % ./hackbench 140 process 1000
>> Â Â => OOM occur
>>
>> active_anon:146 inactive_anon:0 isolated_anon:49245
>> Â active_file:79 inactive_file:18 isolated_file:113
>> Â unevictable:0 dirty:0 writeback:0 unstable:0 buffer:39
>> Â free:370 slab_reclaimable:309 slab_unreclaimable:5492
>> Â mapped:53 shmem:15 pagetables:28140 bounce:0
>>
>>
>> Signed-off-by: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
>> Acked-by: Rik van Riel <riel@redhat.com>
>> Acked-by: Wu Fengguang <fengguang.wu@intel.com>
>> Reviewed-by: Minchan Kim <minchan.kim@gmail.com>
>> ---
>>  drivers/base/node.c   |   4 ++++
>>  fs/proc/meminfo.c    |   4 ++++
>> Â include/linux/mmzone.h | Â Â 2 ++
>>  mm/migrate.c      |  11 +++++++++++
>>  mm/page_alloc.c     |  12 +++++++++---
>>  mm/vmscan.c       |  12 +++++++++++-
>>  mm/vmstat.c       |   2 ++
>> Â 7 files changed, 43 insertions(+), 4 deletions(-)
>>
>> Index: b/fs/proc/meminfo.c
>> ===================================================================
>> --- a/fs/proc/meminfo.c
>> +++ b/fs/proc/meminfo.c
>> @@ -65,6 +65,8 @@ static int meminfo_proc_show(struct seq_
>> Â Â Â Â Â Â Â "Active(file): Â %8lu kB\n"
>> Â Â Â Â Â Â Â "Inactive(file): %8lu kB\n"
>> Â Â Â Â Â Â Â "Unevictable: Â Â %8lu kB\n"
>> + Â Â Â Â Â Â "Isolated(anon): %8lu kB\n"
>> + Â Â Â Â Â Â "Isolated(file): %8lu kB\n"
>> Â Â Â Â Â Â Â "Mlocked: Â Â Â Â %8lu kB\n"
>
> Are these counters really important enough to justify being present in
> /proc/meminfo? Â They seem fairly low-level developer-only details.
> Perhaps relegate them to /proc/vmstat?
>
>> Â #ifdef CONFIG_HIGHMEM
>> Â Â Â Â Â Â Â "HighTotal: Â Â Â %8lu kB\n"
>> @@ -110,6 +112,8 @@ 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_ANON)),
>> + Â Â Â Â Â Â K(global_page_state(NR_ISOLATED_FILE)),
>> Â Â Â Â Â Â Â 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,8 @@ enum zone_stat_item {
>> Â Â Â NR_BOUNCE,
>> Â Â Â NR_VMSCAN_WRITE,
>> Â Â Â NR_WRITEBACK_TEMP, Â Â Â /* Writeback using temporary buffers */
>> + Â Â NR_ISOLATED_ANON, Â Â Â /* Temporary isolated pages from anon lru */
>> + Â Â NR_ISOLATED_FILE, Â Â Â /* Temporary isolated pages from file lru */
>> Â Â Â NR_SHMEM, Â Â Â Â Â Â Â /* shmem pages (included tmpfs/GEM pages) */
>> Â #ifdef CONFIG_NUMA
>> Â Â Â NUMA_HIT, Â Â Â Â Â Â Â /* allocated in intended node */
>> Index: b/mm/page_alloc.c
>> ===================================================================
>> --- a/mm/page_alloc.c
>> +++ b/mm/page_alloc.c
>> @@ -2115,16 +2115,18 @@ void show_free_areas(void)
>> Â Â Â Â Â Â Â }
>> Â Â Â }
>>
>> - Â Â printk("Active_anon:%lu active_file:%lu inactive_anon:%lu\n"
>> - Â Â Â Â Â Â " inactive_file:%lu"
>> + Â Â printk("active_anon:%lu inactive_anon:%lu isolated_anon:%lu\n"
>> + Â Â Â Â Â Â " active_file:%lu inactive_file:%lu isolated_file:%lu\n"
>> Â Â Â Â Â Â Â " unevictable:%lu"
>> Â Â Â Â Â Â Â " dirty:%lu writeback:%lu unstable:%lu buffer:%lu\n"
>> Â Â Â Â Â Â Â " free:%lu slab_reclaimable:%lu slab_unreclaimable:%lu\n"
>> Â Â Â Â Â Â Â " mapped:%lu shmem:%lu pagetables:%lu bounce:%lu\n",
>> Â Â Â Â Â Â Â global_page_state(NR_ACTIVE_ANON),
>> - Â Â Â Â Â Â global_page_state(NR_ACTIVE_FILE),
>> Â Â Â Â Â Â Â global_page_state(NR_INACTIVE_ANON),
>> + Â Â Â Â Â Â global_page_state(NR_ISOLATED_ANON),
>> + Â Â Â Â Â Â global_page_state(NR_ACTIVE_FILE),
>> Â Â Â Â Â Â Â global_page_state(NR_INACTIVE_FILE),
>> + Â Â Â Â Â Â global_page_state(NR_ISOLATED_FILE),
>> Â Â Â Â Â Â Â global_page_state(NR_UNEVICTABLE),
>> Â Â Â Â Â Â Â global_page_state(NR_FILE_DIRTY),
>> Â Â Â Â Â Â Â global_page_state(NR_WRITEBACK),
>> @@ -2152,6 +2154,8 @@ void show_free_areas(void)
>> Â Â Â Â Â Â Â Â Â Â Â " active_file:%lukB"
>> Â Â Â Â Â Â Â Â Â Â Â " inactive_file:%lukB"
>> Â Â Â Â Â Â Â Â Â Â Â " unevictable:%lukB"
>> + Â Â Â Â Â Â Â Â Â Â " isolated(anon):%lukB"
>> + Â Â Â Â Â Â Â Â Â Â " isolated(file):%lukB"
>> Â Â Â Â Â Â Â Â Â Â Â " present:%lukB"
>> Â Â Â Â Â Â Â Â Â Â Â " mlocked:%lukB"
>> Â Â Â Â Â Â Â Â Â Â Â " dirty:%lukB"
>> @@ -2178,6 +2182,8 @@ void show_free_areas(void)
>> Â Â Â Â Â Â Â Â Â Â Â K(zone_page_state(zone, NR_ACTIVE_FILE)),
>> Â Â Â Â Â Â Â Â Â Â Â K(zone_page_state(zone, NR_INACTIVE_FILE)),
>> Â Â Â Â Â Â Â Â Â Â Â K(zone_page_state(zone, NR_UNEVICTABLE)),
>> + Â Â Â Â Â Â Â Â Â Â K(zone_page_state(zone, NR_ISOLATED_ANON)),
>> + Â Â Â Â Â Â Â Â Â Â K(zone_page_state(zone, NR_ISOLATED_FILE)),
>> Â Â Â Â Â Â Â Â Â Â Â K(zone->present_pages),
>> Â Â Â Â Â Â Â Â Â Â Â K(zone_page_state(zone, NR_MLOCK)),
>> Â Â Â Â Â Â Â Â Â Â Â K(zone_page_state(zone, NR_FILE_DIRTY)),
>> Index: b/mm/vmscan.c
>> ===================================================================
>> --- a/mm/vmscan.c
>> +++ b/mm/vmscan.c
>> @@ -1067,6 +1067,8 @@ static unsigned long shrink_inactive_lis
>> Â Â Â Â Â Â Â unsigned long nr_active;
>> Â Â Â Â Â Â Â unsigned int count[NR_LRU_LISTS] = { 0, };
>> Â Â Â Â Â Â Â int mode = lumpy_reclaim ? ISOLATE_BOTH : ISOLATE_INACTIVE;
>> + Â Â Â Â Â Â unsigned long nr_anon;
>> + Â Â Â Â Â Â unsigned long nr_file;
>>
>> Â Â Â Â Â Â Â nr_taken = sc->isolate_pages(sc->swap_cluster_max,
>> Â Â Â Â Â Â Â Â Â Â Â Â Â Â &page_list, &nr_scan, sc->order, mode,
>> @@ -1097,6 +1099,10 @@ static unsigned long shrink_inactive_lis
>> Â Â Â Â Â Â Â __mod_zone_page_state(zone, NR_INACTIVE_ANON,
>> Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â -count[LRU_INACTIVE_ANON]);
>>
>> + Â Â Â Â Â Â nr_anon = count[LRU_ACTIVE_ANON] + count[LRU_INACTIVE_ANON];
>> + Â Â Â Â Â Â nr_file = count[LRU_ACTIVE_FILE] + count[LRU_INACTIVE_FILE];
>> + Â Â Â Â Â Â __mod_zone_page_state(zone, NR_ISOLATED_ANON, nr_anon);
>> + Â Â Â Â Â Â __mod_zone_page_state(zone, NR_ISOLATED_FILE, nr_file);
>>
>> Â Â Â Â Â Â Â reclaim_stat->recent_scanned[0] += count[LRU_INACTIVE_ANON];
>> Â Â Â Â Â Â Â reclaim_stat->recent_scanned[0] += count[LRU_ACTIVE_ANON];
>> @@ -1164,6 +1170,9 @@ static unsigned long shrink_inactive_lis
>> Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â spin_lock_irq(&zone->lru_lock);
>> Â Â Â Â Â Â Â Â Â Â Â }
>> Â Â Â Â Â Â Â }
>> + Â Â Â Â Â Â __mod_zone_page_state(zone, NR_ISOLATED_ANON, -nr_anon);
>> + Â Â Â Â Â Â __mod_zone_page_state(zone, NR_ISOLATED_FILE, -nr_file);
>> +
>> Â Â Â } while (nr_scanned < max_scan);
>
> This is a non-trivial amount of extra stuff. Â Do we really need it?
>
I thought so.
This patch results form process fork bomb(ex, mstctl11 in LTP).
Too many isolated patches are based on isolation counter.
So, I think we need this until now.
If we can solve the problem with different method, then we can drop this.
--
Kind regards,
Minchan Kim
N§²æìr¸zǧu©²Æ {\béì¹»\x1c®&Þ)îÆi¢Ø^nr¶Ý¢j$½§$¢¸\x05¢¹¨è§~'.)îÄÃ,yèm¶ÿÃ\f%{±j+ðèצj)Z·
next prev parent reply other threads:[~2009-07-16 4:22 UTC|newest]
Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-07-16 0:51 [PATCH 0/3] Account the number of isolate pages KOSAKI Motohiro
2009-07-16 0:52 ` [PATCH 1/3] Rename pgmoved variable in shrink_active_list() KOSAKI Motohiro
2009-07-16 2:08 ` Rik van Riel
2009-07-16 3:16 ` Andrew Morton
2009-07-16 4:01 ` Minchan Kim
2009-07-16 4:22 ` KOSAKI Motohiro
2009-07-16 4:35 ` Andrew Morton
2009-07-16 4:38 ` KOSAKI Motohiro
2009-07-16 4:46 ` KOSAKI Motohiro
2009-07-16 4:49 ` Andrew Morton
2009-07-16 4:00 ` Minchan Kim
2009-07-16 12:33 ` Wu Fengguang
2009-07-16 14:11 ` Christoph Lameter
2009-07-16 17:32 ` Johannes Weiner
2009-07-17 5:43 ` KOSAKI Motohiro
2009-07-16 0:53 ` [PATCH 2/3] mm: shrink_inactive_lis() nr_scan accounting fix fix KOSAKI Motohiro
2009-07-16 2:10 ` Rik van Riel
2009-07-16 4:10 ` Minchan Kim
2009-07-16 12:55 ` Wu Fengguang
2009-07-17 0:16 ` KOSAKI Motohiro
2009-07-16 0:55 ` [PATCH 3/3] add isolate pages vmstat KOSAKI Motohiro
2009-07-16 3:16 ` Andrew Morton
2009-07-16 4:22 ` Minchan Kim [this message]
2009-07-16 4:35 ` KOSAKI Motohiro
2009-07-16 14:26 ` Christoph Lameter
2009-07-17 7:00 ` KOSAKI Motohiro
2009-07-17 16:34 ` Christoph Lameter
2009-07-20 5:39 ` KOSAKI Motohiro
2009-07-20 15:27 ` Christoph Lameter
2009-07-20 16:22 ` KOSAKI Motohiro
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=28c262360907152122v4f30594cr677b744df3aaefcc@mail.gmail.com \
--to=minchan.kim@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=cl@linux-foundation.org \
--cc=fengguang.wu@intel.com \
--cc=kosaki.motohiro@jp.fujitsu.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.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