| From: |
| KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com> |
| To: |
| "linux-mm@kvack.org" <linux-mm@kvack.org> |
| Subject: |
| [PATCH 0/4] memcg fix swap accounting (28/May) |
| Date: |
| Thu, 28 May 2009 13:54:55 +0900 |
| Message-ID: |
| <20090528135455.0c83bedc.kamezawa.hiroyu@jp.fujitsu.com> |
| Cc: |
| "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"nishimura@mxp.nes.nec.co.jp" <nishimura@mxp.nes.nec.co.jp>,
"balbir@linux.vnet.ibm.com" <balbir@linux.vnet.ibm.com>,
"hugh.dickins@tiscali.co.uk" <hugh.dickins@tiscali.co.uk>,
"hannes@cmpxchg.org" <hannes@cmpxchg.org>,
"akpm@linux-foundation.org" <akpm@linux-foundation.org> |
| Archive-link: |
| Article, Thread
|
Removed "RFC"
This patch series is restructured as following. some bugs are fixed.
Thank you for all your helps.
[1/4] ....change interface of swap_duplicate()/swap_free()
Adds an function swapcache_prepare() and swapcache_free().
[2/4] ....add SWAP_HAS_CACHE flag and modify reference counting in swap_map
Add SWAP_HAS_CACHE flag to swap_map array for knowing an information that
"there is an only swap cache and swap has no reference"
without extra call of find_get_page().
[3/4] ....reclaim swap-cache-only swap_entry when get_swap_page() find it.
Now, swap_map can tell "there is no reference other than cache", we
can reclaim it if necessary.
This code reclaim swap entries if
- vm_swap_full()==ture
&& there is no free swap cluster
&& get_swap_page() finds unused swap entry.
[4/4].... fix memcg's swap accounting
This is for fixing memcg's swap account leak. like this
==
processA | processB
-------------------------------------+-------------------------------------
(free_swap_and_cache()) | (read_swap_cache_async())
| swap_duplicate()
| __set_page_locked()
| add_to_swap_cache()
swap_entry_free() == 0 |
find_get_page() -> found |
try_lock_page() -> fail & return |
| lru_cache_add_anon()
| doesn't link this page to memcg's
| LRU, because of !PageCgroupUsed.
==
This patch tries to fix this by uncharging account when swap's refcnt goes
to 0 even if there is an unused swap-cache.
Works quite well in my test.
Thanks,
-Kame
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/