diff options
| author | Jakub Kicinski <kuba@kernel.org> | 2024-12-05 11:48:58 -0800 |
|---|---|---|
| committer | Jakub Kicinski <kuba@kernel.org> | 2024-12-19 11:35:07 -0800 |
| commit | 07e5c4eb94e6aba96fa11b424b39c5e5576a7713 (patch) | |
| tree | ab7c48de9389e6e3c30586630b19ead62ae43637 /mm/slub.c | |
| parent | 6b3099ebca13ecc5d0e7d07b438672addbd65da6 (diff) | |
| parent | 8faabc041a001140564f718dabe37753e88b37fa (diff) | |
Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net
Cross-merge networking fixes after downstream PR (net-6.13-rc4).
No conflicts.
Adjacent changes:
drivers/net/ethernet/renesas/rswitch.h
32fd46f5b69e ("net: renesas: rswitch: remove speed from gwca structure")
922b4b955a03 ("net: renesas: rswitch: rework ts tags management")
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Diffstat (limited to 'mm/slub.c')
| -rw-r--r-- | mm/slub.c | 21 |
1 files changed, 18 insertions, 3 deletions
diff --git a/mm/slub.c b/mm/slub.c index 19980419b176..c2151c9fee22 100644 --- a/mm/slub.c +++ b/mm/slub.c @@ -2189,9 +2189,24 @@ bool memcg_slab_post_charge(void *p, gfp_t flags) folio = virt_to_folio(p); if (!folio_test_slab(folio)) { - return folio_memcg_kmem(folio) || - (__memcg_kmem_charge_page(folio_page(folio, 0), flags, - folio_order(folio)) == 0); + int size; + + if (folio_memcg_kmem(folio)) + return true; + + if (__memcg_kmem_charge_page(folio_page(folio, 0), flags, + folio_order(folio))) + return false; + + /* + * This folio has already been accounted in the global stats but + * not in the memcg stats. So, subtract from the global and use + * the interface which adds to both global and memcg stats. + */ + size = folio_size(folio); + node_stat_mod_folio(folio, NR_SLAB_UNRECLAIMABLE_B, -size); + lruvec_stat_mod_folio(folio, NR_SLAB_UNRECLAIMABLE_B, size); + return true; } slab = folio_slab(folio); |