summaryrefslogtreecommitdiff
path: root/block/blk-mq.c
diff options
context:
space:
mode:
authorTejun Heo <tj@kernel.org>2015-09-29 20:04:26 +0300
committerJens Axboe <axboe@fb.com>2015-10-12 19:31:13 +0300
commitc5edf9cdc4c483b9a94c03fc0b9f769bd090bf3e (patch)
tree797d8c3edf45a4b84beee61426b98be8f77afc4e /block/blk-mq.c
parentd60d1bddd5b642711a237511845853755b25bf1f (diff)
downloadlinux-c5edf9cdc4c483b9a94c03fc0b9f769bd090bf3e.tar.xz
writeback: fix incorrect calculation of available memory for memcg domains
For memcg domains, the amount of available memory was calculated as min(the amount currently in use + headroom according to memcg, total clean memory) This isn't quite correct as what should be capped by the amount of clean memory is the headroom, not the sum of memory in use and headroom. For example, if a memcg domain has a significant amount of dirty memory, the above can lead to a value which is lower than the current amount in use which doesn't make much sense. In most circumstances, the above leads to a number which is somewhat but not drastically lower. As the amount of memory which can be readily allocated to the memcg domain is capped by the amount of system-wide clean memory which is not already assigned to the memcg itself, the number we want is the amount currently in use + min(headroom according to memcg, clean memory elsewhere in the system) This patch updates mem_cgroup_wb_stats() to return the number of filepages and headroom instead of the calculated available pages. mdtc_cap_avail() is renamed to mdtc_calc_avail() and performs the above calculation from file, headroom, dirty and globally clean pages. v2: Dummy mem_cgroup_wb_stats() implementation wasn't updated leading to build failure when !CGROUP_WRITEBACK. Fixed. Signed-off-by: Tejun Heo <tj@kernel.org> Fixes: c2aa723a6093 ("writeback: implement memcg writeback domain based throttling") Signed-off-by: Jens Axboe <axboe@fb.com>
Diffstat (limited to 'block/blk-mq.c')
0 files changed, 0 insertions, 0 deletions