From: Stephen Satchell <satch@fluent-access.com>
To: <linux-kernel@vger.kernel.org>
Subject: Re: Ongoing 2.4 VM suckage
Date: Sat, 04 Aug 2001 00:21:11 -0700 [thread overview]
Message-ID: <4.3.2.7.2.20010803225855.00bc2a60@mail.fluent-access.com> (raw)
In-Reply-To: <Pine.LNX.4.33L.0108031907220.11893-100000@imladris.rielhom e.conectiva>
In-Reply-To: <007801c11c67$87d55980$b6562341@cfl.rr.com>
At 07:08 PM 8/3/01 -0300, you wrote:
>On Fri, 3 Aug 2001, Mike Black wrote:
>
> > Couldn't kswapd just gracefully back-off when it doesn't make any
> > progress? In my case (with ext3/raid5 and a tiobench test) kswapd
> > NEVER actually swaps anything out. It just chews CPU time.
>
> > So...if kswapd just said "didn't make any progress...*2 last sleep" so
> > it would degrade itself.
>
>It wouldn't just degrade itself.
>
>It would also prevent other programs in the system
>from allocating memory, effectively halting anybody
>wanting to allocate memory.
(Summary: alternate view of the sleepy-kswapd suggestion, and a pointer to
sysinfo(2) for userland programs to avoid allocating too much memory.)
While the idea halts other programs trying to allocate memory, it would
provide cycles to programs that want to RELEASE memory (such as consuming
data in network buffers) and thus reduce the kswapd thumb-twiddling time.
This is especially important when a piggy process is written to use the
sysinfo(2) call to monitor resource usage. (Reminder: sysinfo(2) is
specific to Linux, and therefore not portable.) There is no reason that a
process that is a memory hog can't "play nice in the neighborhood".
A full treatment is off-topic for this list, but a brief summary would be
useful: the piggy process would monitor its own memory usage by doing
bookkeeping on its malloc(2) and free(2) calls. It would monitor via
sysinfo(2) the amount of swap space remaining, and determine the percentage
of swap space the piggy process is using.
The piggy process would have a low-water mark for memory usage (it could be
a fixed amount such as 4 MB, or it could be a percentage of the available
swap space, say 5%) which it would feel free to allocate at any time. The
piggy process would also have a high-water mark for memory usage, say 70%
of swap space.
As the piggy process continues to execute, it monitors sysinfo(2). If the
system's free swap space falls below a threshold (say the larger of 15% or
5 MB), the process will begin to shed memory allocations to free up space
down to its low-water mark. The intent here is that if two or more piggy
processes are launched, they won't overload the system and kill each other
via the OOM killer.
Mr. Baker, it's wonderful to say "Hey, the SYSTEM should take care of
that." The problem is, the userland application is as much a part of the
system as the Linux kernel is. All the kernel can do is try to minimize
the carnage when two processes have a head-on collision. It's up to the
userland processes to avoid the collision in the first place.
To the rest of the kernel list: apologies for taking up so much space with
a userland issue. The thing is, in the months I've seen the VM problem
discussed, and the "zillionth person to complain about it," I haven't seen
any pointer to any discussion about how userland programs can insulate
themselves from being killed when they try to use up too much
RAM. Commercial quality programs, and programs wanting to use as much of
the resources as possible to minimize run times, need to monitor what they
are doing to the system and pull back when they tread toward suicide.
Put another way, people should NOT use safety nets as the only means of
breaking a fall.
Satch
next prev parent reply other threads:[~2001-08-04 7:21 UTC|newest]
Thread overview: 41+ messages / expand[flat|nested] mbox.gz Atom feed top
2001-08-02 18:29 Ongoing 2.4 VM suckage Jeffrey W. Baker
2001-08-02 18:52 ` Richard B. Johnson
2001-08-02 19:10 ` Jeffrey W. Baker
2001-08-02 19:54 ` Richard B. Johnson
2001-08-02 20:10 ` Jeffrey W. Baker
2001-08-02 20:16 ` Rik van Riel
2001-08-02 20:28 ` Rik van Riel
2001-08-03 17:59 ` David Ford
2001-08-03 20:53 ` Rik van Riel
2001-08-03 21:59 ` Mike Black
2001-08-03 22:08 ` Rik van Riel
2001-08-04 1:06 ` Daniel Phillips
2001-08-03 23:58 ` [PATCH] Disable kswapd through proc (was Ongoing 2.4 VM suckage) Daniel Phillips
2001-08-04 7:21 ` Stephen Satchell [this message]
2001-08-06 8:55 ` Ongoing 2.4 VM suckage Helge Hafting
2001-08-06 16:37 ` Jeremy Linton
2001-08-07 7:51 ` David Weinehall
2001-08-03 22:47 ` David Ford
2001-08-02 21:01 ` Richard B. Johnson
2001-08-02 21:11 ` Jeffrey W. Baker
2001-08-02 21:44 ` Jakob Østergaard
2001-08-02 21:52 ` Jeffrey W. Baker
2001-08-02 21:56 ` Miles Lane
2001-08-02 22:05 ` Jeffrey W. Baker
2001-08-02 22:07 ` Rik van Riel
2001-08-02 22:17 ` Jeffrey W. Baker
2001-08-02 22:27 ` Rik van Riel
2001-08-02 22:32 ` Jeffrey W. Baker
2001-08-02 22:56 ` BERECZ Szabolcs
2001-08-03 13:07 ` jlnance
2001-08-03 13:31 ` Richard B. Johnson
2001-08-06 13:22 ` Luigi Genoni
2001-08-06 13:29 ` David S. Miller
2001-08-02 23:46 ` Ongoing 2.4 VM suckage pagemap_lru_lock Jeremy Linton
2001-08-02 22:15 ` Ongoing 2.4 VM suckage Pavel Zaitsev
2001-08-02 22:20 ` Jakob Østergaard
2001-08-03 12:04 ` Anders Peter Fugmann
2001-08-03 16:03 ` Rik van Riel
2001-08-03 16:24 ` Anders Peter Fugmann
2001-08-03 21:24 ` Rik van Riel
2001-08-03 22:00 ` Anders Peter Fugmann
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=4.3.2.7.2.20010803225855.00bc2a60@mail.fluent-access.com \
--to=satch@fluent-access.com \
--cc=linux-kernel@vger.kernel.org \
/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