mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* Correctly determine amount of "free memory"
@ 2004-12-06 14:53 Gregory Giguashvili
  2004-12-06 15:16 ` bert hubert
  2004-12-06 18:26 ` David Schwartz
  0 siblings, 2 replies; 8+ messages in thread
From: Gregory Giguashvili @ 2004-12-06 14:53 UTC (permalink / raw)
  To: linux-kernel

Hi,

Assuming that I define "free memory" as maximum memory that can be
allocated without causing swapping, is there a way I can give the best
"free memory" amount estimate?

I've tried to play with /proc/meminfo values with some progress, but I'd
like to get a qualified answer from people working with VM bits and
bytes.

Thanks a lot
Giga

^ permalink raw reply	[flat|nested] 8+ messages in thread
* RE: Correctly determine amount of "free memory"
@ 2004-12-06 15:57 Gregory Giguashvili
  2004-12-06 16:10 ` bert hubert
  0 siblings, 1 reply; 8+ messages in thread
From: Gregory Giguashvili @ 2004-12-06 15:57 UTC (permalink / raw)
  To: bert hubert; +Cc: linux-kernel

> On the side, it would not hurt to study 'overcommit' and mlock(2). The
answer to your question is > not static unless care is taken. 
I'm using mlock(2), but the problem is that I need to allocate as much
memory as possible without causing swapping, so I need to have _rough_
estimate before actually allocating the memory.

Thanks,
Giga

^ permalink raw reply	[flat|nested] 8+ messages in thread
* RE: Correctly determine amount of "free memory"
@ 2004-12-06 17:04 Gregory Giguashvili
  0 siblings, 0 replies; 8+ messages in thread
From: Gregory Giguashvili @ 2004-12-06 17:04 UTC (permalink / raw)
  To: bert hubert; +Cc: linux-kernel

> I think a guy called 'Ben' from google went over this a couple of
years ago, the discussion might 
> still be relevant. His email address contained 'google.com' and he
posted on lkml.

Is http://www.cs.helsinki.fi/linux/linux-kernel/2001-43/0661.html what
you mean? If so, it is about mlock problems in 2.4.9 kernels.
Unfortunatelly, they don't discuss available memory issue even though
it's mentioned a couple of times.

Thanks 
Giga

^ permalink raw reply	[flat|nested] 8+ messages in thread
* RE: Correctly determine amount of "free memory"
@ 2004-12-06 19:00 Gregory Giguashvili
  0 siblings, 0 replies; 8+ messages in thread
From: Gregory Giguashvili @ 2004-12-06 19:00 UTC (permalink / raw)
  To: linux-kernel

> That's not really a meaningful question. 
Sorry, I did my best :)

> The qualified answer is that /proc/meminfo gives you the available
information and what number 
> you want depends upon what you plan to do with it. Swapping is not
necessarily the right metric 
> for two reasons.
I plan to commit the largest chunk of memory in the quickest way. This
operation may be slowed down by swapping - that's why I don't want to
get there. If swapping is not the right metric, what is then? 

According to my humble experiments with 2.4 and 2.6 kernels, some cashed
memory reported in /proc/meminfo is reused and some is swapped. The real
problem here is that I couldn't find the right way to "predict" how much
cached memory will be discarded before starting to swap when system is
low on available RAM.

Thanks
Giga

^ permalink raw reply	[flat|nested] 8+ messages in thread
* RE: Correctly determine amount of "free memory"
@ 2004-12-07 15:58 Gregory Giguashvili
  0 siblings, 0 replies; 8+ messages in thread
From: Gregory Giguashvili @ 2004-12-07 15:58 UTC (permalink / raw)
  To: linux-kernel

Experimenting with my simple memory allocation program for little more
time, I found that Free=MemTotal-Active gives kind of rough
approximation to the "free" memory amount. Can I make it somehow better?

What about SwapCached or Inact_target? Are there any pointers to the
information I might find useful on this subject other than
http://www.redhat.com/advice/tips/meminfo.html?

Thanks 
Giga
P.S. I need this to work with 2.4.19+ and 2.6 kernels...

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2004-12-07 16:01 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-12-06 14:53 Correctly determine amount of "free memory" Gregory Giguashvili
2004-12-06 15:16 ` bert hubert
2004-12-06 18:26 ` David Schwartz
2004-12-06 15:57 Gregory Giguashvili
2004-12-06 16:10 ` bert hubert
2004-12-06 17:04 Gregory Giguashvili
2004-12-06 19:00 Gregory Giguashvili
2004-12-07 15:58 Gregory Giguashvili

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome