[Devel,RHEL7,COMMIT] ms/mm/memcontrol.c: fix order calculation in try_charge()

Submitted by Konstantin Khorenko on March 31, 2017, 3:13 p.m.

Details

Message ID 201703311513.v2VFDKi5001920@finist_cl7.x64_64.work.ct
State New
Series "Series without cover letter"
Headers show

Commit Message

Konstantin Khorenko March 31, 2017, 3:13 p.m.
The commit is pushed to "branch-rh7-3.10.0-514.10.2.vz7.29.x-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh7-3.10.0-514.10.2.vz7.29.9
------>
commit fe3be9154705fefb749e744ba5782a68ce7710b3
Author: Andrey Ryabinin <aryabinin@virtuozzo.com>
Date:   Fri Mar 31 19:13:20 2017 +0400

    ms/mm/memcontrol.c: fix order calculation in try_charge()
    
    commit 3608de0787e51d3d826656e105524b48ade7b16f upstream.
    
    Since commit 6539cc053869 ("mm: memcontrol: fold mem_cgroup_do_charge()"),
    the order to pass to mem_cgroup_oom() is calculated by passing the
    number of pages to get_order() instead of the expected size in bytes.
    AFAICT, it only affects the value displayed in the oom warning message.
    This patch fix this.
    
    Michal said:
    
    : We haven't noticed that just because the OOM is enabled only for page
    : faults of order-0 (single page) and get_order work just fine.  Thanks for
    : noticing this.  If we ever start triggering OOM on different orders this
    : would be broken.
    
    Signed-off-by: Jerome Marchand <jmarchan@redhat.com>
    Acked-by: Michal Hocko <mhocko@suse.com>
    Acked-by: Johannes Weiner <hannes@cmpxchg.org>
    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
    Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
    
    https://jira.sw.ru/browse/PSBM-62827
    Signed-off-by: Andrey Ryabinin <aryabinin@virtuozzo.com>
---
 mm/memcontrol.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Patch hide | download patch | download mbox

diff --git a/mm/memcontrol.c b/mm/memcontrol.c
index 1999dff..30ea89a 100644
--- a/mm/memcontrol.c
+++ b/mm/memcontrol.c
@@ -2811,7 +2811,7 @@  retry:
 	if (fatal_signal_pending(current))
 		goto bypass;
 
-	mem_cgroup_oom(mem_over_limit, gfp_mask, get_order(batch));
+	mem_cgroup_oom(mem_over_limit, gfp_mask, get_order(batch * PAGE_SIZE));
 	mem_cgroup_inc_failcnt(mem_over_limit, gfp_mask, nr_pages);
 
 nomem: