From patchwork Mon May 15 18:00:21 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marcelo Tosatti X-Patchwork-Id: 13242011 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 E2B46C77B75 for ; Mon, 15 May 2023 18:03:52 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id C71BF900002; Mon, 15 May 2023 14:03:50 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id B1B43900008; Mon, 15 May 2023 14:03:50 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id A2EA9900006; Mon, 15 May 2023 14:03:50 -0400 (EDT) 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 725E4900006 for ; Mon, 15 May 2023 14:03:50 -0400 (EDT) Received: from smtpin29.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id 418EE141455 for ; Mon, 15 May 2023 18:03:50 +0000 (UTC) X-FDA: 80793262620.29.1E9B188 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by imf18.hostedemail.com (Postfix) with ESMTP id 20D8A1C0013 for ; Mon, 15 May 2023 18:03:46 +0000 (UTC) Authentication-Results: imf18.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=YSy5ojfd; spf=pass (imf18.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=1684173827; 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=a94r4AENExJkRuzy7tUNjpJxiBaQD3FYUW7dk6FaKb4fOvVb42bdgHawcPayUU+UkO6DCY wLKmok+uaPkPTuvyYS5uyswA0TGkcl38L/MQXWCdHcl13el4lg9Rh4cllt2xbCadKFTPuP Vyh9B3QmINWvqFKMNeDzhMPzNphy9Tg= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1684173827; a=rsa-sha256; cv=none; b=b1lFOGb59UVJRFaQmcQgH/03ujlVNkvzhn64p/vu56zA4ucihrNdmC0PsyS2+CttJGvbA6 Amd4rS78LWDKxujxb1ewz9AE0r19keCBRH9oQoSdwft1ksbrKMyXC6UApy8EvkvWlMB+rv Qx6KFXMMmWjYOPY5hxHPwzojjUshA4I= ARC-Authentication-Results: i=1; imf18.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=YSy5ojfd; spf=pass (imf18.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 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1684173825; 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=YSy5ojfdbe0fB/AJ5P9zYgd/ZPN6jPCBYYBDfP+2b/OF0q15pazTEugCjyKuPj3zgOPAxY gpErAvzxbUctc+5CW7lbd2UUsE9de18p0gZJeU1t6LNFDSIHMXA3A+vM/2JIuDRH+1pgiR BAcaGVAybSCGeJgGjLLU8YwwfBueqcY= 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-159-oDr3EEaKO8-jBZS-XI6F8g-1; Mon, 15 May 2023 14:03:41 -0400 X-MC-Unique: oDr3EEaKO8-jBZS-XI6F8g-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 41F9586C60B; Mon, 15 May 2023 18:03:41 +0000 (UTC) Received: from tpad.localdomain (ovpn-112-4.gru2.redhat.com [10.97.112.4]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 013F840C2063; Mon, 15 May 2023 18:03:41 +0000 (UTC) Received: by tpad.localdomain (Postfix, from userid 1000) id 5E4704161E528; Mon, 15 May 2023 15:02:17 -0300 (-03) Message-ID: <20230515180138.566700916@redhat.com> User-Agent: quilt/0.67 Date: Mon, 15 May 2023 15:00:21 -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 v8 06/13] add this_cpu_cmpxchg_local and asm-generic definitions References: <20230515180015.016409657@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.1 X-Rspamd-Queue-Id: 20D8A1C0013 X-Rspam-User: X-Rspamd-Server: rspam06 X-Stat-Signature: tcutqxkqnfisnt8qy85wqiidbirg7mrh X-HE-Tag: 1684173826-554795 X-HE-Meta: U2FsdGVkX1/AZ7URmQ0oE8ML/X6IE3XjXInI4J5B8oytpCcqOkinF2uv1XGIQmQpLUhtK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8A3v7eqhBzIS/NGAm7OtFIYbVpnDbBpinulBoS2ytoxbSc63dMXvuH6eijmvSyY9+tXg4XbeJ1sE= 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)