2011-02-24 05:44:36

by Hugh Dickins

[permalink] [raw]
Subject: [PATCH] memcg: more mem_cgroup_uncharge batching

It seems odd that truncate_inode_pages_range(), called not only when
truncating but also when evicting inodes, has mem_cgroup_uncharge_start
and _end() batching in its second loop to clear up a few leftovers, but
not in its first loop that does almost all the work: add them there too.

Signed-off-by: Hugh Dickins <[email protected]>
---

mm/truncate.c | 2 ++
1 file changed, 2 insertions(+)

--- 2.6.38-rc6/mm/truncate.c 2011-01-21 20:54:14.000000000 -0800
+++ linux/mm/truncate.c 2011-02-23 16:12:19.000000000 -0800
@@ -225,6 +225,7 @@ void truncate_inode_pages_range(struct a
next = start;
while (next <= end &&
pagevec_lookup(&pvec, mapping, next, PAGEVEC_SIZE)) {
+ mem_cgroup_uncharge_start();
for (i = 0; i < pagevec_count(&pvec); i++) {
struct page *page = pvec.pages[i];
pgoff_t page_index = page->index;
@@ -247,6 +248,7 @@ void truncate_inode_pages_range(struct a
unlock_page(page);
}
pagevec_release(&pvec);
+ mem_cgroup_uncharge_end();
cond_resched();
}


2011-02-24 05:56:46

by Kamezawa Hiroyuki

[permalink] [raw]
Subject: Re: [PATCH] memcg: more mem_cgroup_uncharge batching

On Wed, 23 Feb 2011 21:44:33 -0800 (PST)
Hugh Dickins <[email protected]> wrote:

> It seems odd that truncate_inode_pages_range(), called not only when
> truncating but also when evicting inodes, has mem_cgroup_uncharge_start
> and _end() batching in its second loop to clear up a few leftovers, but
> not in its first loop that does almost all the work: add them there too.
>
> Signed-off-by: Hugh Dickins <[email protected]>

Thank you.
Acked-by: KAMEZAWA Hiroyuki <[email protected]>

2011-02-24 06:20:07

by Balbir Singh

[permalink] [raw]
Subject: Re: [PATCH] memcg: more mem_cgroup_uncharge batching

* Hugh Dickins <[email protected]> [2011-02-23 21:44:33]:

> It seems odd that truncate_inode_pages_range(), called not only when
> truncating but also when evicting inodes, has mem_cgroup_uncharge_start
> and _end() batching in its second loop to clear up a few leftovers, but
> not in its first loop that does almost all the work: add them there too.
>
> Signed-off-by: Hugh Dickins <[email protected]>
> ---


Acked-by: Balbir Singh <[email protected]>


--
Three Cheers,
Balbir

2011-02-24 06:53:57

by Daisuke Nishimura

[permalink] [raw]
Subject: Re: [PATCH] memcg: more mem_cgroup_uncharge batching

On Wed, 23 Feb 2011 21:44:33 -0800 (PST)
Hugh Dickins <[email protected]> wrote:

> It seems odd that truncate_inode_pages_range(), called not only when
> truncating but also when evicting inodes, has mem_cgroup_uncharge_start
> and _end() batching in its second loop to clear up a few leftovers, but
> not in its first loop that does almost all the work: add them there too.
>
> Signed-off-by: Hugh Dickins <[email protected]>
Thank you catching this. This patch has already got enough ack's, but anyway:

Acked-by: Daisuke Nishimura <[email protected]>

P.S.
My address is "[email protected]", not "[email protected]" :)