From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5455BC531DC for ; Fri, 23 Aug 2024 15:32:48 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 9ECB0800AD; Fri, 23 Aug 2024 11:32:47 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 99CAC800A4; Fri, 23 Aug 2024 11:32:47 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 88AF5800AD; Fri, 23 Aug 2024 11:32:47 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) by kanga.kvack.org (Postfix) with ESMTP id 6AB81800A4 for ; Fri, 23 Aug 2024 11:32:47 -0400 (EDT) Received: from smtpin23.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay05.hostedemail.com (Postfix) with ESMTP id 13C644044C for ; Fri, 23 Aug 2024 15:32:47 +0000 (UTC) X-FDA: 82483902774.23.45E6040 Received: from gentwo.org (gentwo.org [62.72.0.81]) by imf03.hostedemail.com (Postfix) with ESMTP id 5FCA42000C for ; Fri, 23 Aug 2024 15:32:44 +0000 (UTC) Authentication-Results: imf03.hostedemail.com; dkim=pass header.d=gentwo.org header.s=default header.b=iH8G4+H3; spf=pass (imf03.hostedemail.com: domain of cl@gentwo.org designates 62.72.0.81 as permitted sender) smtp.mailfrom=cl@gentwo.org; dmarc=pass (policy=reject) header.from=gentwo.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1724427055; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=bueoi/pymClB2+CgjMkjrFZvAi9CBHUPp+8ZwzQVtHY=; b=vgOH9sYUVGHI75m8lPTfwjmy8g/H1kmgh7VHIJT/BbMauVjxDWJtSvAhu59GTxRcpdvLhM nIqLFp4GYf61DW5MCNtFvLzjJpWaBfeikRYilAjQVFmCFqdGOVm44ck5SMazK/wacn6Ysk VjS/76ZkZAuWqTiWhzSLUeb3Znbx5yo= ARC-Authentication-Results: i=1; imf03.hostedemail.com; dkim=pass header.d=gentwo.org header.s=default header.b=iH8G4+H3; spf=pass (imf03.hostedemail.com: domain of cl@gentwo.org designates 62.72.0.81 as permitted sender) smtp.mailfrom=cl@gentwo.org; dmarc=pass (policy=reject) header.from=gentwo.org ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1724427055; a=rsa-sha256; cv=none; b=nY2Sjs6iixUAyk659b0XRDiQ2FbiP4YIC0e9UdnEnvMIsRSc40riAqJ55jDQ643HfUtauG WWElK37D+lR/LUYSCFEgddY0vn9ZbQ7Xe6CIMEubgvIn0iw9rKeD5DK16uTZoOpkoOgDTs nOZQq2Kk0WHb9AJZIGTvQa/gJCvy83k= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gentwo.org; s=default; t=1724427163; bh=lRovpRvPDM1FRpXpaw8e8qd/145dPGlknJKCfiOo1UI=; h=Date:From:To:cc:Subject:In-Reply-To:References:From; b=iH8G4+H3UseIeUMMKYkrBVUv1counoQmR0GgBW6xKnzSHApvTTtDL5uiTCre5jbBN cIMdaFxHQ2JjJifgnfQgYv5hVOQ6cbtdS8lVuLe/IxSAhBkaRd6HK0p0rESry2MN/U 2k+AwxjI8GdkQk9zofv/CfBHh+p5GZEX2K0AEPm0= Received: by gentwo.org (Postfix, from userid 1003) id 0EEFC40356; Fri, 23 Aug 2024 08:32:43 -0700 (PDT) Received: from localhost (localhost [127.0.0.1]) by gentwo.org (Postfix) with ESMTP id 0DDD440355; Fri, 23 Aug 2024 08:32:43 -0700 (PDT) Date: Fri, 23 Aug 2024 08:32:43 -0700 (PDT) From: "Christoph Lameter (Ampere)" To: Saurabh Singh Sengar cc: Andrew Morton , linux-mm@kvack.org, linux-kernel@vger.kernel.org, ssengar@microsoft.com, wei.liu@kernel.org Subject: Re: [PATCH] mm/vmstat: Defer the refresh_zone_stat_thresholds after all CPUs bringup In-Reply-To: <20240709045750.GA32083@linuxonhyperv3.guj3yctzbm1etfxqx2vob5hsef.xx.internal.cloudapp.net> Message-ID: <5a18105c-8e6f-39fa-370f-2d839d9ab843@gentwo.org> References: <1720169301-21002-1-git-send-email-ssengar@linux.microsoft.com> <20240705135911.4a6e38379ae95c3fc6bbe7e2@linux-foundation.org> <20240709045750.GA32083@linuxonhyperv3.guj3yctzbm1etfxqx2vob5hsef.xx.internal.cloudapp.net> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII X-Rspamd-Server: rspam06 X-Rspamd-Queue-Id: 5FCA42000C X-Stat-Signature: nmah34d1erywukpsi3rmpqu7hujbz6qx X-Rspam-User: X-HE-Tag: 1724427164-31218 X-HE-Meta: U2FsdGVkX1+uCjhmqknLUal9hhgvXQsd26T+fYf0+CaMAZH7uvdCJIab/29wnwVp2a4202yY/+9Yxrb8A43QixIFiQbbetj/x3kc91H6wR29RyXIEu+PB39qlmuQ/TP9DVzs47f0TLeZpXzHjspI0kR2khBq9Mzf7AX68w+G6dXkskXnsQcmdZCi+wFnF9XmjDLnO4wRXVlxw2D86muHosiK/ISj7jNyIj6tO2QfiPTcqZ+jM6sXZgq2SPeRUODZax7cxbUj6zFeP9cqW+qXS6UsiQ6tyoxrn/NDEnPduArPbwwYC2f2QgwJOVUcBh5bfOCxklDIKoPWacqIGx70cJPrEVrRxcD2IMA1+EEE5WPq0s8K8dZadLMwQSHY9RYQEvwpTIX7YOa7hmK0q2x7GvHOnTIkYGIU2DFVQeesXN2XAqUhN7s/URfe9/QCXsgrcjW4GLocIOx+NUF8LKiPayO59wx0VhvNYk7wzW0JUnfeeesPCrEdpZVMMZPSA3wOTHr+1m2Rq/Lwv5VZW2VdfPXu70kylRen3tQrQm0mv/xGmALvFO8BTYCECA7wB2t7vXWDyLJlB+6Of5pAngkZ81aM6uI4w8PFR4L5PHnEP1nPUOF25qcH6wwpyKX6iSUBYnGgcCt00Y6UCN+EO9ngGlU/Wj7mFzhz1B8USVWfuDsbgcCU1fFD+lUExP4sEvkts1UjUt2I1K/yDV0U0f/Xa1Gs46TIjjFEE6nLgGmXUcIvhRjLnfMRB2H0ZbzmeUX7LrE9v9FDgRsGNhTjTenM5nSmxe1qjwkQIHoUPx0QCOtiJseL3SQl5F4Vw7psm7AJuVYOP6kdtkBgSN+MtKt3FPKCmNYkRoPnZUylo/VDzbBZkN4DvkiSdpHWNdfqOXeIgnuZ1SbHhn33ropWZLYq9CVXOIKQG1A1kMDNWYV89aCbsY3Az40EoNO2AB0f+BT5/OObQtVpFoDgdo6RBZv f85xlv+2 7/MJZnWAVtLVRudyWrMcKF2BHE0hVpyMiEEx7+6ptCRzkD0uOiRg2LxRgEXWdGfI7JW0ze2npEQQloBzhUbUz6Ag+iIsC2WIYIwfLAmz2V1ZDOrd4j6iMxArht7K9Hz8YBJySX9FSSgfiRJUCL0jeQgx6gfu6bj5KNNQklXq6DCrYqyEkTeE91e0d9CcrYTsj10y+BLF8SX2HjmXJuXBN98LhJaMaF1lHmXNw X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: On Mon, 8 Jul 2024, Saurabh Singh Sengar wrote: > > > Calling this for each CPU is expensive when there are large number > > > of CPUs along with multiple NUMAs. Fix this by deferring > > > refresh_zone_stat_thresholds to be called later at once when all the > > > secondary CPUs are up. Also, register the DYN hooks to keep the > > > existing hotplug functionality intact. > > > > > > > Seems risky - we'll now have online CPUs which have unintialized data, > > yes? What assurance do we have that this data won't be accessed? > > I understand that this data is only accessed by userspace tools, and they can > only access it post late_initcall. Please let me know if there are any other > cases, I will look to address them. stat_threshold is used in all statistics functions that modify VM counters. It is core to the functioning of the VM statistics. However, if the threshold is zero (not initialized) then the VM counter handling will simply be less effective because it will not do the per cpu counter diffs anymore. This may increase contention and eat up the benefit you are getting from deferring the calculation of the threshholds. What may be more promising is to make it possible to calculate the threshholds per cpu instead of recalculating the thresholds for every zone again and again.