From patchwork Thu Feb 9 15:01:56 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marcelo Tosatti X-Patchwork-Id: 13134758 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 80A76C636D6 for ; Thu, 9 Feb 2023 15:33:39 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id C55246B007E; Thu, 9 Feb 2023 10:33:25 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 5F1746B0074; Thu, 9 Feb 2023 10:33:25 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 30E126B0074; Thu, 9 Feb 2023 10:33:25 -0500 (EST) 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 B61F96B0082 for ; Thu, 9 Feb 2023 10:33:24 -0500 (EST) Received: from smtpin17.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id 48B14AAF01 for ; Thu, 9 Feb 2023 15:33:24 +0000 (UTC) X-FDA: 80448147528.17.280960C 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 703C41C0019 for ; Thu, 9 Feb 2023 15:33:22 +0000 (UTC) Authentication-Results: imf18.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=VUbEwTbq; 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=1675956802; 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=xttH7836oXgQ2gV7qXbyD6NGWlFVj+CDeiD3JQB+5E4=; b=FX32Qm1o4HqrSIOVFDO+6/eQr7W9ASn50a39fZcURiEaHVga9WHLTKf4Cq6PJA6bUp5ADy P0zk7Xp9GMsdECmpLrxEccQ9fP4fDMIsRI8ZUINsaJOpAhqUwk8dXgJ4n8BfGhZz2lPdPC +Vf0zTzcmABM6FrOuGH8lNlTEg1E8XQ= ARC-Authentication-Results: i=1; imf18.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=VUbEwTbq; 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=1675956802; a=rsa-sha256; cv=none; b=2aFKonNTRnBw3xVp3a+zALGkN8DWJrikUrYfcQwKJMSyuYkTI10ktAtSIjZ417j3efmrRJ hkforfSlUox2yX+jEn3cVNGSxHZoIJK2FG2epVzT7/22roNl5CgmpwFDxxMfFANCD4OcSm EgSlI0opi4SU8lyYMvhr2QWDWJ2rgYs= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1675956801; 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=xttH7836oXgQ2gV7qXbyD6NGWlFVj+CDeiD3JQB+5E4=; b=VUbEwTbq2UObIG4CHg4wlLVgxr8/amvl3aOU8tb0z5RGuUbueIETdcFCoKeKxTvXV7C57Y /ykt3gal6iKncmBEm57gMCx1Zh+OkRJotOzKXd+jy/1PBJD/6CJ+4uB1bxX0rM453IZXz1 G3aOnAhZ0jCOjzehyCARFn8u0kvXzog= 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-590-HxuIk-9sP12Q212hs8jtxA-1; Thu, 09 Feb 2023 10:33:18 -0500 X-MC-Unique: HxuIk-9sP12Q212hs8jtxA-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 937E12807D6E; Thu, 9 Feb 2023 15:33:16 +0000 (UTC) Received: from tpad.localdomain (ovpn-112-3.gru2.redhat.com [10.97.112.3]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 6690740398A2; Thu, 9 Feb 2023 15:33:16 +0000 (UTC) Received: by tpad.localdomain (Postfix, from userid 1000) id 77799403CC079; Thu, 9 Feb 2023 12:32:51 -0300 (-03) Message-ID: <20230209153204.791818567@redhat.com> User-Agent: quilt/0.67 Date: Thu, 09 Feb 2023 12:01:56 -0300 From: Marcelo Tosatti To: Christoph Lameter Cc: Aaron Tomlin , Frederic Weisbecker , Andrew Morton , linux-kernel@vger.kernel.org, linux-mm@kvack.org, Marcelo Tosatti Subject: [PATCH v2 06/11] this_cpu_cmpxchg: asm-generic: switch this_cpu_cmpxchg to locked, add _local function References: <20230209150150.380060673@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.2 X-Rspamd-Server: rspam05 X-Rspamd-Queue-Id: 703C41C0019 X-Stat-Signature: ygwdk6n3jd4r35zwre3gkdpwcmh4ch8c X-Rspam-User: X-HE-Tag: 1675956802-693857 X-HE-Meta: U2FsdGVkX192l1JckkI4XxZI59MtcdRQt7oubQLGV144a/1X4wM5kkexoLK72F4xSiDZUPUVWom1Y+MV5Q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QwUDT8vGr6IW2Vo3V8vKOOrmxYukJo12y9DucCw+UieoWOEqxjOuiqbbqmvFN2V1hw98CxHlKeA4W+9AOpD67LsUdmw== 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)