From patchwork Thu Feb 9 15:01:57 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marcelo Tosatti X-Patchwork-Id: 13134761 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 92E29C61DA4 for ; Thu, 9 Feb 2023 15:33:44 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 99DA46B0083; Thu, 9 Feb 2023 10:33:29 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 94F1E6B0085; Thu, 9 Feb 2023 10:33:29 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 7EDDF6B0087; Thu, 9 Feb 2023 10:33:29 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0010.hostedemail.com [216.40.44.10]) by kanga.kvack.org (Postfix) with ESMTP id 691076B0083 for ; Thu, 9 Feb 2023 10:33:29 -0500 (EST) Received: from smtpin15.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id 44F2E8095C for ; Thu, 9 Feb 2023 15:33:29 +0000 (UTC) X-FDA: 80448147738.15.81418B8 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by imf19.hostedemail.com (Postfix) with ESMTP id 5A6F61A001D for ; Thu, 9 Feb 2023 15:33:27 +0000 (UTC) Authentication-Results: imf19.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=RrRcKlxs; spf=pass (imf19.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=1675956807; 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=ofXkymEHUHbiccFSxfE3RKhTo0FLU9PUEYKbx6pPdBY=; b=wC3sT9jySzIysaMumFNJYHQy8yd7CI109vIAGxreojV76OwdC0qp7J2L4OUfbLqGdcn+ti UywJ/dHPDuFfOUOEqJllNr10vXD5DAg2/6Po8not6LyNPzgVIc89HNPtsBMKn/6Mzk+I1Z mfqz1z/+NiVtNVjQeNvmYOOShy1Yy4Q= ARC-Authentication-Results: i=1; imf19.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=RrRcKlxs; spf=pass (imf19.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=1675956807; a=rsa-sha256; cv=none; b=LdrpuSSDS4XuiukfZO8VbGC5kYrnVZR3ZVZrhmFACFj558WzenupvZuZeXmcdxyWB3s5+q +dhiiXEjKyV4bpDMrP2EPHzlo+LVjHQtQ+XNPkRMxzazKINyTIGwbNsOeKVPTutsUlbria p6rvEKrf5SKEq5E+ZngN37d3DLNojX4= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1675956806; 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=ofXkymEHUHbiccFSxfE3RKhTo0FLU9PUEYKbx6pPdBY=; b=RrRcKlxsnPdV/OEnVVKV48PKnGf0yZs34qcxxBh69qVPX8LijfyynheyWQxMttl+Kh/xFk neeo2q3H5GXquerHpQK8qiubUoiVw/4YkzmZIvAfBYmWU+4CxcfrXMUr63PdPiurKoNggs m8L7vWXi2pr0tbPg0o6lqGHtUJe6Wjw= 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-311-w-j-N1OhMzS0AJa82rbJ1A-1; Thu, 09 Feb 2023 10:33:18 -0500 X-MC-Unique: w-j-N1OhMzS0AJa82rbJ1A-1 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 799E13C10ED3; 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 4C3921121314; Thu, 9 Feb 2023 15:33:16 +0000 (UTC) Received: by tpad.localdomain (Postfix, from userid 1000) id 7BB57403CC07A; Thu, 9 Feb 2023 12:32:51 -0300 (-03) Message-ID: <20230209153204.818774692@redhat.com> User-Agent: quilt/0.67 Date: Thu, 09 Feb 2023 12:01:57 -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 07/11] convert this_cpu_cmpxchg users to this_cpu_cmpxchg_local References: <20230209150150.380060673@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.3 X-Rspam-User: X-Rspamd-Server: rspam04 X-Rspamd-Queue-Id: 5A6F61A001D X-Stat-Signature: zpbidxhk4gq53qzx8561uce1ygjnftts X-HE-Tag: 1675956807-111503 X-HE-Meta: U2FsdGVkX18uSbpPp8ZGfcE6dd27T593cGDAMyJps/tAsGoPdUxRQky4wZazI+sPim/q2g+kGhIXiFZ6kUAQ1u/tt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oDJQ8urstxifXYpVCDno7usX/NWr3kiLBJAYng= 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: this_cpu_cmpxchg was modified to atomic version, which can be more costly than non-atomic version. Switch users of this_cpu_cmpxchg to this_cpu_cmpxchg_local (which preserves pre-non-atomic this_cpu_cmpxchg behaviour). Signed-off-by: Marcelo Tosatti Acked-by: Peter Xu Index: linux-vmstat-remote/kernel/fork.c =================================================================== --- linux-vmstat-remote.orig/kernel/fork.c +++ linux-vmstat-remote/kernel/fork.c @@ -203,7 +203,7 @@ static bool try_release_thread_stack_to_ unsigned int i; for (i = 0; i < NR_CACHED_STACKS; i++) { - if (this_cpu_cmpxchg(cached_stacks[i], NULL, vm) != NULL) + if (this_cpu_cmpxchg_local(cached_stacks[i], NULL, vm) != NULL) continue; return true; } Index: linux-vmstat-remote/kernel/scs.c =================================================================== --- linux-vmstat-remote.orig/kernel/scs.c +++ linux-vmstat-remote/kernel/scs.c @@ -79,7 +79,7 @@ void scs_free(void *s) */ for (i = 0; i < NR_CACHED_SCS; i++) - if (this_cpu_cmpxchg(scs_cache[i], 0, s) == NULL) + if (this_cpu_cmpxchg_local(scs_cache[i], 0, s) == NULL) return; kasan_unpoison_vmalloc(s, SCS_SIZE, KASAN_VMALLOC_PROT_NORMAL);