mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Daniel Phillips <phillips@bonn-fries.net>
To: tommy@teatime.com.tw, Linux Kernel <linux-kernel@vger.kernel.org>
Cc: Ben LaHaise <bcrl@redhat.com>
Subject: Re: Memory Problem in 2.4.9 ?
Date: Wed, 22 Aug 2001 21:32:21 +0200	[thread overview]
Message-ID: <20010822192559Z16191-32383+888@humbolt.nl.linux.org> (raw)
In-Reply-To: <20010822124255.4DEE.TOMMY@teatime.com.tw>
In-Reply-To: <20010822124255.4DEE.TOMMY@teatime.com.tw>

On August 22, 2001 06:47 am, Tommy Wu wrote:
>    I've tried the patch in the kernel list. Got the result as following...
>    This message for command: 
>    dd if=/dev/zero of=test.dmp bs=1000k count=2500
>    on a PIII 1G SMP box with 1G RAM (HIGHMEM enabled)
>    kernel 2.4.9 with XFS filesystem patch.
>
> Aug 22 11:51:04 standby kernel: __alloc_pages: 0-order allocation failed
> (gfp=0x30/1).
> Aug 22 11:51:11 standby last message repeated 111 times

OK, this is a straight-up design bug.  Although this can also happen with 
normal memory, it's much more likely to happen with highmem because of heavy 
demand for bounce buffers while a process is in PF_MEMALLOC state.  You can 
just turn off highmem and these messages will go away, or become so rare that 
you are unlikely to ever see one.

Now lets chase the real problem.  The gfp=0x30 tells us the requestor is 
willing to wait (0x10) and that it is not allowed to do any io (0x40) or call 
->writepage (0x80).  (By process of elimination, it's a bounce buffer.) 
Furthermore, this is a recursive memory request (/1) so __alloc_pages won't 
call page_launder because that could hit another allocation request resulting 
in a fatal infinite recursion (note to self: why couldn't we call 
page_launder here, with NOIO?).

There are probably dirty pages in flight and __alloc_pages is allowed to wait 
for them, but it doesn't - it trys reclaim_page once (in 
__alloc_pages_limit), falls the rest of the way through __alloc_pages and 
gives up with NULL.  This is clearly a bad thing because whoever wanted the 
page needs it to do writeout.  Memory users are supposed to be able to 
tolerate alloc failure, but in a case like this, there isn't much choice 
other than to spin.

So what could we do better here?  Well, obviously when there are writeout 
pages in flight, __alloc_pages should wait and not give up.  Secondly, we 
should be sure that when writeout does complete, the newly freeable page is 
given to a PF_MEMALLOC waiter in preference to a normal user.  We don't have 
mechanisms in place for doing either of those things right now, although some 
preliminary design ideas have been discussed.  This gets way outside the 
bound of what we should be doing in 2.4, we will need such things as 
reservations (which Ben has done some work on) and orderly prioritization of 
requests in __alloc_pages, with explicit blocking for low priority requests.  

What can we do right now?  We could always just comment out the alloc failed 
message.  The result will be a lot of busy waiting on dirty page writeout 
which will work but it will keep us from focussing on the question: how did 
we get so short of bounce buffers?  Well, maybe we are submitting too much IO 
without intelligent throttling (/me waves at Ben).  That sounds like the 
place to attack first.

--
Daniel

  reply	other threads:[~2001-08-22 19:26 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-08-22  4:47 Tommy Wu
2001-08-22 19:32 ` Daniel Phillips [this message]
2001-08-22 19:05   ` Marcelo Tosatti
2001-08-23  1:11     ` Daniel Phillips
2001-08-23  0:10       ` Marcelo Tosatti
2001-08-23  2:29         ` Daniel Phillips
2001-08-23  1:19           ` Marcelo Tosatti
     [not found] <20010821174918Z16114-32383+718@humbolt.nl.linux.org>
2001-08-21 13:46 ` Stephan von Krawczynski
2001-08-21 14:33   ` Daniel Phillips
     [not found]     ` <20010821194140.43b46b10.skraw@ithnet.com>
2001-08-21 18:17       ` Stephan von Krawczynski
2001-08-21 19:10         ` Daniel Phillips
2001-08-22  0:04         ` Stephan von Krawczynski
2001-08-22  0:43           ` Daniel Phillips
2001-08-22  0:48             ` Rik van Riel
2001-08-22  1:13               ` Daniel Phillips
2001-08-22 11:01                 ` Stephan von Krawczynski
2001-08-22 17:22                   ` Mike Galbraith
2001-08-22 19:18                   ` Stephan von Krawczynski
2001-08-23  4:57                     ` Mike Galbraith
2001-08-22 10:43               ` Stephan von Krawczynski
2001-08-22 11:52         ` Stephan von Krawczynski

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=20010822192559Z16191-32383+888@humbolt.nl.linux.org \
    --to=phillips@bonn-fries.net \
    --cc=bcrl@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=tommy@teatime.com.tw \
    /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

all inboxes | Powered by JetHome®