linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Andrew Clausen <clausen@gnu.org>
To: "Benjamin C.R. LaHaise" <blah@kvack.org>
Cc: linux-mm@kvack.org, parted@gnu.org
Subject: Re: How much to malloc(), without running into swap...?
Date: Tue, 09 May 2000 18:01:24 +1000	[thread overview]
Message-ID: <3917C5D4.BF325355@gnu.org> (raw)
In-Reply-To: <Pine.LNX.3.96.1000509112748.16377C-100000@kanga.kvack.org>

"Benjamin C.R. LaHaise" wrote:
> > BTW, is /proc/meminfo a good idea?
> 
> That's probably your best bet if your app is the only thing running in the
> system.  Note that you'll get some feedback about things at mlock time --
> if there just isn't enough memory free, mlock() will fail, so you can use
> that to scale back your memory requirements if other parts of the system
> are eating memory.  With swapping, things get trickier -- you'll probably
> want to minimise the mlock()'d data.

Well, the idea is to maximize the mlock() data, ensuring that you don't
swap... OTOH, if it really must swap, then swap (parted) metadata, not
buffers.

mlock() has given me some ideas... thanks!

>  It would probably be better to avoid
> swapping altogether for your app since it would cause a ridiculous growth
> in the running time (and probably can be avoided).

Except on very low-memory systems, yes.

> You might want to look into using the raw devices when possible since you
> can probably make a better guess at the best way to order your io than the
> buffer cache currently will.  Doing that will also get the added benefit
> of avoiding any excess swapping that might be generated by competition for
> memory by the buffer cache.

Interesting.  But it isn't in standard 2.2.x, but it's something to look
to in the future...

There's also another side effect.  If it does run out of memory, it'll
split the IO into short chunks (i.e., do short read()s or write()s),
which obviously slows it down.

Thanks!
Andrew Clausen
--
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.eu.org/Linux-MM/

      reply	other threads:[~2000-05-09  8:01 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2000-05-06 10:15 Andrew Clausen
2000-05-09 15:36 ` Benjamin C.R. LaHaise
2000-05-09  8:01   ` Andrew Clausen [this message]

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=3917C5D4.BF325355@gnu.org \
    --to=clausen@gnu.org \
    --cc=blah@kvack.org \
    --cc=linux-mm@kvack.org \
    --cc=parted@gnu.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