From patchwork Mon Mar 13 16:25:12 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marcelo Tosatti X-Patchwork-Id: 13172847 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 36265C61DA4 for ; Mon, 13 Mar 2023 16:27:47 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id B35976B0075; Mon, 13 Mar 2023 12:27:46 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id AE5E86B0078; Mon, 13 Mar 2023 12:27:46 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 9D4BD6B007B; Mon, 13 Mar 2023 12:27:46 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id 8CE026B0075 for ; Mon, 13 Mar 2023 12:27:46 -0400 (EDT) Received: from smtpin06.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id 6344780C54 for ; Mon, 13 Mar 2023 16:27:46 +0000 (UTC) X-FDA: 80564406132.06.AEE6008 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by imf18.hostedemail.com (Postfix) with ESMTP id 8955F1C0010 for ; Mon, 13 Mar 2023 16:27:44 +0000 (UTC) Authentication-Results: imf18.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=KP0bl8SM; spf=pass (imf18.hostedemail.com: domain of mtosatti@redhat.com designates 170.10.133.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=1678724864; 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=X5A6sr5GdS/CRp9e0AjLg+A82o3GBDzuPA8yAWqGcJk=; b=kPryCB3NuXaeBT3zV6tLgUf8id6plPOacGgcwVMtdLJq4qEEiF2K4XE6iIzFV4xX1eFqpV uSMyvhqgxpLzZA09Nm4nZovlANHYEfH9M5bRQoH737X8metV/wjHbHtDxNV3IUz/uncAuF DVUzItk2+aCSIvO6jQwsr9aZN531QpE= ARC-Authentication-Results: i=1; imf18.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=KP0bl8SM; spf=pass (imf18.hostedemail.com: domain of mtosatti@redhat.com designates 170.10.133.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=1678724864; a=rsa-sha256; cv=none; b=AJw9OEOsDFLM/WYjbo1UPzx0q4u8hobH/7BcvFTOitSmgjvk5PP4g7J5UjfhLbccNQIU5H fhh7e1mvuYO+lkmMTD7fU3lcQDpM6OzXQ2fuT3yMwbcHl4Agm0iCdbEU965Tve0fDNrysa fDMLgKG2PfSSkD8jt1zaVB9MxBpiQ1Q= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1678724863; 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=KP0bl8SMX45Pjp83k0TT00YggphA/ZBIKYUsqMyiQCOjZOcu+56LxMt0Ti2k8ynvJNQQOg 3ACwC1KkRwimUdesvaZ9huHihhe/LaD+D13f3PJr3nZtRnjslVs8GN5myev1YfROLcPHQ2 6N5Rc30Xaz5ASXA4l7FO9z/yCbbh5Eo= Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-336-mFgJK7bbMs6HbOsxZVqtVA-1; Mon, 13 Mar 2023 12:27:42 -0400 X-MC-Unique: mFgJK7bbMs6HbOsxZVqtVA-1 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id DA28F3814947; Mon, 13 Mar 2023 16:27:41 +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 AB14C40C6E68; Mon, 13 Mar 2023 16:27:41 +0000 (UTC) Received: by tpad.localdomain (Postfix, from userid 1000) id 1EF8E4038A1E6; Mon, 13 Mar 2023 13:26:44 -0300 (-03) Message-ID: <20230313162634.383217649@redhat.com> User-Agent: quilt/0.67 Date: Mon, 13 Mar 2023 13:25:12 -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 , Marcelo Tosatti Subject: [PATCH v5 05/12] add this_cpu_cmpxchg_local and asm-generic definitions References: <20230313162507.032200398@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.2 X-Stat-Signature: me7goafijafk1y34ubidaiw8txdh8qyp X-Rspam-User: X-Rspamd-Queue-Id: 8955F1C0010 X-Rspamd-Server: rspam06 X-HE-Tag: 1678724864-575947 X-HE-Meta: U2FsdGVkX1/FVY/3YCFtLNHkPKz0tCGQA2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iMuwTb6gsUncUey8WazeNHL+G1JNKUZKaPPL3Y5smhpbVVpOPgERz3WUadFsYAwZZg4AGTKgPJHiQIyPYT5erLq0nB7yE0rflGZkmpaQGMvk1phjVRpATQaYQ== 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)