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 1E895C05027 for ; Thu, 2 Feb 2023 15:54:38 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 8B80F6B0071; Thu, 2 Feb 2023 10:54:37 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 8672D6B0073; Thu, 2 Feb 2023 10:54:37 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 755D86B0074; Thu, 2 Feb 2023 10:54:37 -0500 (EST) 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 670986B0071 for ; Thu, 2 Feb 2023 10:54:37 -0500 (EST) Received: from smtpin05.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay04.hostedemail.com (Postfix) with ESMTP id 2C06B1A0E2F for ; Thu, 2 Feb 2023 15:54:37 +0000 (UTC) X-FDA: 80422799394.05.74326D1 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by imf28.hostedemail.com (Postfix) with ESMTP id 36D67C000D for ; Thu, 2 Feb 2023 15:54:35 +0000 (UTC) Authentication-Results: imf28.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=NZpciChu; spf=pass (imf28.hostedemail.com: domain of mtosatti@redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=mtosatti@redhat.com; dmarc=pass (policy=none) header.from=redhat.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1675353275; 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=negYAZ7XN8B3B48WSqZhThnhQsqI7SKK1pB//896v0c=; b=lLdkSSqw8uA0RxMAgfBeUx7b3O5RSMTlMHvHrjGxK02XAYk3swEUuHFVO99QeTgw7lAwY5 mwnCA/AEV3d28Pe7cAtBkeI0ejKwtCaHeBgMfv3wOYNfDasDmz4mA1LKZMcfJCLjNXdOAu T5eZQFKIiErpGQnFavOSWx1QpamBZSs= ARC-Authentication-Results: i=1; imf28.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=NZpciChu; spf=pass (imf28.hostedemail.com: domain of mtosatti@redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=mtosatti@redhat.com; dmarc=pass (policy=none) header.from=redhat.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1675353275; a=rsa-sha256; cv=none; b=0Jb2bVAmROYU/YkomUOJ5Q1H1m1fmtDsuxcBDQDuEIkDREMZ+9YvxgSh83d6QcY37N7IGa aQXlD1UgCzExJh3srB73Si9yVx5fWxPnypNWz4/EVHtkZvAPNS/96/IarpBP4B/rzUWkgd j0S5l5xtZi6egZ3P3gkg0xNPuyRQKiY= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1675353274; 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=negYAZ7XN8B3B48WSqZhThnhQsqI7SKK1pB//896v0c=; b=NZpciChuaVnkazsbdUH3ZBGX/c2DnjXYKGxn0kRrL5p0N3ikHmK/ZarZa07scnh4DF8Vf3 AM/C6mZV1FmHC10joVnkf1EKPJBsuz3QwdNnaSv6DmQfjIDajkSc8oN5huETy1Zf6gLfMY p/W6ykR1egF+EhLZs4q6AAutwTNPoM8= 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-253-dNzHb1_zP2uhv0jZpOqVgw-1; Thu, 02 Feb 2023 10:54:31 -0500 X-MC-Unique: dNzHb1_zP2uhv0jZpOqVgw-1 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id AF0F3101A52E; Thu, 2 Feb 2023 15:54:30 +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 1B0F42026D4B; Thu, 2 Feb 2023 15:54:30 +0000 (UTC) Received: by tpad.localdomain (Postfix, from userid 1000) id 125B1403BF03F; Thu, 2 Feb 2023 12:54:12 -0300 (-03) Date: Thu, 2 Feb 2023 12:54:12 -0300 From: Marcelo Tosatti To: Christoph Lameter Cc: Aaron Tomlin , Frederic Weisbecker , Andrew Morton , linux-kernel@vger.kernel.org, linux-mm@kvack.org Subject: Re: [PATCH 3/5] mm/vmstat: use cmpxchg loop in cpu_vm_stats_fold Message-ID: References: <20230201195013.881721887@redhat.com> <20230201195104.460373427@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.4 X-Rspam-User: X-Rspamd-Server: rspam03 X-Stat-Signature: ptx47xu1t44w4r16ng6x378whb4qkxb5 X-Rspamd-Queue-Id: 36D67C000D X-HE-Tag: 1675353275-509132 X-HE-Meta: U2FsdGVkX18LWIo5AVpo693DUXhU/CtjuSPrXCyll1FyXAYsjTWBwiWxEC5W13v1qL66sgQ48TjiJHaGgp0jnd2GxKjiDvjkQm/SCmIUSXO5QNKIyynBJv6kE9vDBUCR/P0Pwj6mUYZnySO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ilter, 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, Feb 02, 2023 at 03:38:58PM +0100, Christoph Lameter wrote: > On Wed, 1 Feb 2023, Marcelo Tosatti wrote: > > > In preparation to switch vmstat shepherd to flush > > per-CPU counters remotely, use a cmpxchg loop > > instead of a pair of read/write instructions. > > You are mixing full atomic cmpxchg and per cpu atomic cmpxchg? That does > not work. OK, missing locked on the local functions. Can fix that. > I thought you would only run this while the kernel is not active on the > remote cpu? Then you dont need any cmpxchg and you can leave the function > as is. The remote cpu can enter kernel mode while this function executes. There is no mode which indicates userspace cannot enter the kernel.