From: Andrew Morton <akpm@linux-foundation.org>
To: Ying Han <yinghan@google.com>
Cc: Michal Hocko <mhocko@suse.cz>,
Johannes Weiner <hannes@cmpxchg.org>, Mel Gorman <mel@csn.ul.ie>,
KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>,
Rik van Riel <riel@redhat.com>,
Minchan Kim <minchan.kim@gmail.com>,
Hugh Dickins <hughd@google.com>,
KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>,
Nick Piggin <npiggin@suse.de>,
linux-mm@kvack.org, Mel Gorman <mgorman@suse.de>
Subject: Re: [PATCH 1/2] mm: Warn once when a page is freed with PG_mlocked
Date: Fri, 27 Apr 2012 14:32:03 -0700 [thread overview]
Message-ID: <20120427143203.06b901b5.akpm@linux-foundation.org> (raw)
In-Reply-To: <1335548546-25040-1-git-send-email-yinghan@google.com>
On Fri, 27 Apr 2012 10:42:26 -0700
Ying Han <yinghan@google.com> wrote:
> I am resending this patch orginally from Mel, and the reason we spotted this
> is due to the next patch where I am adding the mlock stat into per-memcg
> meminfo. We found out that it is impossible to update the counter if the page
> is in the freeing patch w/ mlocked bit set.
>
> Then we started wondering if it is possible at all. It shouldn't happen that
> freeing a mlocked page without going through munlock_vma_pages_all(). Looks
> like it did happen few years ago, and here is the patch introduced it
>
> commit 985737cf2ea096ea946aed82c7484d40defc71a8
> Author: Lee Schermerhorn <lee.schermerhorn@hp.com>
> Date: Sat Oct 18 20:26:53 2008 -0700
>
> mlock: count attempts to free mlocked page
>
> There are two ways to persue and I would like to ask people's opinion:
>
> 1. revert the patch totally and the page will get into bad_page(). Then we
> get the report as well.
>
> 2. fix up the page like the patch does but put on warn_once() to report the
> problem.
>
> People might feel more confident by doing step by step which adding the
> warn_on() first and then revert it later. So I resend the patch from Mel and
> here is the patch:
>
> When a page is freed with the PG_mlocked set, it is considered an unexpected
> but recoverable situation. A counter records how often this event happens
> but it is easy to miss that this event has occured at all. This patch warns
> once when PG_mlocked is set to prompt debuggers to check the counter to
> see how often it is happening.
The changelog is kinda confusing and tl;dr, but the idea seems good ;)
> --- a/mm/page_alloc.c
> +++ b/mm/page_alloc.c
> @@ -599,6 +599,11 @@ out:
> */
> static inline void free_page_mlock(struct page *page)
> {
> + WARN_ONCE(1, KERN_WARNING
> + "Page flag mlocked set for process %s at pfn:%05lx\n"
> + "page:%p flags:%#lx\n",
> + current->comm, page_to_pfn(page),
> + page, page->flags|__PG_MLOCKED);
> __dec_zone_page_state(page, NR_MLOCK);
> __count_vm_event(UNEVICTABLE_MLOCKFREED);
> }
KERN_WARNING seems wimpy: we want to shout about this, so KERN_ERR. Or
just leave it empty.
Also, the patch duplicates bad_page()/dump_page(). Can we use them?
They use KERN_ALERT, btw.
--
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-04-27 21:32 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-04-27 17:42 Ying Han
2012-04-27 21:32 ` Andrew Morton [this message]
2012-04-27 22:51 ` Johannes Weiner
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=20120427143203.06b901b5.akpm@linux-foundation.org \
--to=akpm@linux-foundation.org \
--cc=hannes@cmpxchg.org \
--cc=hughd@google.com \
--cc=kamezawa.hiroyu@jp.fujitsu.com \
--cc=kosaki.motohiro@jp.fujitsu.com \
--cc=linux-mm@kvack.org \
--cc=mel@csn.ul.ie \
--cc=mgorman@suse.de \
--cc=mhocko@suse.cz \
--cc=minchan.kim@gmail.com \
--cc=npiggin@suse.de \
--cc=riel@redhat.com \
--cc=yinghan@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