Commit e5598f8b authored by Hugh Dickins's avatar Hugh Dickins Committed by Linus Torvalds

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: default avatarHugh Dickins <hughd@google.com>
Acked-by: default avatarKAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
Acked-by: default avatarBalbir Singh <balbir@linux.vnet.ibm.com>
Acked-by: default avatarDaisuke Nishimura <nishimura@mxp.nes.nec.co.jp>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 8eac563c
...@@ -225,6 +225,7 @@ void truncate_inode_pages_range(struct address_space *mapping, ...@@ -225,6 +225,7 @@ void truncate_inode_pages_range(struct address_space *mapping,
next = start; next = start;
while (next <= end && while (next <= end &&
pagevec_lookup(&pvec, mapping, next, PAGEVEC_SIZE)) { pagevec_lookup(&pvec, mapping, next, PAGEVEC_SIZE)) {
mem_cgroup_uncharge_start();
for (i = 0; i < pagevec_count(&pvec); i++) { for (i = 0; i < pagevec_count(&pvec); i++) {
struct page *page = pvec.pages[i]; struct page *page = pvec.pages[i];
pgoff_t page_index = page->index; pgoff_t page_index = page->index;
...@@ -247,6 +248,7 @@ void truncate_inode_pages_range(struct address_space *mapping, ...@@ -247,6 +248,7 @@ void truncate_inode_pages_range(struct address_space *mapping,
unlock_page(page); unlock_page(page);
} }
pagevec_release(&pvec); pagevec_release(&pvec);
mem_cgroup_uncharge_end();
cond_resched(); cond_resched();
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment