From patchwork Thu May 23 08:00:31 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Uros Bizjak X-Patchwork-Id: 13671374 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 BC690C25B7A for ; Thu, 23 May 2024 08:01:48 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 67C886B008A; Thu, 23 May 2024 04:01:47 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 62BB86B008C; Thu, 23 May 2024 04:01:47 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 4FD4E6B0092; Thu, 23 May 2024 04:01:47 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id 22D1B6B008C for ; Thu, 23 May 2024 04:01:47 -0400 (EDT) Received: from smtpin29.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id C1C271C09E9 for ; Thu, 23 May 2024 08:01:46 +0000 (UTC) X-FDA: 82148916612.29.0502876 Received: from mail-lj1-f173.google.com (mail-lj1-f173.google.com [209.85.208.173]) by imf03.hostedemail.com (Postfix) with ESMTP id DF6A420002 for ; Thu, 23 May 2024 08:01:43 +0000 (UTC) Authentication-Results: imf03.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b="OH/f+Mtr"; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf03.hostedemail.com: domain of ubizjak@gmail.com designates 209.85.208.173 as permitted sender) smtp.mailfrom=ubizjak@gmail.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1716451304; 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-transfer-encoding:content-transfer-encoding: in-reply-to:references:dkim-signature; bh=ZluRRQ9XyXo20qI6tf/Kv1PIsqdwtqNbch7EYxePXUk=; b=BeDahVcfBwm3sWtw4hIxq6VnYU5GfPL5Y1AAgonFiQ0Y9K/WXYCmYhosIgOsuxozaHahZF 1skPLnPlUZVdqyMMgX09ofTVmyIoJtcT8ZD1Whv5jmxh/VzQ/ov/jW+LII8xtwh5FLfpj+ VfwaplgRLqmwqdCN46PggY21jjJSCZ8= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1716451304; a=rsa-sha256; cv=none; b=kw/D13tDg/J8bZ5D+FImWA040xbq1uNzzlSj+9d40es9UjLq1DJ+xUbXtTpgNS/Qq8Fm2R zHc9XOfeMHcLAJhWo67sXYTI9kG/dSaPnt1zvMVCEc7C/2V4OcRnU1t9rQ4iOhO/me1diG dSAqXaisikaYhalK2XkD4A3BwIsWIb8= ARC-Authentication-Results: i=1; imf03.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b="OH/f+Mtr"; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf03.hostedemail.com: domain of ubizjak@gmail.com designates 209.85.208.173 as permitted sender) smtp.mailfrom=ubizjak@gmail.com Received: by mail-lj1-f173.google.com with SMTP id 38308e7fff4ca-2e538a264f7so81500251fa.0 for ; Thu, 23 May 2024 01:01:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1716451301; x=1717056101; darn=kvack.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=ZluRRQ9XyXo20qI6tf/Kv1PIsqdwtqNbch7EYxePXUk=; b=OH/f+Mtrvyx2rrgzaqQ1yyjqaMwzbA715+3ylypTGLnEwbk0Mv6Wz+z23yMjm9UdTs iwwh48glFWXJ61AL23+CF539ipOEIchW4JwPQFU7jhW3xm3R87zBD4MQ5btYHCxpcyya CEzcXv/2y8nQ6oOGJW0fMpvAUouMPnAuWC9+YmmbaUNJDnC2z3FuSTc6Jg+z9RUPs5MU 1I8dN5hzVvTtO1UWT3gTjlRToBKgLvDl+P09ik6O1Z18ZJlkeSyVLmPMbyWlD3V4bXtg yX5Ip1EPLxB+nWLVBpYAFxIstqAtLSMxN4H2wvRs+qotJeApHK7k2YaHOBYFKZZ+iCHJ ey5Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1716451301; x=1717056101; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=ZluRRQ9XyXo20qI6tf/Kv1PIsqdwtqNbch7EYxePXUk=; b=WNf3SeXPP4fgmSUAfJj75mxBgTMm/ALHxf53cLek5y1oJ42zOfw5nn8p/SpyqDmFhH EGkNTsTYdho1AA80pzsfaOmBRfBworxj/mXPmMjqiJzHitg3J6QWMQQVJGAX5M6avA7E Xy0ldziv2KT1U2CCXhFiWdZZFd1Fu1mJ7AGh+2K5r5BSjDrJGQaH/VUbGMzTYu3tgMmr Yh7YTBGniqSthgyNVwiwnE4SXOHHmATiwb9yXxcrD3N7oInRxzzfXpqrwx1NsutuHVeF WlDEVNtz9VDqOtD7fclZNP52cenfQKpWbtVdn0PKhqmnWDQoWWXPUQUwUhaf+46aVHm7 DKpw== X-Gm-Message-State: AOJu0YwanE676ttNUxvDS1axWLsjHX1VsXN1zeSSm/Lm6R1MkWKF+iug NuvJCb5HLpLi6ynM9Q+Ca96PemKN96x7YrX1F3AswSIgWNOm7mPH08CyaE5vf88= X-Google-Smtp-Source: AGHT+IEP8QHHLCRarDBboaWu7hRaU4vf5dunldJNtpdKLpOgkI7yExL6vlD475Ef66rcj4+zUc8fIg== X-Received: by 2002:a2e:850a:0:b0:2d6:c43e:f0b3 with SMTP id 38308e7fff4ca-2e9496ba782mr25884081fa.50.1716451301010; Thu, 23 May 2024 01:01:41 -0700 (PDT) Received: from fedora.iskraemeco.si ([193.77.86.250]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-42100f1548bsm17489045e9.11.2024.05.23.01.01.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 23 May 2024 01:01:40 -0700 (PDT) From: Uros Bizjak To: linux-mm@kvack.org, linux-kernel@vger.kernel.org Cc: Uros Bizjak , Andrew Morton , Uladzislau Rezki , Christoph Hellwig , Lorenzo Stoakes , Dennis Zhou , Tejun Heo , Christoph Lameter Subject: [PATCH 1/2] percpu: Add __this_cpu_try_cmpxchg() Date: Thu, 23 May 2024 10:00:31 +0200 Message-ID: <20240523080136.9863-1-ubizjak@gmail.com> X-Mailer: git-send-email 2.45.1 MIME-Version: 1.0 X-Stat-Signature: f6m8z88x5xdkagettyjk4wz4uy88g4af X-Rspamd-Queue-Id: DF6A420002 X-Rspam-User: X-Rspamd-Server: rspam01 X-HE-Tag: 1716451303-983426 X-HE-Meta: U2FsdGVkX19sMtdQ2ETETzpMBiYGLLdptLcdwyCcZ4sZ1RhivtXOy0Iien4fGu7EspDFO1XQZ/L/GEGaF4ivgi8ApENs4PqiK/5YFIQv/KStpn8FCrBMxoL//PsUQRU9Eq1wVndketJsaNhYt7qLgYRp8mpaqItxJjfFM960q5M75UkRfRrCbAPNmJL2Eb+nDQX40qmlnbs0v9lw+j41c4+z+a+JMywj/JrBdaXauy5uNbLrE9pzQwfm6kZierXZ+PViPW3q2TFDNPysHrw3CYRVTgt0K9KRWuexo4OkWbfb3174Ug4kKiPahW9nFLAQkZH1/zRMtSktgr5lfTlb559/FLWIlzHCBTKcsnKnwGi9i9ePxzIcboybEtBMiUYVHeCTjhMtwIj8bqFxYKWC51D98du/7xZaAd2lbKxy5k889n1+nVTBiJ2MIMZhZ/Q5DblpXeabXjkH0Xqz/b7YPQyv32k6druWRB9X8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5NYXKOrTJ8/WV2jddGiHs4IzmW55d1kGHfPFlrMwhz+RtntwgMpwWLmEdDxPh/lOH2u93QvILsYv8Uy2ebAotFlZavL4V+cK7vqDrqaKp2aK1wDfm0S+U7H8VezIXLwQuCqzBdBKfgQWNVg1vEaMNTkarqHv1kdG8zPc X-Bogosity: Ham, tests=bogofilter, spamicity=0.000008, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: Add __this_cpu_try_cmpxchg() version of the percpu op. Signed-off-by: Uros Bizjak Cc: Andrew Morton Cc: Uladzislau Rezki Cc: Christoph Hellwig Cc: Lorenzo Stoakes Cc: Dennis Zhou Cc: Tejun Heo Cc: Christoph Lameter --- include/linux/percpu-defs.h | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/include/linux/percpu-defs.h b/include/linux/percpu-defs.h index ec3573119923..8efce7414fad 100644 --- a/include/linux/percpu-defs.h +++ b/include/linux/percpu-defs.h @@ -475,6 +475,12 @@ do { \ raw_cpu_cmpxchg(pcp, oval, nval); \ }) +#define __this_cpu_try_cmpxchg(pcp, ovalp, nval) \ +({ \ + __this_cpu_preempt_check("try_cmpxchg"); \ + raw_cpu_try_cmpxchg(pcp, ovalp, nval); \ +}) + #define __this_cpu_sub(pcp, val) __this_cpu_add(pcp, -(typeof(pcp))(val)) #define __this_cpu_inc(pcp) __this_cpu_add(pcp, 1) #define __this_cpu_dec(pcp) __this_cpu_sub(pcp, 1) From patchwork Thu May 23 08:00:32 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Uros Bizjak X-Patchwork-Id: 13671373 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 9FFF2C25B75 for ; Thu, 23 May 2024 08:01:47 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 1E87F6B0089; Thu, 23 May 2024 04:01:47 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 199636B008A; Thu, 23 May 2024 04:01:47 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 039316B008C; Thu, 23 May 2024 04:01:46 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id DE58A6B0089 for ; Thu, 23 May 2024 04:01:46 -0400 (EDT) Received: from smtpin15.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay05.hostedemail.com (Postfix) with ESMTP id 6671B403F0 for ; Thu, 23 May 2024 08:01:46 +0000 (UTC) X-FDA: 82148916612.15.3B35446 Received: from mail-wm1-f53.google.com (mail-wm1-f53.google.com [209.85.128.53]) by imf04.hostedemail.com (Postfix) with ESMTP id 84B774001A for ; Thu, 23 May 2024 08:01:44 +0000 (UTC) Authentication-Results: imf04.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=KTjUaqMj; spf=pass (imf04.hostedemail.com: domain of ubizjak@gmail.com designates 209.85.128.53 as permitted sender) smtp.mailfrom=ubizjak@gmail.com; dmarc=pass (policy=none) header.from=gmail.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1716451304; 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-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=ZJJ6AuEpcS/RPE/CUPbVaVlAztUWI2Z2Lb/LJ9UyRY0=; b=cziUCbMN/3kB1t451pjsVxft1YLlluIbDYuinwJUPPdi85HQ2AYXtYOPFw07btUyI14goe DsBwoxMQnFjBPijMsNqynCKKmUf5bqDsgDSQmBzx2mbRGPlnYfj7bbIYipbPJsiFp57kIN euKLYNhwn6i2zhMX6OZ98V3o5jfy0xI= ARC-Authentication-Results: i=1; imf04.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=KTjUaqMj; spf=pass (imf04.hostedemail.com: domain of ubizjak@gmail.com designates 209.85.128.53 as permitted sender) smtp.mailfrom=ubizjak@gmail.com; dmarc=pass (policy=none) header.from=gmail.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1716451304; a=rsa-sha256; cv=none; b=QNHVVifnGgbbVJUSzyJ4vwIzH9b5hgVBSZ4VMqiK9pubuPJRHGJBBIiJWhtGJmA/YQrF2x DlPE0c36jB6Fl4uwRlgaF7Yb2JC4/kBlxtVBSCHkJ4hw8e6VXo1jDszOHLwmkC44eDqzKN lFaoR3l9SiKHBMBG6UDW1b15Gvi8OHk= Received: by mail-wm1-f53.google.com with SMTP id 5b1f17b1804b1-42011507a4eso14793665e9.0 for ; Thu, 23 May 2024 01:01:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1716451302; x=1717056102; darn=kvack.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=ZJJ6AuEpcS/RPE/CUPbVaVlAztUWI2Z2Lb/LJ9UyRY0=; b=KTjUaqMjpJpHQIZJuAxmmec39o8ZitC/HtuzhtGFUFkdkm1dYxJutDk7QYoX47pSDQ H50HA80fDi/jeWXTAGhrQZ+U7UMLCuqF3qbNt/9OlsEd8PPyKXeaFabKIxXKueqctCia zg/HPF55dvWMt8oshA/DlfC1qTAnZ0RBLciMQg5kJISPKw7a4+rLoCTCozi01BXIvnu/ MxnTdoIWNc1MJpPbq0J4DA0ug7a9+x0j+9fWAQUBCnll5r3SnG02GQVxcb+0I0Lm+pqS HN//BWEF6Gw6R4mQKf2XnEmMrTHonTwe7CevusZOEn/KCgbSu6n3yx4Td2Z/GHCxnJiT 8mFA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1716451302; x=1717056102; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=ZJJ6AuEpcS/RPE/CUPbVaVlAztUWI2Z2Lb/LJ9UyRY0=; b=jqZRz+c1w3pkZZYzWtugRJT1HVyUv2K4FbcsMb2A+tQBWTEmn3HysLVCwmnIZ9s5u2 7lzosa2Ss4N4FEfxYc6XKw29p3oF/DtzIoFivV2OWr+npDxVt78s/3y7oOtLX5vmv2bu 5PZ1gTmk5YIY0O66Le8qDQyQGltJF3UjvN1GX96SY0DIN/mY79Yaqmq1prExFfBC8aiF xuwPRO6my8E3A1Oo9xsYPT3Jb6xrTF41g3/8sivzYqfaVzJ7rWbpvmTUh0ac1nNdA7uZ lziwcjiSVZoJCGileMgWg/Pg/w1Ev4MyQCK9icUrEvnyKv6f4XHOX8fZ5LePHu+k3H/w eqOg== X-Gm-Message-State: AOJu0YwGu83yMDkv7iUPkP1Jrkg9qbCfTY3DR5li62NoiSYETejzitLD qtvWjHkwRdN0XA6HkhaC061y2aHWBo+cE753EL19IOzW3pnkcAzW86hGaQXiQyA= X-Google-Smtp-Source: AGHT+IGxf8z+KBReL8dDRkf+3eZRAAFo/WXe1J5r3DlWJfOpykLJKaaRPtQPIQdbgfq4TfYmqGXuIg== X-Received: by 2002:a05:600c:4fc7:b0:41b:fbec:a53a with SMTP id 5b1f17b1804b1-420fd30e19dmr32547545e9.16.1716451301860; Thu, 23 May 2024 01:01:41 -0700 (PDT) Received: from fedora.iskraemeco.si ([193.77.86.250]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-42100f1548bsm17489045e9.11.2024.05.23.01.01.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 23 May 2024 01:01:41 -0700 (PDT) From: Uros Bizjak To: linux-mm@kvack.org, linux-kernel@vger.kernel.org Cc: Uros Bizjak , Andrew Morton , Uladzislau Rezki , Christoph Hellwig , Lorenzo Stoakes , Dennis Zhou , Tejun Heo , Christoph Lameter Subject: [PATCH 2/2] mm/vmalloc: Use __this_cpu_try_cmpxchg() in preload_this_cpu_lock() Date: Thu, 23 May 2024 10:00:32 +0200 Message-ID: <20240523080136.9863-2-ubizjak@gmail.com> X-Mailer: git-send-email 2.45.1 In-Reply-To: <20240523080136.9863-1-ubizjak@gmail.com> References: <20240523080136.9863-1-ubizjak@gmail.com> MIME-Version: 1.0 X-Rspam-User: X-Rspamd-Server: rspam09 X-Rspamd-Queue-Id: 84B774001A X-Stat-Signature: 4ybwt8c9xx7bkxguzwmkommi3rd363yj X-HE-Tag: 1716451304-824825 X-HE-Meta: U2FsdGVkX18DjCW5iNQthJB7EnWJ8ckoUhOmOxe4M2fjmy+kRLUbo6hFqcLD55L8KstRwehhRpEZ0/KruCSZ1AfqT2NJFR1mWqChwm4IrGxvFDX6nmh0d/o2YZazCEIOiWfYOC4/vq8UgbDcW7CNSacS/Ht+tZe0KbVYUFRVreRl7bm5irbQJQuY7PIP7eDSAxs4ArNnKD/N5q3+FobG02WSThklGfKt+omH4orqFLGGrgCKgarsEu/jiyzF1705xsrX1M0cUT37kGx5yZhmWuWaZKwQqUmIczTb8Z5eF5qV7ZrnFkMoPglUKP2VHzqbGODomE/WblTQOATeJgFlOlZVAGgDYQAh/ljMOH9+Rern67ATPLUt215DnovSk2ewOP1ULWfnyPCb5tpt3i2jz8RuKpcujGRq80wGi7L3YZfAmrBOaTLlZaR48yXuumWVgN5Oc0n09p8LbGzd/1XFecgCktXcYixQ4VFXPKJS2nR5sKv5GhVQmh3mme6hbUPcQIzUN/qr6/+vZPpfcqieUMtpe5ejQefKOkASRSHv3kfXb7hpcs/7V53l0yWAfIniBGPba7/GOU7PFD4NqvW83zYSmq4Jtg/eWVw0yEzMLCHvOZTw/Exkz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u96jvZ 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: List-Subscribe: List-Unsubscribe: Use __this_cpu_try_cmpxchg() instead of __this_cpu_cmpxchg (*ptr, old, new) == old in preload_this_cpu_lock(). x86 CMPXCHG instruction returns success in ZF flag, so this change saves a compare after cmpxchg. No functional change intended. Signed-off-by: Uros Bizjak Cc: Andrew Morton Cc: Uladzislau Rezki Cc: Christoph Hellwig Cc: Lorenzo Stoakes Cc: Dennis Zhou Cc: Tejun Heo Cc: Christoph Lameter --- mm/vmalloc.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/mm/vmalloc.c b/mm/vmalloc.c index 6641be0ca80b..0120faee5471 100644 --- a/mm/vmalloc.c +++ b/mm/vmalloc.c @@ -1816,7 +1816,7 @@ static void free_vmap_area(struct vmap_area *va) static inline void preload_this_cpu_lock(spinlock_t *lock, gfp_t gfp_mask, int node) { - struct vmap_area *va = NULL; + struct vmap_area *va = NULL, *tmp; /* * Preload this CPU with one extra vmap_area object. It is used @@ -1832,7 +1832,8 @@ preload_this_cpu_lock(spinlock_t *lock, gfp_t gfp_mask, int node) spin_lock(lock); - if (va && __this_cpu_cmpxchg(ne_fit_preload_node, NULL, va)) + tmp = NULL; + if (va && !__this_cpu_try_cmpxchg(ne_fit_preload_node, &tmp, va)) kmem_cache_free(vmap_area_cachep, va); }