Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp1580461pxb; Thu, 4 Mar 2021 15:23:24 -0800 (PST) X-Google-Smtp-Source: ABdhPJyOPEJryMb2Nz2dvesNBMXPQ0pHD/1cS0NkbjzivKY+FhaVy3NEBO6vwP5yMSaCCq0ipH7v X-Received: by 2002:a92:c26f:: with SMTP id h15mr5787316ild.65.1614900204481; Thu, 04 Mar 2021 15:23:24 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1614900204; cv=none; d=google.com; s=arc-20160816; b=rih7x7lM6TVy9O1mN6z+3/C0Xa5Sbwpi+zfKU8iU10qbxI5dEXet2qxWsfVgeJR2RN xkMyW0otEZuzg/52hmS4q+Lzo9BvM4uUgqpK4UYzon31Sf30pYY2Nihtrmipfs64d9iu BJN6VLJwwHTR/KoY2sWx6/dm/GqHb+CjoTU8mSEDSeEFur8NRSeZAkeeQOCYnOR5OUZo GLf2lsoaKZZdd8mTqLYzOzOhhTXMMzPREmgblOxnNaizMktxP8hMACQYHoUN2A7rrH1p fPF2cst5o15uh8xsKoPBA03OcIa4+Q0I5my9H3Ut2qdllgyZctOa/UkHX9I96f8BVxK8 8mPw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=Z7SFVE/srJLy7vxPjSXUxrCBmwOGTmTd/OLDwsoPcO8=; b=V71ULN0sy+L6OyQyev9CMXd/i39tDEcV+0g/wbCxqOqactlwWVU8HglFucMWOLc+q2 hfPA9ojqnvFsQwU75yvg4dyY3Fug+eVw8YvYZPQm2PqAK9Yg/qRVAUOSZxho8S2df8Tl +hJN6s9SNa3jInWD+DJqGqBLNOJ4/aNSuqE9JQBvS6y1pqGQ8ZyUyIjWwyeHxKHSz1OS JrHfpf/KTP/cHPpE9NaMJnCU4WwIB5KpLFj5JQXTc3qHZZlJZJkQGW6ACepdjMIXVyK7 vu0fAboVObCQJYxUtFZWk6Q9oHR/Li7HEl4msQO0K2kX0P7/xwAKPjffK2uLDmAkyGy+ tdhg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@cmpxchg-org.20150623.gappssmtp.com header.s=20150623 header.b=LgMwZyQ0; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=cmpxchg.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id j3si585256ilo.36.2021.03.04.15.23.11; Thu, 04 Mar 2021 15:23:24 -0800 (PST) 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; dkim=pass header.i=@cmpxchg-org.20150623.gappssmtp.com header.s=20150623 header.b=LgMwZyQ0; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=cmpxchg.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1835405AbhCCSDX (ORCPT + 99 others); Wed, 3 Mar 2021 13:03:23 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44682 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1378904AbhCCPPn (ORCPT ); Wed, 3 Mar 2021 10:15:43 -0500 Received: from mail-qk1-x734.google.com (mail-qk1-x734.google.com [IPv6:2607:f8b0:4864:20::734]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3DD41C061765 for ; Wed, 3 Mar 2021 07:15:02 -0800 (PST) Received: by mail-qk1-x734.google.com with SMTP id n79so12661000qke.3 for ; Wed, 03 Mar 2021 07:15:02 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cmpxchg-org.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=Z7SFVE/srJLy7vxPjSXUxrCBmwOGTmTd/OLDwsoPcO8=; b=LgMwZyQ0cO+dRf5zC9bNib0XjzGon02Jq3aGKR2c+otD2ltKr93V01PyRtNV59FEvH O1umCO/uEcR2DiKONx+rFazPA9hoEFi4eFROAkakDZz4ixGowIYdviwqbRAtnUEVu2sG Yjvg7svG1RD4SRVybeEeIEXTVJi7g3DsEDFiXptDNrS0PVjm0Vi2aHlA7JJ6H9vj/qjD mc9D+Zp6zv1rXx6CQayXYY0tIJ5pEruxCqpR4GXhWKU+9TRSR/eck6xDOnOv9nixLTxv OxR3hWuWArABwiVJa3seHmLSBy+t/g4h0rsAdWWY6xH+BNbwtvQuJ66o/DDeSmXNz6tw Xceg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=Z7SFVE/srJLy7vxPjSXUxrCBmwOGTmTd/OLDwsoPcO8=; b=I7CK7iVLlB6gyfynDvxfXLAuUpBhJr0nIHRtfE3ca2gsWgEgdbrzArinsi8RQXswzD dME0WkDMMXC2NIOwGwQYx8oz+dwaJ1BaUkSG3sXySmdfxRs7GtNxk7l9xcscjS5ulQtd rBNWDCqf6/56VjYES1k1vfT1V442sVRlU9Ry2cVE7IHBBhhuaE07VUbIfCpugRweouOD ehs4dhpBh/u3PqSEJ6bSzZOIWHxde5XPYpE3Y/HEIx2KQyeqBAbQ3eN8ITUJwLgKKN0J PCV8Bi1CHV+gKvb7CZXx+AyA1CpqWmimXwim9CdFLfiaw3Wnxbd4vqId9UE9cNF45M8Y ZoxQ== X-Gm-Message-State: AOAM533JkI4QfKpqCs0KXiPhxmyFG6m0wkKB0Fsk77prsm4n5C7m4Nx5 2zqJ92q80fI0ZBKvxAIDUqNNDQ== X-Received: by 2002:a37:9003:: with SMTP id s3mr7829035qkd.361.1614784501524; Wed, 03 Mar 2021 07:15:01 -0800 (PST) Received: from localhost ([2620:10d:c091:480::1:5636]) by smtp.gmail.com with ESMTPSA id r10sm11403961qtb.26.2021.03.03.07.15.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 03 Mar 2021 07:15:01 -0800 (PST) Date: Wed, 3 Mar 2021 10:14:58 -0500 From: Johannes Weiner To: Muchun Song Cc: guro@fb.com, mhocko@kernel.org, akpm@linux-foundation.org, shakeelb@google.com, linux-kernel@vger.kernel.org, linux-mm@kvack.org Subject: Re: [PATCH v2] mm: memcontrol: fix kernel stack account Message-ID: References: <20210303093956.72318-1-songmuchun@bytedance.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210303093956.72318-1-songmuchun@bytedance.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Mar 03, 2021 at 05:39:56PM +0800, Muchun Song wrote: > For simplification 991e7673859e ("mm: memcontrol: account kernel stack > per node") has changed the per zone vmalloc backed stack pages > accounting to per node. By doing that we have lost a certain precision > because those pages might live in different NUMA nodes. In the end > NR_KERNEL_STACK_KB exported to the userspace might be over estimated on > some nodes while underestimated on others. > > This doesn't impose any real problem to correctnes of the kernel > behavior as the counter is not used for any internal processing but it > can cause some confusion to the userspace. > > Address the problem by accounting each vmalloc backing page to its own > node. > > Fixes: 991e7673859e ("mm: memcontrol: account kernel stack per node") > Signed-off-by: Muchun Song > Reviewed-by: Shakeel Butt With changes proposed by Shakeel and Michal, this looks good to me. Acked-by: Johannes Weiner I guess the BUG_ON() was inspired by memcg_charge_kernel_stack() - not really your fault for following that example. But yeah, please drop it from your patch. Thanks!