Commit becaba6
mm: memcg/slab: fix obj_cgroup_charge() return value handling
Commit 10befea ("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: 10befea ("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>1 parent 2bf509d commit becaba6
1 file changed
Lines changed: 24 additions & 16 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
274 | 274 | | |
275 | 275 | | |
276 | 276 | | |
277 | | - | |
278 | | - | |
279 | | - | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
280 | 283 | | |
281 | 284 | | |
282 | 285 | | |
| 286 | + | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
283 | 292 | | |
284 | 293 | | |
285 | | - | |
| 294 | + | |
286 | 295 | | |
287 | 296 | | |
288 | 297 | | |
289 | | - | |
| 298 | + | |
290 | 299 | | |
291 | 300 | | |
292 | | - | |
| 301 | + | |
| 302 | + | |
293 | 303 | | |
294 | 304 | | |
295 | 305 | | |
| |||
315 | 325 | | |
316 | 326 | | |
317 | 327 | | |
318 | | - | |
| 328 | + | |
319 | 329 | | |
320 | 330 | | |
321 | 331 | | |
| |||
400 | 410 | | |
401 | 411 | | |
402 | 412 | | |
403 | | - | |
404 | | - | |
405 | | - | |
| 413 | + | |
| 414 | + | |
| 415 | + | |
406 | 416 | | |
407 | | - | |
| 417 | + | |
408 | 418 | | |
409 | 419 | | |
410 | 420 | | |
| |||
508 | 518 | | |
509 | 519 | | |
510 | 520 | | |
511 | | - | |
512 | | - | |
513 | | - | |
| 521 | + | |
| 522 | + | |
514 | 523 | | |
515 | 524 | | |
516 | 525 | | |
| |||
529 | 538 | | |
530 | 539 | | |
531 | 540 | | |
532 | | - | |
533 | | - | |
| 541 | + | |
534 | 542 | | |
535 | 543 | | |
536 | 544 | | |
| |||
0 commit comments