aboutsummaryrefslogtreecommitdiff
path: root/mm/memcontrol.c
diff options
context:
space:
mode:
authorAlex Shi <alex.shi@linaro.org>2016-05-05 13:36:03 +0800
committerAlex Shi <alex.shi@linaro.org>2016-05-05 13:36:03 +0800
commite91b1cc90283c1b9b75670b027a18afbd20fe070 (patch)
tree81c395406a3774775a183d544aee9c5ced1c31d6 /mm/memcontrol.c
parentd83731cf53fd3af7173cab5e3f573d06ebc852be (diff)
parent0b3df30dcadcddc56aed56c3c2d2de2ca963e81d (diff)
Merge branch 'linux-linaro-lsk-v4.1' into linux-linaro-lsk-v4.1-rtlsk-v4.1-16.06-rtlsk-v4.1-16.05-rt
Diffstat (limited to 'mm/memcontrol.c')
-rw-r--r--mm/memcontrol.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/mm/memcontrol.c b/mm/memcontrol.c
index 9d2056ae8f82..ca9784f57a7b 100644
--- a/mm/memcontrol.c
+++ b/mm/memcontrol.c
@@ -5414,6 +5414,7 @@ static ssize_t memory_high_write(struct kernfs_open_file *of,
char *buf, size_t nbytes, loff_t off)
{
struct mem_cgroup *memcg = mem_cgroup_from_css(of_css(of));
+ unsigned long nr_pages;
unsigned long high;
int err;
@@ -5424,6 +5425,11 @@ static ssize_t memory_high_write(struct kernfs_open_file *of,
memcg->high = high;
+ nr_pages = page_counter_read(&memcg->memory);
+ if (nr_pages > high)
+ try_to_free_mem_cgroup_pages(memcg, nr_pages - high,
+ GFP_KERNEL, true);
+
memcg_wb_domain_size_changed(memcg);
return nbytes;
}