Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp2414663rwd; Mon, 15 May 2023 11:18:42 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6bB6iS6t+wPKL2oa3zicMynbp/7msEGvaYc5Z/uwyfrz/v7+WGmnsmzYm5TpxMgehSpyTT X-Received: by 2002:a05:6a21:3299:b0:100:6863:8be7 with SMTP id yt25-20020a056a21329900b0010068638be7mr33653214pzb.62.1684174722522; Mon, 15 May 2023 11:18:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1684174722; cv=none; d=google.com; s=arc-20160816; b=dmEAuPznDzQFdqj0p062fhv0jVxmnKZVxsv4qzhShP1X0PCLbx0nAAn14tCEs4NZYs huP7Q77ySJNJcpYM0iL7D0aW/aULxRj9DG+7G8qnrSDetXES+YE2cwu5xhDYPNCWE9b5 7ImV87XHg2jAj5UCMPY37OMojlP3a9CWuwmKpZuePglY98jisKtC8r9NyZ4Rs6aHD0M9 doO5djW33WrjBuG4l8HuIGGz4M+3s3cVnhqTFPCZDoRttVA+g2SavyDhTbCnHg+OInFM siAKlnXRlP0scP94lJ/o4gZPmLhp4PniMb0qeYe2cQiKmXUZb9xt1Fd4NA7oi62v8oXE Jr2g== 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=BJ6i2oDSiY3YdcuHRj+4qVRIpmZay1wZiVJ33jyxj48=; b=tUH0CdHmWuDKWdnTWEV9wVD2a2yWNRnU3Cy6+UkB4dLijXcjWddTM2ykDjsWyXqDie h6QOypyq5FrnctkHjOwc4RtSk4i+HSUBWC8lrArqH9lA80ccOrUV5uH8NEHzmAnasTNV V/lo4YIq1har1GmI1uLLRU/W8nbraI/Ngx5MGYGricb4tsTeZ90sIyV9UHClbik2wcFJ RynsZFicJTx7EDa9Ckjylz6qJJ0H9TpoHZvumdDewt5hOcl317t8dRXLjznzPuPeShTS yIdfJNUGB8cVmbBdgxByH2vpI8ClgPuly23DmTMT9XfCxIKNqFmTTsSdVnfZg8Lp4lB8 aN4A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=PjSIb+Ln; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id z19-20020a63e113000000b00530878c182fsi9878089pgh.289.2023.05.15.11.18.30; Mon, 15 May 2023 11:18:42 -0700 (PDT) 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=PjSIb+Ln; 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 S245109AbjEOSHl (ORCPT + 99 others); Mon, 15 May 2023 14:07:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39894 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S245020AbjEOSGr (ORCPT ); Mon, 15 May 2023 14:06:47 -0400 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 A968F659B for ; Mon, 15 May 2023 11:03:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1684173827; 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=BJ6i2oDSiY3YdcuHRj+4qVRIpmZay1wZiVJ33jyxj48=; b=PjSIb+LnT91LxWlqsyWhcdESZ9VlPFgya2xGxH8emPMgoTgXS8CONHs3Xl5vKmaAkaFmCC H+CxZfaEBtEtPMBeFoeKPf34gJGx1iVvHFRRe4gjYhpS0QJinxBIOZ1W3JQp2k9VEEY9dy 7EgEWmQt5Mhd6b9a6h5gOnD8tpRuFdQ= 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-159-HcyxXZ_fOKim-3NV21rk8g-1; Mon, 15 May 2023 14:03:42 -0400 X-MC-Unique: HcyxXZ_fOKim-3NV21rk8g-1 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 64E8A382C96A; 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 2E3102026D25; Mon, 15 May 2023 18:03:41 +0000 (UTC) Received: by tpad.localdomain (Postfix, from userid 1000) id 65C8A4161E529; Mon, 15 May 2023 15:02:17 -0300 (-03) Message-ID: <20230515180138.591710284@redhat.com> User-Agent: quilt/0.67 Date: Mon, 15 May 2023 15:00:22 -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 , Peter Xu , Marcelo Tosatti Subject: [PATCH v8 07/13] convert this_cpu_cmpxchg users to this_cpu_cmpxchg_local References: <20230515180015.016409657@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.4 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, SPF_HELO_NONE,SPF_NONE,T_SCC_BODY_TEXT_LINE 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 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). Acked-by: Peter Xu Signed-off-by: Marcelo Tosatti --- Index: linux-vmstat-remote/kernel/fork.c =================================================================== --- linux-vmstat-remote.orig/kernel/fork.c +++ linux-vmstat-remote/kernel/fork.c @@ -205,7 +205,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 @@ -83,7 +83,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);