diff options
author | Roman Gushchin <guro@fb.com> | 2020-12-05 22:14:45 -0800 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2020-12-06 10:19:07 -0800 |
commit | becaba65f62f88e553ec92ed98370e9d2b18e629 (patch) | |
tree | e03cee3c437fc8d25340e2a78be005c6305756d3 /mm/swapfile.c | |
parent | 2bf509d96d84c3336d08375e8af34d1b85ee71c8 (diff) | |
download | linux-stable-becaba65f62f88e553ec92ed98370e9d2b18e629.tar.gz linux-stable-becaba65f62f88e553ec92ed98370e9d2b18e629.tar.bz2 linux-stable-becaba65f62f88e553ec92ed98370e9d2b18e629.zip |
mm: memcg/slab: fix obj_cgroup_charge() return value handling
Commit 10befea91b61 ("mm: memcg/slab: use a single set of kmem_caches
for all allocations") introduced a regression into the handling of the
obj_cgroup_charge() return value. If a non-zero value is returned
(indicating of exceeding one of memory.max limits), the allocation
should fail, instead of falling back to non-accounted mode.
To make the code more readable, move memcg_slab_pre_alloc_hook() and
memcg_slab_post_alloc_hook() calling conditions into bodies of these
hooks.
Fixes: 10befea91b61 ("mm: memcg/slab: use a single set of kmem_caches for all allocations")
Signed-off-by: Roman Gushchin <guro@fb.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Reviewed-by: Shakeel Butt <shakeelb@google.com>
Cc: Johannes Weiner <hannes@cmpxchg.org>
Cc: Michal Hocko <mhocko@kernel.org>
Cc: <stable@vger.kernel.org>
Link: https://lkml.kernel.org/r/20201127161828.GD840171@carbon.dhcp.thefacebook.com
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'mm/swapfile.c')
0 files changed, 0 insertions, 0 deletions