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 7F1E5C7EE2F for ; Fri, 3 Mar 2023 16:39:53 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 6798E6B0073; Fri, 3 Mar 2023 11:39:51 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 628F86B0075; Fri, 3 Mar 2023 11:39:51 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 4F0D26B0078; Fri, 3 Mar 2023 11:39:51 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0016.hostedemail.com [216.40.44.16]) by kanga.kvack.org (Postfix) with ESMTP id 3DD6E6B0073 for ; Fri, 3 Mar 2023 11:39:51 -0500 (EST) Received: from smtpin28.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id 020F9140852 for ; Fri, 3 Mar 2023 16:39:51 +0000 (UTC) X-FDA: 80528148582.28.99A7628 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by imf24.hostedemail.com (Postfix) with ESMTP id 40FBC180017 for ; Fri, 3 Mar 2023 16:39:49 +0000 (UTC) Authentication-Results: imf24.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=Cvlw8rgx; dmarc=pass (policy=none) header.from=redhat.com; spf=pass (imf24.hostedemail.com: domain of mtosatti@redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=mtosatti@redhat.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1677861589; 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=uNLJgT9zFMcxnSv0JH7AOr2H78zkUJl6YhKMbytbkDk=; b=4jYUqrSX7105IgVK4WKMXte52ZwYu84xTxXfEDhzq6trs5FpSZ92m4O/5faTZcFBj/08Tl hVPu8v74icpAOp7gB0n3kxufga/0ocrOqtjoJ0D8jdBJphJ3Mt3osuMn7KolHxSKUAvcyo znQrZB9AXfC9MiChIYw7lTgROF0ptxo= ARC-Authentication-Results: i=1; imf24.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=Cvlw8rgx; dmarc=pass (policy=none) header.from=redhat.com; spf=pass (imf24.hostedemail.com: domain of mtosatti@redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=mtosatti@redhat.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1677861589; a=rsa-sha256; cv=none; b=TrYgQ8yfbjPcX6t8bYIhli/YHsdvmBn5fa+wFpmt1jNJ0U7vNWAgOQ0sjSqEmdnWE/NxQF lPwQAOQB7w+ZdOU8QQteW+QTUUjlYr1NkEDDrFjfH1MUWxsru5wObDoqkcd2NGWltSyuKU 7b55agF0K+41KdKhPjxyOr3rx6j3MeI= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1677861588; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=uNLJgT9zFMcxnSv0JH7AOr2H78zkUJl6YhKMbytbkDk=; b=Cvlw8rgxGfZG2mb2BUsauPWRojeAyWwGJlg469IR0Lb2KYSqFDpKgFTjRXgAnXikRW4oWe 8stFtAe8C/PsY9HDjI+GQquik0QClRDqFEb9gJIsLc7BpLH1uFIumB5jFvEHbOhjyc0DcX /URsJwtsCZdQAJJ96r1FYxmxXfaMNZU= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-28-6pV58CicMEa2r-BADiOSDQ-1; Fri, 03 Mar 2023 11:39:45 -0500 X-MC-Unique: 6pV58CicMEa2r-BADiOSDQ-1 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.rdu2.redhat.com [10.11.54.1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id D2E50101A521; Fri, 3 Mar 2023 16:39:44 +0000 (UTC) Received: from tpad.localdomain (ovpn-112-2.gru2.redhat.com [10.97.112.2]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 9A5D64024B7C; Fri, 3 Mar 2023 16:39:44 +0000 (UTC) Received: by tpad.localdomain (Postfix, from userid 1000) id E98A8403E3A21; Fri, 3 Mar 2023 12:17:12 -0300 (-03) Date: Fri, 3 Mar 2023 12:17:12 -0300 From: Marcelo Tosatti To: Peter Xu Cc: Christoph Lameter , Aaron Tomlin , Frederic Weisbecker , Andrew Morton , linux-kernel@vger.kernel.org, linux-mm@kvack.org Subject: Re: [PATCH v2 09/11] mm/vmstat: use cmpxchg loop in cpu_vm_stats_fold Message-ID: References: <20230209150150.380060673@redhat.com> <20230209153204.873999366@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Scanned-By: MIMEDefang 3.1 on 10.11.54.1 X-Rspam-User: X-Rspamd-Server: rspam02 X-Rspamd-Queue-Id: 40FBC180017 X-Stat-Signature: hk5z8j3swz8wq69wer37g54h6wr5fwa5 X-HE-Tag: 1677861589-280527 X-HE-Meta: U2FsdGVkX1+UP/HnOfXmwcy/xtI/lFKtyx5LaFghO34uXLU8vrtzxQR/GefDc+vm7filhf73fU7yXEDJf6bf3YrX51qmu8Q47+l3/Z7uC/sw1X23SlUTQIbn4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HXULgvuqHYU 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: On Thu, Mar 02, 2023 at 04:19:50PM -0500, Peter Xu wrote: > On Thu, Mar 02, 2023 at 10:55:09AM -0300, Marcelo Tosatti wrote: > > > (2) If someone can modify the dead cpu's vm_stat_diff, > > > > The only context that can modify the cpu's vm_stat_diff are: > > > > 1) The CPU itself (increases the counter). > > 2) cpu_vm_stats_fold (from vmstat_shepherd kernel thread), from > > x -> 0 only. > > I think I didn't continue reading so I didn't see cpu_vm_stats_fold() will > be reused when commenting, sorry. > > Now with a reworked (and SMP-safe) cpu_vm_stats_fold() and vmstats, I'm > wondering the possibility of merging it with refresh_cpu_vm_stats() since > they really look similar. Seems like a possibility. However that might require replacing v = this_cpu_xchg(pzstats->vm_stat_diff[i], 0); with pzstats = per_cpu_ptr(zone->per_cpu_zonestats, cpu); Which would drop the this_cpu optimization described at 7340a0b15280c9d902c7dd0608b8e751b5a7c403 Also you would not want the unified function to sync NUMA events (as it would be called from NOHZ entry and exit). See f19298b9516c1a031b34b4147773457e3efe743b > IIUC the new refresh_cpu_vm_stats() logically doesn't need the small > preempt disabled sections, not anymore, What preempt disabled sections you refer to? > if with a cpu_id passed over to > cpu_vm_stats_fold(), which seems to be even a good side effect. But not > sure I missed something. > > -- > Peter Xu > >