lkml.org 
[lkml]   [2009]   [Aug]   [31]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [RFC][PATCH 3/5] memcg: unmap, truncate, invalidate uncharege in batch
* KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com> [2009-08-28 13:25:42]:

>
> We can do batched uncharge when
> - invalidate/truncte file
> - unmap range of pages.
>
> This means we don't do "batched" uncharge in memory reclaim path.
> I think it's reasonable.
>
> Signed-off-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
> ---
> mm/memory.c | 2 ++
> mm/truncate.c | 6 ++++++
> 2 files changed, 8 insertions(+)
>
> Index: mmotm-2.6.31-Aug27/mm/memory.c
> ===================================================================
> --- mmotm-2.6.31-Aug27.orig/mm/memory.c
> +++ mmotm-2.6.31-Aug27/mm/memory.c
> @@ -909,6 +909,7 @@ static unsigned long unmap_page_range(st
> details = NULL;
>
> BUG_ON(addr >= end);
> + mem_cgroup_uncharge_batch_start();
> tlb_start_vma(tlb, vma);
> pgd = pgd_offset(vma->vm_mm, addr);
> do {
> @@ -921,6 +922,7 @@ static unsigned long unmap_page_range(st
> zap_work, details);
> } while (pgd++, addr = next, (addr != end && *zap_work > 0));
> tlb_end_vma(tlb, vma);
> + mem_cgroup_uncharge_batch_end();
>
> return addr;
> }
> Index: mmotm-2.6.31-Aug27/mm/truncate.c
> ===================================================================
> --- mmotm-2.6.31-Aug27.orig/mm/truncate.c
> +++ mmotm-2.6.31-Aug27/mm/truncate.c
> @@ -272,6 +272,7 @@ void truncate_inode_pages_range(struct a
> pagevec_release(&pvec);
> break;
> }
> + mem_cgroup_uncharge_batch_start();
> for (i = 0; i < pagevec_count(&pvec); i++) {
> struct page *page = pvec.pages[i];
>
> @@ -286,6 +287,7 @@ void truncate_inode_pages_range(struct a
> unlock_page(page);
> }
> pagevec_release(&pvec);
> + mem_cgroup_uncharge_batch_end();
> }
> }
> EXPORT_SYMBOL(truncate_inode_pages_range);
> @@ -327,6 +329,7 @@ unsigned long invalidate_mapping_pages(s
> pagevec_init(&pvec, 0);
> while (next <= end &&
> pagevec_lookup(&pvec, mapping, next, PAGEVEC_SIZE)) {
> + mem_cgroup_uncharge_batch_start();
> for (i = 0; i < pagevec_count(&pvec); i++) {
> struct page *page = pvec.pages[i];
> pgoff_t index;
> @@ -354,6 +357,7 @@ unsigned long invalidate_mapping_pages(s
> break;
> }
> pagevec_release(&pvec);
> + mem_cgroup_uncharge_batch_end();
> cond_resched();
> }
> return ret;
> @@ -428,6 +432,7 @@ int invalidate_inode_pages2_range(struct
> while (next <= end && !wrapped &&
> pagevec_lookup(&pvec, mapping, next,
> min(end - next, (pgoff_t)PAGEVEC_SIZE - 1) + 1)) {
> + mem_cgroup_uncharge_batch_start();
> for (i = 0; i < pagevec_count(&pvec); i++) {
> struct page *page = pvec.pages[i];
> pgoff_t page_index;
> @@ -477,6 +482,7 @@ int invalidate_inode_pages2_range(struct
> unlock_page(page);
> }
> pagevec_release(&pvec);
> + mem_cgroup_uncharge_batch_end();
> cond_resched();
> }
> return ret;
>

This looks good to me


--
Balbir


\
 
 \ /
  Last update: 2009-08-31 13:05    [W:0.101 / U:15.804 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site