mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Roman Gushchin <guro@fb.com>
To: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Bastian Bittorf <bb@npl.de>, Vlastimil Babka <vbabka@suse.cz>,
	Andrew Morton <akpm@linux-foundation.org>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	Shakeel Butt <shakeelb@google.com>
Subject: Re: Linux 5.9-rc7 / VmallocTotal wrongly reported
Date: Thu, 1 Oct 2020 13:39:31 -0700	[thread overview]
Message-ID: <20201001203931.GD2706729@carbon.DHCP.thefacebook.com> (raw)
In-Reply-To: <CAHk-=whwbrbZbdqpXVd9LOG=J04BEVZcT+vT=nXry=XP1JWqYA@mail.gmail.com>

On Thu, Oct 01, 2020 at 12:58:36PM -0700, Linus Torvalds wrote:
> On Thu, Oct 1, 2020 at 12:56 PM Roman Gushchin <guro@fb.com> wrote:
> >
> > Bastian, can you, please, share your config?
> 
> Bastian actually did that in the original email, but that was only
> sent to me and Andrew in private.
> 
> Here's that config replicated for your pleasure,

Thank you!

> 
> #
> # Processor type and features
> #
> # CONFIG_ZONE_DMA is not set
> # CONFIG_SMP is not set

Yes, here is the deal.

The SMP-version of __mod_node_page_state() converts a passed value from bytes
to pages, but the non-SMP doesn't.

Thanks!


--

From 3d0233b37340c78012b991d3570b92f91cf5ebd2 Mon Sep 17 00:00:00 2001
From: Roman Gushchin <guro@fb.com>
Date: Thu, 1 Oct 2020 13:07:49 -0700
Subject: [PATCH] mm: memcg/slab: fix slab statistics in !SMP configuration

Since ea426c2a7de8 ("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-by: Bastian Bittorf <bb@npl.de>
Fixes: ea426c2a7de8 ("mm: memcg: prepare for byte-sized vmstat items")
---
 include/linux/vmstat.h | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/include/linux/vmstat.h b/include/linux/vmstat.h
index d5431c1bf6e5..322dcbfcc933 100644
--- a/include/linux/vmstat.h
+++ b/include/linux/vmstat.h
@@ -312,6 +312,11 @@ static inline void __mod_zone_page_state(struct zone *zone,
 static inline void __mod_node_page_state(struct pglist_data *pgdat,
 			enum node_stat_item item, int delta)
 {
+	if (vmstat_item_in_bytes(item)) {
+		VM_WARN_ON_ONCE(delta & (PAGE_SIZE - 1));
+		delta >>= PAGE_SHIFT;
+	}
+
 	node_page_state_add(delta, pgdat, item);
 }
 
-- 
2.26.2


  reply	other threads:[~2020-10-01 20:39 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20201001065104.apevlkqrs6nid3r5@hp-nas.internet>
2020-10-01 19:19 ` Linus Torvalds
2020-10-01 19:56   ` Roman Gushchin
2020-10-01 19:58     ` Linus Torvalds
2020-10-01 20:39       ` Roman Gushchin [this message]
2020-10-02  0:08         ` [PATCH] mm: memcg/slab: fix slab statistics in !SMP configuration kernel test robot
2020-10-02  0:55           ` Roman Gushchin
2020-10-02  5:34             ` [kbuild-all] " Philip Li
2020-10-02 17:55               ` Roman Gushchin
2020-10-12 23:05                 ` Philip Li
2020-10-13  0:31                   ` Roman Gushchin
2020-10-02  7:01         ` Linux 5.9-rc7 / VmallocTotal wrongly reported | Patch OK Bastian Bittorf
2020-10-02 17:52           ` Roman Gushchin
2020-10-02  8:51         ` Linux 5.9-rc7 / VmallocTotal wrongly reported Vlastimil Babka
2020-10-02 21:43         ` [PATCH] mm: memcg/slab: fix slab statistics in !SMP configuration kernel test robot

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20201001203931.GD2706729@carbon.DHCP.thefacebook.com \
    --to=guro@fb.com \
    --cc=akpm@linux-foundation.org \
    --cc=bb@npl.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=shakeelb@google.com \
    --cc=torvalds@linux-foundation.org \
    --cc=vbabka@suse.cz \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®