Re: lug-bg: Mem usage Linux&Windows
- Subject: Re: lug-bg: Mem usage Linux&Windows
- From: danchev@xxxxxxxxx (George Danchev)
- Date: Sun, 9 Feb 2003 14:19:40 +0200
On 08 02 2003 17:01, Georgi Chorbadzhiyski wrote:
> Valentin Tzankov wrote:
> > V tova si prav che ne razbiram ot Kernel-i
> > i ne go i tvyrda,
> > kswapd swap po 5 stranitzi na sybujdane,
e ne e bash taka ... ;-)
> > pone az taka go cheta tozi code v 2.4.19, no tova e bez znachenie.
> http://www.csn.ul.ie/~mel/projects/vm/
tozi doc e zabelezhitelen, ne go znaeh... Congrats !!! Neznam kolko hora ste
go poglednat, no si zasluzhava opredeleno ..... Imam predvid:
"Understanding the Linux Memory Manager" i
"Code Commentary on the Linux Virtual Memory Manager
Ta, mnogo leko summary otnosno zasegnatiq vypros za swapping-a i po princip:
3.2.1 Zone Watermarks
When available memory in the system is low, the pageout daemon kswapd is
woken up to start freeing up pages (See Chapter 11). If memory gets too
low, the process will free up memory synchronously. The parameters
affecting pageout behavior are similar to those by FreeBSD[#!mckusick96!#]
and Solaris[#!mauro01!#].
Each zone has watermarks which help track how much pressure a zone is
under. They are pages_low, pages_min and pages_high. The number of pages
for pages_min is calculated in the function free_area_init_core() during
memory init and is based on a ratio to the size of the zone in pages. It
is calculated initially as $ZoneSizeInPages / 128$. The lowest value it
will be is 20 pages (80K on a x86) and the highest possible value is 255
pages (1MiB on a x86).
............
10.1 Page Swap Daemon (kswapd)
At system start, a kernel thread called kswapd is started from
kswapd_init() which continuously executes the function kswapd() in
mm/vmscan.c that usually sleeps. This daemon is responsible for reclaiming
pages when memory is running low. Historically, kswapd used to wake up
every 10 seconds but now it is only woken by the physical page allocator
when the pages_low number of free pages in a zone is reached (See Section
3.2.1).
............
10.8 Swapping Out Process Pages
When the max_mapped number of pages has been found in the page cache,
swap_out() (See Figure 11.4) is called to start swapping out process
pages. Starting from the mm pointed to by swap_mm and the address
mm>swap_address, the page tables are searched forward until
nr_pages have been freed.
\includegraphics[width=5cm]{graphs/swap_out.ps}
Figure: Call Graph: swap_out
All pages are examined regardless of where they are in the lists or when
they were last referenced but pages which are part of the active_list or
have been recently referenced will be skipped over. The examination of hot
pages is a bit costly but nothing in comparison to linearly searching all
processes for the PTE's that reference a particular struct page.
Once it has been decided to swap out pages from a process, an attempt will
be made to swap out at least SWAP_CLUSTER number of pages and the full
list of mm_struct's will only be examined once so avoid constant looping
when no pages are available. Writing out the pages in bulk like this
increases the chance that pages close together in the process address
space will be written out to adjacent slots on disk.
11.. ....
Tova na kernel level... sega koj kvi prilozheniq si pishe za user space i
kolko pamet iskat si e druga rabota... kernela prosto gi obsluzhva po na4in
asimptoti4noklonqst kym perfect... S dve dumi ne se zaka4ajte s 2.4/mm stock
VM (developed by dosta scientific people i maintained by Andrew Morton's bk
tree) tq respektira dosta commercial OS implementations i ste vi otnese
kazano s tri dumi ... rmap tree na RvR e tema na syvsem drug flamewar.
E, bih popital az takiva raboti zasto ne se prepodavat na studentite v SU i
MEI po syotvetnite disciplini ... Otgovor: malko sa studentie i
prepodavatelite koito znaqt za kakvo ide re4, i nikoj ne gi slusha tqh...
Propodavat se bozi, bozi, bozi, i nakraq nisto ... (s redki izklu4eniq, no te
prolet ne pravqt ..... )...
--
Greets,
fr33zb1
============================================================================
A mail-list of Linux Users Group - Bulgaria (bulgarian linuxers).
http://www.linux-bulgaria.org - Hosted by Internet Group Ltd. - Stara Zagora
To unsubscribe: http://www.linux-bulgaria.org/public/mail_list.html
============================================================================
|