From patchwork Mon Mar 20 18:03:38 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marcelo Tosatti X-Patchwork-Id: 13181692 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 2D11DC6FD1D for ; Mon, 20 Mar 2023 18:12:20 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 924EA6B0081; Mon, 20 Mar 2023 14:12:14 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 80FA06B0082; Mon, 20 Mar 2023 14:12:14 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 639256B0083; Mon, 20 Mar 2023 14:12:14 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id 520FB6B0081 for ; Mon, 20 Mar 2023 14:12:14 -0400 (EDT) Received: from smtpin08.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id F417FC042E for ; Mon, 20 Mar 2023 18:12:13 +0000 (UTC) X-FDA: 80590070946.08.E5E8471 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by imf27.hostedemail.com (Postfix) with ESMTP id 2A2FB4001B for ; Mon, 20 Mar 2023 18:12:12 +0000 (UTC) Authentication-Results: imf27.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=IlM+vW4d; spf=pass (imf27.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=1679335932; 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: references:references:dkim-signature; bh=kXDHBNZWD1x4YyqOA6ZVeranXWbQxiEjKgF55Tb+rLk=; b=nky2m2k3Hg6LTxFeytLlhL7hkM71a45mbNNW/ygIXfVR3yINoOsjFTLA7zpTSoCB2WHwen Xnn+bE3hGOK/1bGVJ5BX7ht0qMPzAZ/7LOz5XOUO6URP9svYBcqLcgx+WDhkuHC8JVQc3a Xno65cjQLnYEc1bJ5bZnZRyJWqZvqz8= ARC-Authentication-Results: i=1; imf27.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=IlM+vW4d; spf=pass (imf27.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=1679335932; a=rsa-sha256; cv=none; b=PK/fnmibeqNIWoNeyuwwwBTP8C/r3q7aaiuZHrPnY2FAvFL68+NbBzenwFhP1mRW7FvrOJ UOCQLulR8q+aQk9GUw1NZ3f0f+8Hn5GAkgarMx6039JuyRsev7F9C/WFQO5UPdYp1YfCVx U0H6pIft36F0ra7YkRBEhvzh+yxesHM= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1679335931; 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: references:references; bh=kXDHBNZWD1x4YyqOA6ZVeranXWbQxiEjKgF55Tb+rLk=; b=IlM+vW4d5Jkcfk+15yi4bUt1PwL2wP7lSl6q/azvgVoHqfOykY6NMrg4FS0YefHGb2a0N+ YBsHCsk+36skJR+zufgKXrIdXNfYolL4QkiRtvdaU66AupgDnXY6pVbtD5+DUvlR2QzPu0 KN+1uE4F3965MICGGUydHqP7INekSo0= 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-197-ptS4IJK8Mf6jxxec7kdteg-1; Mon, 20 Mar 2023 14:12:06 -0400 X-MC-Unique: ptS4IJK8Mf6jxxec7kdteg-1 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 4982185C069; Mon, 20 Mar 2023 18:12:05 +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 1568F2166B29; Mon, 20 Mar 2023 18:12:05 +0000 (UTC) Received: by tpad.localdomain (Postfix, from userid 1000) id E4E79403BC8B5; Mon, 20 Mar 2023 15:08:02 -0300 (-03) Message-ID: <20230320180745.683772749@redhat.com> User-Agent: quilt/0.67 Date: Mon, 20 Mar 2023 15:03:38 -0300 From: Marcelo Tosatti To: Christoph Lameter Cc: Aaron Tomlin , Frederic Weisbecker , Andrew Morton , linux-kernel@vger.kernel.org, linux-mm@kvack.org, Russell King , Huacai Chen , Heiko Carstens , x86@kernel.org, Vlastimil Babka , Michal Hocko , Marcelo Tosatti Subject: [PATCH v7 06/13] add this_cpu_cmpxchg_local and asm-generic definitions References: <20230320180332.102837832@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.6 X-Rspamd-Server: rspam05 X-Rspamd-Queue-Id: 2A2FB4001B X-Stat-Signature: y3fmmuejazc9r8f5ezbn8xz3ur5q7wbx X-Rspam-User: X-HE-Tag: 1679335932-861772 X-HE-Meta: U2FsdGVkX1//UHmy4C40MTJZTnn7QM4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yCevSzd21UpO/o516nNCUGIxxbY4izy3vElkhnVg+BsJY4mq1Wk655CrjskqyzagYa/Wbd8hVbpX4Pde8ftG3S1ZR86dYMG9WCV1pNENJkLTzePw03evbuY1DbQKlKO8q/EDnIXhQ== 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: Goal is to have vmstat_shepherd to transfer from per-CPU counters to global counters remotely. For this, an atomic this_cpu_cmpxchg is necessary. Add this_cpu_cmpxchg_local_ helpers to asm-generic/percpu.h. Signed-off-by: Marcelo Tosatti Index: linux-vmstat-remote/include/asm-generic/percpu.h =================================================================== --- linux-vmstat-remote.orig/include/asm-generic/percpu.h +++ linux-vmstat-remote/include/asm-generic/percpu.h @@ -424,6 +424,23 @@ do { \ this_cpu_generic_cmpxchg(pcp, oval, nval) #endif +#ifndef this_cpu_cmpxchg_local_1 +#define this_cpu_cmpxchg_local_1(pcp, oval, nval) \ + this_cpu_generic_cmpxchg(pcp, oval, nval) +#endif +#ifndef this_cpu_cmpxchg_local_2 +#define this_cpu_cmpxchg_local_2(pcp, oval, nval) \ + this_cpu_generic_cmpxchg(pcp, oval, nval) +#endif +#ifndef this_cpu_cmpxchg_local_4 +#define this_cpu_cmpxchg_local_4(pcp, oval, nval) \ + this_cpu_generic_cmpxchg(pcp, oval, nval) +#endif +#ifndef this_cpu_cmpxchg_local_8 +#define this_cpu_cmpxchg_local_8(pcp, oval, nval) \ + this_cpu_generic_cmpxchg(pcp, oval, nval) +#endif + #ifndef this_cpu_cmpxchg_double_1 #define this_cpu_cmpxchg_double_1(pcp1, pcp2, oval1, oval2, nval1, nval2) \ this_cpu_generic_cmpxchg_double(pcp1, pcp2, oval1, oval2, nval1, nval2) Index: linux-vmstat-remote/include/linux/percpu-defs.h =================================================================== --- linux-vmstat-remote.orig/include/linux/percpu-defs.h +++ linux-vmstat-remote/include/linux/percpu-defs.h @@ -513,6 +513,8 @@ do { \ #define this_cpu_xchg(pcp, nval) __pcpu_size_call_return2(this_cpu_xchg_, pcp, nval) #define this_cpu_cmpxchg(pcp, oval, nval) \ __pcpu_size_call_return2(this_cpu_cmpxchg_, pcp, oval, nval) +#define this_cpu_cmpxchg_local(pcp, oval, nval) \ + __pcpu_size_call_return2(this_cpu_cmpxchg_local_, pcp, oval, nval) #define this_cpu_cmpxchg_double(pcp1, pcp2, oval1, oval2, nval1, nval2) \ __pcpu_double_call_return_bool(this_cpu_cmpxchg_double_, pcp1, pcp2, oval1, oval2, nval1, nval2)