From patchwork Sun Mar 5 13:37:03 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marcelo Tosatti X-Patchwork-Id: 64313 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp1380099wrd; Sun, 5 Mar 2023 05:53:08 -0800 (PST) X-Google-Smtp-Source: AK7set/ooiHPt1sulrmF3n67t2aQ8k/S2m8ql0NjxIbnsNNddcfU1D3hpvgWGoLbvHSK/4AsNfYi X-Received: by 2002:a05:6a21:998b:b0:cd:7d01:7654 with SMTP id ve11-20020a056a21998b00b000cd7d017654mr8967639pzb.14.1678024388630; Sun, 05 Mar 2023 05:53:08 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1678024388; cv=none; d=google.com; s=arc-20160816; b=uEEDtKCPGEl3XdNKvOBL7MGwWZb/QwBc+JNWWyrDZV3UWUyxBFnaK4k3oxHfjnyRnH iJcEmRXZaPgEtVVK/3tRp50bcXAElKR1rNFne+7crbh6O5Yp8H+tRWIHFrtlmax7C5yK 9fWKUMlTEUleOgg6HVocgtvng3SJn/hOLHbagzx1ZCeQrsCo2OJwnMb7BpfJ1/MoPH4e icgbta2ZFfiFA3+FqkujW/fe+nshfViDtRIYPPiN+tNe2tO1IiWq0Xq22WMtoSnawOaO QZTo/ccwzTW775CJUVHjGHwQy3wKiyxbuQKMf9jPnokKrG8yndrJmE1R9f771j6LqkrP tzaQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:references:subject:cc:to:from:date :user-agent:message-id:dkim-signature; bh=X5A6sr5GdS/CRp9e0AjLg+A82o3GBDzuPA8yAWqGcJk=; b=rjPnibaEHIaCYDCcTaBJPzGd+GL1sOe25gsBNaZwPFvNV2BzWzY2Q35WjW2JQl/Xtv dVAk/cmW9pGnspB+R1dHWaXP+BA73MghbDwCiJILSQaBZVws3kPrZSo0qWbi59WHR5oV pqppGhq1MPr6L4ekpIA68YV40CvolYig01cmWC66onAKQGfdhSXxNXekYy+glUCP4/I6 y3udgSNL5lQyVyfZRzHZPtRJAi9jMudhNc+fuOLsrhm71XO/9w4KrDHaBPOPjAFr+njE 0QuUBbolraamd6GtY8yue2nW1TrqfREy+kcojimkyhBdD/HMdkTQXKooanLvA/KtYZzQ eT4Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=N6FS0KlJ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id x16-20020a63db50000000b00502d75b530fsi7144472pgi.681.2023.03.05.05.52.55; Sun, 05 Mar 2023 05:53:08 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=N6FS0KlJ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229915AbjCENni (ORCPT + 99 others); Sun, 5 Mar 2023 08:43:38 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54048 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229832AbjCENnV (ORCPT ); Sun, 5 Mar 2023 08:43:21 -0500 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 88AE413D42 for ; Sun, 5 Mar 2023 05:41:50 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1678023709; 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=X5A6sr5GdS/CRp9e0AjLg+A82o3GBDzuPA8yAWqGcJk=; b=N6FS0KlJSZ7DDDnaRsun8v+vC4BpWi/rcbIDUWNrFwKOaA3JZ8UoAFs7yfu993oCw/db7V tNUVAuV2Bug1BvHTXySjLQ9dt1mRfDmwEoBYw49sGWehKgssvIlliqKWus271N4STF6nI6 T2aN6j+CQhrbURuxM1Qf24AmtRxhVbE= 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-643-tu_aXllPNFqq4K3hRNnk7A-1; Sun, 05 Mar 2023 08:41:45 -0500 X-MC-Unique: tu_aXllPNFqq4K3hRNnk7A-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 F15BC1875041; Sun, 5 Mar 2023 13:41: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 8EEAC2166B26; Sun, 5 Mar 2023 13:41:44 +0000 (UTC) Received: by tpad.localdomain (Postfix, from userid 1000) id 2AAE0401A0FCD; Sun, 5 Mar 2023 10:41:23 -0300 (-03) Message-ID: <20230305134053.563070832@redhat.com> User-Agent: quilt/0.67 Date: Sun, 05 Mar 2023 10:37:03 -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, Marcelo Tosatti Subject: [PATCH v4 06/12] add this_cpu_cmpxchg_local and asm-generic definitions References: <20230305133657.255737580@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.6 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_NONE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1759536101790922949?= X-GMAIL-MSGID: =?utf-8?q?1759536101790922949?= 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)