linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Minchan Kim <minchan.kim@gmail.com>
To: Andrew Lutomirski <luto@mit.edu>,
	KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
Cc: Wu Fengguang <fengguang.wu@intel.com>,
	Andi Kleen <andi@firstfloor.org>,
	"linux-mm@kvack.org" <linux-mm@kvack.org>,
	LKML <linux-kernel@vger.kernel.org>,
	KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>,
	Mel Gorman <mgorman@suse.de>,
	Johannes Weiner <hannes@cmpxchg.org>,
	Rik van Riel <riel@redhat.com>
Subject: Re: Kernel falls apart under light memory pressure (i.e. linking vmlinux)
Date: Thu, 19 May 2011 11:54:05 +0900	[thread overview]
Message-ID: <BANLkTima0hPrPwe_x06afAh+zTi-bOcRMg@mail.gmail.com> (raw)
In-Reply-To: <BANLkTikHMUru=w4zzRmosrg2bDbsFWrkTQ@mail.gmail.com>

On Thu, May 19, 2011 at 11:15 AM, Andrew Lutomirski <luto@mit.edu> wrote:
> On Wed, May 18, 2011 at 1:17 AM, Minchan Kim <minchan.kim@gmail.com> wrote:
>> On Wed, May 18, 2011 at 4:22 AM, Andrew Lutomirski <luto@mit.edu> wrote:
>>>> No, thanks. However it would be valuable if you can retry with this
>>>> patch _alone_ (without the "if (need_resched()) return false;" change,
>>>> as I don't see how it helps your case).
>>>>
>>>> @@ -2286,7 +2290,7 @@ static bool sleeping_prematurely(pg_data_t
>>>> *pgdat, int order, long remaining,
>>>>        * must be balanced
>>>>        */
>>>>       if (order)
>>>> -               return pgdat_balanced(pgdat, balanced, classzone_idx);
>>>> +               return !pgdat_balanced(pgdat, balanced, classzone_idx);
>>>>       else
>>>>               return !all_zones_ok;
>>>>  }
>>>
>>> Done.
>>>
>>> I logged in, added swap, and ran a program that allocated 1900MB of
>>> RAM and memset it.  The system lagged a bit but survived.  kswapd
>>> showed 10% CPU (which is odd, IMO, since I'm using aesni-intel and I
>>> think that all the crypt happens in kworker when aesni-intel is in
>>> use).
>>
>> I think kswapd could use 10% enough for reclaim.
>>
>>>
>>> Then I started Firefox, loaded gmail, and ran test_mempressure.sh.
>>> Kaboom!  (I.e. system was hung)  SysRq-F saved the system and produced
>>
>> Hang?
>> It means you see softhangup of kswapd? or mouse/keyboard doesn't move?
>
> Mouse and keyboard dead.
>
>> Andrew, Could you test this patch with !pgdat_balanced patch?
>> I think we shouldn't see OOM message if we have lots of free swap space.
>>
>> == CUT_HERE ==
>> diff --git a/mm/vmscan.c b/mm/vmscan.c
>> index f73b865..cc23f04 100644
>> --- a/mm/vmscan.c
>> +++ b/mm/vmscan.c
>> @@ -1341,10 +1341,6 @@ static inline bool
>> should_reclaim_stall(unsigned long nr_taken,
>>        if (current_is_kswapd())
>>                return false;
>>
>> -       /* Only stall on lumpy reclaim */
>> -       if (sc->reclaim_mode & RECLAIM_MODE_SINGLE)
>> -               return false;
>> -
>>        /* If we have relaimed everything on the isolated list, no stall */
>>        if (nr_freed == nr_taken)
>>                return false;
>>
>>
>>
>> Then, if you don't see any unnecessary OOM but still see the hangup,
>> could you apply this patch based on previous?
>
> With this patch, I started GNOME and Firefox, turned on swap, and ran
> test_mempressure.sh 1500 1400 1.  Instant panic (or OOPS and hang or
> something -- didn't get the top part).  Picture attached -- it looks
> like memcg might be involved.  I'm running F15, so it might even be
> doing something.

I cannot figure out why happens OOPS.
Let me know your kernel version and config.
Kame. Is there anything related to memcg you guess?

In addition, the patch I give was utterly stupid.
The goal is that we wait dirty page writeback in (order-0 | high
priority) reclaim.
(But I don't think it's ideal solution in this problem but just for
proving the problem)
But although we pass sync with 1 in set_reclaim_mode, it ignores.
So fix is following as. (NOTICE: It doesn't related to your OOPS. )
But before further experiment, let's fix your oops.

diff --git a/mm/vmscan.c b/mm/vmscan.c
index 292582c..69d317e 100644
--- a/mm/vmscan.c
+++ b/mm/vmscan.c
@@ -311,7 +311,8 @@ static void set_reclaim_mode(int priority, struct
scan_control *sc,
         */
        if (sc->order > PAGE_ALLOC_COSTLY_ORDER)
                sc->reclaim_mode |= syncmode;
-       else if (sc->order && priority < DEF_PRIORITY - 2)
+       else if ((sc->order && priority < DEF_PRIORITY - 2) ||
+                               prioiry <= DEF_PRIORITY / 3)
                sc->reclaim_mode |= syncmode;
        else
                sc->reclaim_mode = RECLAIM_MODE_SINGLE | RECLAIM_MODE_ASYNC;
@@ -1349,10 +1350,6 @@ static inline bool
should_reclaim_stall(unsigned long nr_taken,
        if (current_is_kswapd())
                return false;

-       /* Only stall on lumpy reclaim */
-       if (sc->reclaim_mode & RECLAIM_MODE_SINGLE)
-               return false;
-
        /* If we have relaimed everything on the isolated list, no stall */
        if (nr_freed == nr_taken)
                return false;



>
> I won't be able to get netconsole dumps until next week because I'm
> out of town and only have this one computer here.

No problem. :)
We should avoid OOPS for the experiment.


>
> I haven't tried the other patch.
>
> Also, the !pgdat_balanced fix plus the if (need_resched()) return
> false patch just hung once on 2.6.37-rc9.  I don't know what triggered

Thanks for the good information.
It seems need_resched patch isn't good candidate to fix current problem.
We already weeded it out.

Thank you very much for the testing!

> it.  Maybe yum.
>
> --Andy
>



-- 
Kind regards,
Minchan Kim

--
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>

  parent reply	other threads:[~2011-05-19  2:54 UTC|newest]

Thread overview: 53+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <BANLkTi=XqROAp2MOgwQXEQjdkLMenh_OTQ@mail.gmail.com>
     [not found] ` <m2fwokj0oz.fsf@firstfloor.org>
     [not found]   ` <BANLkTikhj1C7+HXP_4T-VnJzPefU2d7b3A@mail.gmail.com>
     [not found]     ` <20110512054631.GI6008@one.firstfloor.org>
     [not found]       ` <BANLkTi=fk3DUT9cYd2gAzC98c69F6HXX7g@mail.gmail.com>
2011-05-14 15:46         ` Kernel falls apart under light memory pressure (i.e. linking vmlinux) Andrew Lutomirski
2011-05-14 16:53           ` Andi Kleen
     [not found]             ` <BANLkTik6SS9NH7XVSRBoCR16_5veY0MKBw@mail.gmail.com>
2011-05-14 17:43               ` Andi Kleen
2011-05-15  1:37                 ` Minchan Kim
2011-05-15 15:27                   ` Wu Fengguang
2011-05-15 15:59                     ` Andrew Lutomirski
2011-05-15 22:58                       ` Minchan Kim
2011-05-16  8:51                         ` Mel Gorman
2011-05-15 16:12                     ` Andrew Lutomirski
2011-05-17  6:00                       ` Wu Fengguang
2011-05-17  6:35                         ` Minchan Kim
2011-05-17 19:22                         ` Andrew Lutomirski
2011-05-18  5:17                           ` Minchan Kim
2011-05-19  2:15                             ` Andrew Lutomirski
2011-05-19  2:30                               ` KAMEZAWA Hiroyuki
2011-05-19  2:41                                 ` Andrew Lutomirski
2011-05-19  2:54                               ` Minchan Kim [this message]
2011-05-19 14:16                                 ` Andrew Lutomirski
2011-05-20  0:17                                   ` Minchan Kim
2011-05-20  2:58                                   ` Andrew Lutomirski
2011-05-20  3:12                                     ` KOSAKI Motohiro
2011-05-20  3:38                                       ` Andrew Lutomirski
2011-05-20  4:20                                         ` Minchan Kim
2011-05-20  5:08                                           ` KAMEZAWA Hiroyuki
2011-05-20  5:36                                             ` Minchan Kim
2011-05-20  7:43                                               ` KAMEZAWA Hiroyuki
2011-05-20 10:11                                             ` Andrea Arcangeli
2011-05-20 14:11                                               ` Andrew Lutomirski
2011-05-20 15:33                                                 ` Minchan Kim
2011-05-20 16:01                                                   ` Andrew Lutomirski
2011-05-20 16:19                                                     ` Minchan Kim
2011-05-20 18:09                                                       ` Andrew Lutomirski
2011-05-20 18:40                                                         ` Andrew Lutomirski
2011-05-21 12:04                                                         ` KOSAKI Motohiro
2011-05-21 13:34                                                           ` Andrew Lutomirski
2011-05-21 14:14                                                             ` KOSAKI Motohiro
2011-05-21 14:44                                                             ` Minchan Kim
2011-05-22 12:22                                                               ` Andrew Lutomirski
2011-05-22 23:12                                                                 ` Minchan Kim
2011-05-23 16:42                                                                   ` Andrea Arcangeli
2011-05-23 17:35                                                                     ` Mel Gorman
2011-05-24  1:19                                                                   ` Andrew Lutomirski
2011-05-24  1:34                                                                     ` Minchan Kim
2011-05-24 11:24                                                                       ` Andrew Lutomirski
2011-05-24 11:55                                                                         ` Andrew Lutomirski
2011-05-25  0:43                                                                           ` KOSAKI Motohiro
2011-05-21 14:31                                                           ` Minchan Kim
2011-05-19 14:51                             ` Wu Fengguang
2011-05-19 15:00                               ` Andrew Lutomirski
2011-05-20  0:20                               ` Minchan Kim
2011-05-15 22:40                     ` Minchan Kim
2011-05-17  5:52                       ` Wu Fengguang
2011-05-17  6:26                         ` 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=BANLkTima0hPrPwe_x06afAh+zTi-bOcRMg@mail.gmail.com \
    --to=minchan.kim@gmail.com \
    --cc=andi@firstfloor.org \
    --cc=fengguang.wu@intel.com \
    --cc=hannes@cmpxchg.org \
    --cc=kamezawa.hiroyu@jp.fujitsu.com \
    --cc=kosaki.motohiro@jp.fujitsu.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=luto@mit.edu \
    --cc=mgorman@suse.de \
    --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;
as well as URLs for NNTP newsgroup(s).