Skip to content

Commit be45831

Browse files
rgushchintorvalds
authored andcommitted
mm: memcg/slab: fix slab statistics in !SMP configuration
Since commit ea426c2 ("mm: memcg: prepare for byte-sized vmstat items") the write side of slab counters accepts a value in bytes and converts it to pages. It happens in __mod_node_page_state(). However a non-SMP version of __mod_node_page_state() doesn't perform this conversion. It leads to incorrect (unrealistically high) slab counters values. Fix this by adding a similar conversion to the non-SMP version of __mod_node_page_state(). Signed-off-by: Roman Gushchin <guro@fb.com> Reported-and-tested-by: Bastian Bittorf <bb@npl.de> Fixes: ea426c2 ("mm: memcg: prepare for byte-sized vmstat items") Acked-by: Vlastimil Babka <vbabka@suse.cz> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
1 parent 472e5b0 commit be45831

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

include/linux/vmstat.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -312,6 +312,11 @@ static inline void __mod_zone_page_state(struct zone *zone,
312312
static inline void __mod_node_page_state(struct pglist_data *pgdat,
313313
enum node_stat_item item, int delta)
314314
{
315+
if (vmstat_item_in_bytes(item)) {
316+
VM_WARN_ON_ONCE(delta & (PAGE_SIZE - 1));
317+
delta >>= PAGE_SHIFT;
318+
}
319+
315320
node_page_state_add(delta, pgdat, item);
316321
}
317322

0 commit comments

Comments
 (0)