linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Minchan Kim <minchan@kernel.org>
To: Mel Gorman <mgorman@techsingularity.net>
Cc: Andrew Morton <akpm@linux-foundation.org>,
	Johannes Weiner <hannes@cmpxchg.org>,
	Vlastimil Babka <vbabka@suse.cz>, Linux-MM <linux-mm@kvack.org>,
	LKML <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH 5/5] mm, vmscan: Update all zone LRU sizes before updating memcg
Date: Fri, 15 Jul 2016 23:45:34 +0900	[thread overview]
Message-ID: <20160715144534.GA8644@bbox> (raw)
In-Reply-To: <1468588165-12461-6-git-send-email-mgorman@techsingularity.net>

On Fri, Jul 15, 2016 at 02:09:25PM +0100, Mel Gorman wrote:
> Minchan Kim reported setting the following warning on a 32-bit system
> although it can affect 64-bit systems.
> 
>   WARNING: CPU: 4 PID: 1322 at mm/memcontrol.c:998 mem_cgroup_update_lru_size+0x103/0x110
>   mem_cgroup_update_lru_size(f44b4000, 1, -7): zid 1 lru_size 1 but empty
>   Modules linked in:
>   CPU: 4 PID: 1322 Comm: cp Not tainted 4.7.0-rc4-mm1+ #143
>   Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS Bochs 01/01/2011
>    00000086 00000086 c2bc5a10 db3e4a97 c2bc5a54 db9d4025 c2bc5a40 db07b82a
>    db9d0594 c2bc5a70 0000052a db9d4025 000003e6 db208463 000003e6 00000001
>    f44b4000 00000001 c2bc5a5c db07b88b 00000009 00000000 c2bc5a54 db9d0594
>   Call Trace:
>    [<db3e4a97>] dump_stack+0x76/0xaf
>    [<db07b82a>] __warn+0xea/0x110
>    [<db208463>] ? mem_cgroup_update_lru_size+0x103/0x110
>    [<db07b88b>] warn_slowpath_fmt+0x3b/0x40
>    [<db208463>] mem_cgroup_update_lru_size+0x103/0x110
>    [<db1b52a2>] isolate_lru_pages.isra.61+0x2e2/0x360
>    [<db1b6ffc>] shrink_active_list+0xac/0x2a0
>    [<db3f136e>] ? __delay+0xe/0x10
>    [<db1b772c>] shrink_node_memcg+0x53c/0x7a0
>    [<db1b7a3b>] shrink_node+0xab/0x2a0
>    [<db1b7cf6>] do_try_to_free_pages+0xc6/0x390
>    [<db1b8205>] try_to_free_pages+0x245/0x590
> 
> LRU list contents and counts are updated separately. Counts are updated
> before pages are added to the LRU and updated after pages are removed.
> The warning above is from a check in mem_cgroup_update_lru_size that
> ensures that list sizes of zero are empty.
> 
> The problem is that node-lru needs to account for highmem pages if
> CONFIG_HIGHMEM is set. One impact of the implementation is that the
> sizes are updated in multiple passes when pages from multiple zones were
> isolated. This happens whether HIGHMEM is set or not. When multiple zones
> are isolated, it's possible for a debugging check in memcg to be tripped.
> 
> This patch forces all the zone counts to be updated before the memcg
> function is called.
> 
> Reported-and-tested-by: Minchan Kim <minchan@kernel.org>
> Signed-off-by: Mel Gorman <mgorman@techsingularity.net>
> ---

< snip >

> +/*
> + * Update LRU sizes after isolating pages. The LRU size updates must
> + * be complete before mem_cgroup_update_lru_size due to a santity check.
> + */

Looks better.

> +static __always_inline void update_lru_sizes(struct lruvec *lruvec,
> +			enum lru_list lru, unsigned long *nr_zone_taken,
> +			unsigned long nr_taken)
> +{
> +#ifdef CONFIG_HIGHMEM

If you think it's really worth to optimize it for non-highmem system,
we don't need to account nr_zone_taken in *isolate_lru_pages*
from the beginning for non-highmem system, either.

> +	int zid;
> +
> +	/*
> +	 * Highmem has separate accounting for highmem pages so each zone

                                               highmem file pages

--
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:[~2016-07-15 14:45 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-07-15 13:09 [PATCH 0/5] Follow-up fixes to node-lru series v2 Mel Gorman
2016-07-15 13:09 ` [PATCH 1/5] mm, vmscan: make shrink_node decisions more node-centric -fix Mel Gorman
2016-07-15 15:42   ` Minchan Kim
2016-07-18 16:14   ` Johannes Weiner
2016-07-15 13:09 ` [PATCH 2/5] mm, vmscan: avoid passing in classzone_idx unnecessarily to compaction_ready -fix Mel Gorman
2016-07-15 15:50   ` Minchan Kim
2016-07-18 16:15   ` Johannes Weiner
2016-07-15 13:09 ` [PATCH 3/5] mm, pagevec: Release/reacquire lru_lock on pgdat change Mel Gorman
2016-07-15 15:53   ` Minchan Kim
2016-07-18 16:20   ` Johannes Weiner
2016-07-15 13:09 ` [PATCH 4/5] mm: show node_pages_scanned per node, not zone Mel Gorman
2016-07-16 10:14   ` Minchan Kim
2016-07-15 13:09 ` [PATCH 5/5] mm, vmscan: Update all zone LRU sizes before updating memcg Mel Gorman
2016-07-15 14:45   ` Minchan Kim [this message]
2016-07-15 15:01     ` Mel Gorman
2016-07-15 15:54   ` 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=20160715144534.GA8644@bbox \
    --to=minchan@kernel.org \
    --cc=akpm@linux-foundation.org \
    --cc=hannes@cmpxchg.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mgorman@techsingularity.net \
    --cc=vbabka@suse.cz \
    /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).