Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp1139393pxk; Fri, 2 Oct 2020 01:54:56 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyfpB3e1hSVn7QzxtK7wTjBu5YXwe72Bzn8Bx/ZaGyORgMCHYM+Ad2qeFkU/uChEoL4+PKe X-Received: by 2002:a17:906:b784:: with SMTP id dt4mr1279260ejb.376.1601628896289; Fri, 02 Oct 2020 01:54:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1601628896; cv=none; d=google.com; s=arc-20160816; b=0vtL1ya8SsqCml53ps4QhylMYxpPoE05CPmN3FMA2oBX+1l6Tc6QIDwdmC5SqT2akD aEVXrm3j2uDUEpp5tf0cxxLn9Vrd9eDHexJvnJg077xkqG8rJGad62VKLq6UXmXQvqHL LAWBLQNUGTQwG44npNz/w+M6NlOqyliBtJU7xUk7+N8TIWt0TNBZ7JRiUFq47COuLRwI MspYieeq5orrbqy5mU0uGUfX82+j7tRWnMRfiklTCQGZTMB8SgYB1Hx55gtzpHXmOfb+ bN18Y8TXl272hgonhyg9DePZt5NGAlq6RomU49Sy6+TvKoW/or6/KIRvtD8Kh/Le2eJq 8Nfw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject; bh=INPX5fz9QaayD7eAftxaeanSMOqiV+r3EDj08gzMOOo=; b=XnIBf622Jo7wPvkwazY5kemaqz0RciNI2ayj4FXxspo7S3gYRmo7q0crp4Rn7khWGn qOu66bfVh5j205PkPmLZPBLXvHyt8i3juNw7vRVDz/JR6DGusApyCCeCCyM5ebRY9i2B ia0diKRv1bNk7w5z0HxpZwf9vOX2YrpTyMZi/j/V+qYPrp6R1KPPRlbtcW6zS6/4JFpi CnQ7Js8T+BPimW+wxN31GHtyMByrR8e8VnkFbwcfPyo/wB21SurNzJiHV9lcX1kImwU2 rOIrf+nMjhKivyST6okOwNCC8ypmozazBHY3DZTSxOIqbVmZyhUdrq1cHS5I7rwNP2i1 JVlw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id x99si528773ede.160.2020.10.02.01.54.33; Fri, 02 Oct 2020 01:54:56 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726561AbgJBIva (ORCPT + 99 others); Fri, 2 Oct 2020 04:51:30 -0400 Received: from mx2.suse.de ([195.135.220.15]:41404 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725993AbgJBIva (ORCPT ); Fri, 2 Oct 2020 04:51:30 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id E871EAC4D; Fri, 2 Oct 2020 08:51:28 +0000 (UTC) Subject: Re: Linux 5.9-rc7 / VmallocTotal wrongly reported To: Roman Gushchin , Linus Torvalds Cc: Bastian Bittorf , Andrew Morton , Linux Kernel Mailing List , Shakeel Butt References: <20201001065104.apevlkqrs6nid3r5@hp-nas.internet> <20201001195610.GC2706729@carbon.DHCP.thefacebook.com> <20201001203931.GD2706729@carbon.DHCP.thefacebook.com> From: Vlastimil Babka Message-ID: <9de0c0d4-15ac-bb7f-755b-849433da5ba4@suse.cz> Date: Fri, 2 Oct 2020 10:51:27 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.12.0 MIME-Version: 1.0 In-Reply-To: <20201001203931.GD2706729@carbon.DHCP.thefacebook.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 10/1/20 10:39 PM, Roman Gushchin wrote: > On Thu, Oct 01, 2020 at 12:58:36PM -0700, Linus Torvalds wrote: >> On Thu, Oct 1, 2020 at 12:56 PM Roman Gushchin 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 > 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 > Reported-by: Bastian Bittorf > Fixes: ea426c2a7de8 ("mm: memcg: prepare for byte-sized vmstat items") Acked-by: Vlastimil Babka For consistency we could also duplicate the "VM_WARN_ON_ONCE(vmstat_item_in_bytes(item));" in !SMP variants of __inc_node_state() and __dec_node_state(), but that's not urgent, and perhaps SMP configs are enough to catch any bugs introduced in the future in this area... > --- > 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); > } > >