linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* memo: mem+swap controller
@ 2008-07-31  1:15 KAMEZAWA Hiroyuki
  2008-07-31  6:18 ` KOSAKI Motohiro
                   ` (2 more replies)
  0 siblings, 3 replies; 19+ messages in thread
From: KAMEZAWA Hiroyuki @ 2008-07-31  1:15 UTC (permalink / raw)
  To: nishimura; +Cc: kamezawa.hiroyu, balbir, hugh, linux-mm, menage, Andrew Morton

Hi, mem+swap controller is suggested by Hugh Dickins and I think it's a great
idea. Its concept is having 2 limits. (please point out if I misunderstand.)

 - memory.limit_in_bytes       .... limit memory usage.
 - memory.total_limit_in_bytes .... limit memory+swap usage.

By this, we can avoid excessive use of swap under a cgroup without any bad effect
to global LRU. (in page selection algorithm...overhead will be added, of course)

Following is state transition and counter handling design memo.
This uses "3" counters to handle above conrrectly. If you have other logic,
please teach me. (and blame me if my diagram is broken.)

A point is how to handle swap-cache, I think.
(Maybe we need a _big_ change in memcg.)

==

state definition
  new alloc  .... an object is newly allocated
  no_swap    .... an object with page without swp_entry
  swap_cache .... an object with page with swp_entry
  disk_swap  .... an object without page with swp_entry
  freed      .... an object is freed (by munmap)

(*) an object is an enitity which is accoutned, page or swap.

 new alloc ->  no_swap  <=>  swap_cache  <=>  disk_swap
                 |             |                 |
  freed.   <-----------<-------------<-----------

use 3 counters, no_swap, swap_cache, disk_swap.

    on_memory = no_swap + swap_cache.
    total     = no_swap + swap_cache + disk_swap

on_memory is limited by memory.limit_in_bytes
total     is limtied by memory.total_limit_in_bytes.

                     no_swap  swap_cache  disk_swap  on_memory  total
new alloc->no_swap     +1         -           -         +1        +1
no_swap->swap_cache    -1        +1           -         -         -
swap_cache->no_swap    +1        -1           -         -         -
swap_cache->disk_swap  -         -1           +1        -1        -
disk_swap->swap_cache  -         +1           -1        +1        -
no_swap->freed         -1        -            -         -1        -1
swap_cache->freed      -         -1           -         -1        -1
disk_swap->freed       -         -            -1        -         -1


any comments are welcome.

Regards,
-Kame




--
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-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

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

end of thread, other threads:[~2008-09-09 14:07 UTC | newest]

Thread overview: 19+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-07-31  1:15 memo: mem+swap controller KAMEZAWA Hiroyuki
2008-07-31  6:18 ` KOSAKI Motohiro
2008-07-31  6:25 ` Daisuke Nishimura
2008-07-31  6:51   ` KAMEZAWA Hiroyuki
2008-07-31 13:03     ` Daisuke Nishimura
2008-07-31 16:31     ` kamezawa.hiroyu
2008-08-01  3:05       ` Daisuke Nishimura
2008-08-01  3:28   ` Balbir Singh
2008-08-01  4:02     ` Daisuke Nishimura
2008-08-01  4:13       ` Balbir Singh
2008-08-01  4:57         ` Daisuke Nishimura
2008-08-01  5:07         ` memcg swappiness (Re: memo: mem+swap controller) YAMAMOTO Takashi
2008-08-01  5:25           ` Balbir Singh
2008-08-01  6:37             ` YAMAMOTO Takashi
2008-08-01  6:46               ` Balbir Singh
2008-09-09  9:17                 ` YAMAMOTO Takashi
2008-09-09 14:07                   ` Balbir Singh
2008-08-01  3:20 ` memo: mem+swap controller Balbir Singh
2008-08-01  3:45   ` KAMEZAWA Hiroyuki

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