From: Andrew Morton <akpm@digeo.com>
To: Pavel Machek <pavel@ucw.cz>
Cc: Rik van Riel <riel@conectiva.com.br>,
kernel list <linux-kernel@vger.kernel.org>
Subject: Re: Good way to free as much memory as possible under 2.5.34?
Date: Sat, 14 Sep 2002 06:57:46 -0700 [thread overview]
Message-ID: <3D83405A.42B44825@digeo.com> (raw)
In-Reply-To: 20020914100549.GB816@atrey.karlin.mff.cuni.cz
Pavel Machek wrote:
>
> Hi!
>
> > > > Allocating memory is pain because I have to free it afterwards. Yep I
> > > > have such code, but it is ugly. try_to_free_pages() really seems like
> > > > cleaner solution to me... if you only tell me how to fix it :-).
> > >
> > > "Fixing" the VM just so it behaves the way swsuspend wants is
> > > out. If swsuspend relies on all other subsystems playing nicely,
> > > I think it should be removed from the kernel.
> > >
> >
> > Yup. Martin Bligh is cooking up a multi-page allocation API, so when that's
> > in place, swsusp need only do:
> >
> > LIST_HEAD(foo);
> > alloc_many_pages(&foo, nr_pages, __GFP_HIGHMEM|__GFP_WAIT);
> > free_many_pages(&foo);
> >
> > So I suggest you do something local for the while, plan to use that later.
> >
> > (Actually, the implementation would probably have a heart attack if you
> > asked for 100,000 pages so you may need to sit in a loop there;
> > we'll see).
>
> If nr_pages is > than number of pages really freable will it return
> NULL or stall the calling process forever?
Good point. In current Linus tree, it could be oom-killed. Later,
lack of __GFP_FS will prevent that. But it could loop forever.
I guess you'll need to drop the __GFP_WAIT and yield yourself, let
kswapd free the next batch of pages.
We need to do something more robust than this. I'll cook something up.
next prev parent reply other threads:[~2002-09-14 13:37 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2002-09-13 21:00 Good way to free as much memory as possible under 2.5.34? Pavel Machek
2002-09-13 21:09 ` Rik van Riel
2002-09-13 21:29 ` Pavel Machek
2002-09-13 21:33 ` Rik van Riel
2002-09-13 21:48 ` Xavier Bestel
2002-09-13 22:42 ` Rik van Riel
2002-09-13 23:26 ` Xavier Bestel
2002-09-13 21:53 ` Andrew Morton
2002-09-13 22:10 ` William Lee Irwin III
2002-09-14 10:05 ` Pavel Machek
2002-09-14 13:57 ` Andrew Morton [this message]
2002-09-14 14:51 ` Hans-Peter Jansen
2002-09-14 15:07 ` Rik van Riel
2002-09-14 15:11 ` Pavel Machek
2002-09-13 21:30 ` Andrew Morton
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=3D83405A.42B44825@digeo.com \
--to=akpm@digeo.com \
--cc=linux-kernel@vger.kernel.org \
--cc=pavel@ucw.cz \
--cc=riel@conectiva.com.br \
/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