diff options
author | Jerome Marchand <jmarchan@redhat.com> | 2015-11-05 21:47:29 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2015-11-05 22:34:48 -0500 |
commit | 3608de0787e51d3d826656e105524b48ade7b16f (patch) | |
tree | 57acacb92f952f5633a4cc31bf92712f818d2a61 /mm/memcontrol.c | |
parent | a5f65109026b35b654b94fdcd26a971185a53adc (diff) |
mm/memcontrol.c: fix order calculation in try_charge()
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>
Diffstat (limited to 'mm/memcontrol.c')
-rw-r--r-- | mm/memcontrol.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/mm/memcontrol.c b/mm/memcontrol.c index b952abef6ff0..a1c05ff5892d 100644 --- a/mm/memcontrol.c +++ b/mm/memcontrol.c | |||
@@ -2094,7 +2094,8 @@ retry: | |||
2094 | 2094 | ||
2095 | mem_cgroup_events(mem_over_limit, MEMCG_OOM, 1); | 2095 | mem_cgroup_events(mem_over_limit, MEMCG_OOM, 1); |
2096 | 2096 | ||
2097 | mem_cgroup_oom(mem_over_limit, gfp_mask, get_order(nr_pages)); | 2097 | mem_cgroup_oom(mem_over_limit, gfp_mask, |
2098 | get_order(nr_pages * PAGE_SIZE)); | ||
2098 | nomem: | 2099 | nomem: |
2099 | if (!(gfp_mask & __GFP_NOFAIL)) | 2100 | if (!(gfp_mask & __GFP_NOFAIL)) |
2100 | return -ENOMEM; | 2101 | return -ENOMEM; |