Hao Li
dccd5ee262
memcg: fix slab accounting in refill_obj_stock() trylock path
...
In the trylock path of refill_obj_stock(), mod_objcg_mlstate() should use
the real alloc/free bytes (i.e., nr_acct) for accounting, rather than
nr_bytes.
The user-visible impact is that the NR_SLAB_RECLAIMABLE_B and
NR_SLAB_UNRECLAIMABLE_B stats can end up being incorrect.
For example, if a user allocates a 6144-byte object, then before this
fix efill_obj_stock() calls mod_objcg_mlstate(..., nr_bytes=2048), even
though it should account for 6144 bytes (i.e., nr_acct).
When the user later frees the same object with kfree(),
refill_obj_stock() calls mod_objcg_mlstate(..., nr_bytes=6144). This
ends up adding 6144 to the stats, but it should be applying -6144
(i.e., nr_acct) since the object is being freed.
Link: https://lkml.kernel.org/r/20260226115145.62903-1-hao.li@linux.dev
Fixes: 200577f69f ("memcg: objcg stock trylock without irq disabling")
Signed-off-by: Hao Li <hao.li@linux.dev >
Acked-by: Shakeel Butt <shakeel.butt@linux.dev >
Acked-by: Johannes Weiner <hannes@cmpxchg.org >
Cc: Michal Hocko <mhocko@kernel.org >
Cc: Muchun Song <muchun.song@linux.dev >
Cc: Roman Gushchin <roman.gushchin@linux.dev >
Cc: Vlastimil Babka <vbabka@suse.com >
Cc: <stable@vger.kernel.org >
Signed-off-by: Andrew Morton <akpm@linux-foundation.org >
2026-03-04 09:44:23 -08:00
..
2026-03-04 09:44:21 -08:00
2026-02-21 17:09:51 -08:00
2026-02-24 11:13:27 -08:00
2026-02-21 17:09:51 -08:00
2026-01-31 14:22:40 -08:00
2026-02-21 01:02:28 -08:00
2026-01-31 14:22:36 -08:00
2025-03-16 22:06:27 -07:00
2026-01-21 09:38:16 -08:00
2026-02-21 17:09:51 -08:00
2026-02-21 17:09:51 -08:00
2026-03-04 09:44:22 -08:00
2025-05-22 14:55:36 -07:00
2025-09-28 11:51:29 -07:00
2025-05-12 23:50:38 -07:00
2026-01-26 20:02:27 -08:00
2025-11-20 13:43:57 -08:00
2026-02-21 17:09:51 -08:00
2025-07-01 13:25:36 -06:00
2026-01-26 20:02:26 -08:00
2025-09-28 11:51:31 -07:00
2025-10-29 15:50:42 +01:00
2024-09-01 20:43:33 -07:00
2024-09-01 20:43:33 -07:00
2026-02-12 15:42:59 -08:00
2026-02-06 15:47:16 -08:00
2026-02-06 15:47:16 -08:00
2026-01-20 19:24:49 -08:00
2026-01-31 14:22:38 -08:00
2026-02-21 01:02:28 -08:00
2026-02-24 11:13:26 -08:00
2026-02-21 17:09:51 -08:00
2026-01-31 14:22:43 -08:00
2026-01-26 20:02:28 -08:00
2025-11-20 13:43:57 -08:00
2026-01-20 19:24:50 -08:00
2025-11-20 13:43:57 -08:00
2026-01-26 20:02:20 -08:00
2025-03-16 22:06:29 -07:00
2026-03-04 09:44:23 -08:00
2025-09-21 14:22:21 -07:00
2026-01-19 12:30:00 -08:00
2026-02-18 20:50:32 -08:00
2025-03-16 22:06:23 -07:00
2026-02-12 11:32:37 -08:00
2025-11-29 10:41:09 -08:00
2026-02-21 17:09:51 -08:00
2026-02-16 13:41:38 -08:00
2026-02-21 20:03:00 -08:00
2026-02-21 17:09:51 -08:00
2025-07-09 22:42:22 -07:00
2026-02-21 17:09:51 -08:00
2026-02-12 12:13:01 -08:00
2025-11-16 17:27:58 -08:00
2026-02-14 12:39:34 -08:00
2026-02-21 01:02:28 -08:00
2026-02-12 11:32:37 -08:00
2026-03-04 09:44:23 -08:00
2026-03-04 09:44:21 -08:00
2026-02-12 15:42:58 -08:00
2026-01-31 14:22:36 -08:00
2026-02-21 01:02:28 -08:00
2026-02-21 20:03:00 -08:00
2026-02-21 17:09:51 -08:00
2026-02-21 20:03:00 -08:00
2026-02-21 17:09:51 -08:00
2026-01-26 19:03:48 -08:00
2026-01-09 11:53:51 +02:00
2026-01-20 19:24:48 -08:00
2026-01-31 14:22:36 -08:00
2025-11-24 15:08:52 -08:00
2025-11-20 13:43:58 -08:00
2026-02-24 11:13:28 -08:00
2026-01-31 14:22:51 -08:00
2026-02-12 15:42:58 -08:00
2026-02-06 15:47:16 -08:00
2026-02-21 20:03:00 -08:00
2025-09-13 16:55:07 -07:00
2026-01-20 19:24:33 -08:00
2026-02-12 15:42:58 -08:00
2026-01-20 19:24:48 -08:00
2025-09-13 16:54:46 -07:00
2025-08-20 16:31:23 +03:00
2026-02-21 09:58:22 -08:00
2025-05-12 23:50:38 -07:00
2026-01-31 14:22:37 -08:00
2026-02-24 11:13:27 -08:00
2025-03-17 00:05:35 -07:00
2026-01-21 12:51:48 +01:00
2025-01-13 22:40:31 -08:00
2025-11-24 15:08:48 -08:00
2026-01-20 19:24:48 -08:00
2026-01-31 14:22:42 -08:00
2026-02-21 01:02:28 -08:00
2026-02-21 17:09:51 -08:00
2026-01-26 20:02:35 -08:00
2025-11-24 15:08:52 -08:00
2026-01-20 19:24:47 -08:00
2026-01-31 14:22:52 -08:00
2024-07-10 12:14:54 -07:00
2025-09-21 14:22:04 -07:00
2025-07-13 16:38:23 -07:00
2025-11-16 17:27:54 -08:00
2026-01-31 14:22:52 -08:00
2026-01-05 16:43:33 +01:00
2024-11-05 16:56:23 -08:00
2025-11-16 17:27:52 -08:00
2026-02-12 11:32:37 -08:00
2026-02-12 15:43:01 -08:00
2025-01-13 22:40:38 -08:00
2026-02-12 15:42:58 -08:00
2026-02-21 01:02:28 -08:00
2026-02-21 17:09:51 -08:00
2026-01-31 14:22:38 -08:00
2026-01-26 20:02:25 -08:00
2026-02-21 17:09:51 -08:00
2026-02-10 09:10:00 +01:00
2026-02-10 09:10:00 +01:00
2026-02-21 17:09:51 -08:00
2025-11-16 17:27:56 -08:00
2025-10-14 14:24:53 +02:00
2025-03-17 22:06:58 -07:00
2026-01-31 14:22:57 -08:00
2025-09-21 14:22:25 -07:00
2026-01-20 19:24:48 -08:00
2026-01-31 14:22:57 -08:00
2026-02-21 20:03:00 -08:00
2025-12-01 10:26:38 -08:00
2025-11-13 11:01:08 +01:00
2026-01-31 14:22:57 -08:00
2026-02-12 15:42:59 -08:00
2025-11-24 15:08:54 -08:00
2025-10-02 18:18:33 -07:00
2026-02-12 15:42:53 -08:00
2026-02-12 15:42:59 -08:00
2026-02-12 15:42:59 -08:00
2026-02-21 17:09:51 -08:00
2026-02-21 17:09:51 -08:00
2026-02-21 01:02:28 -08:00
2026-02-12 11:32:37 -08:00
2026-01-26 20:02:23 -08:00
2025-09-21 14:21:59 -07:00
2026-02-21 17:09:51 -08:00
2026-02-21 17:09:51 -08:00