Received: by 2002:ab2:3141:0:b0:1ed:23cc:44d1 with SMTP id i1csp376479lqg; Fri, 1 Mar 2024 07:51:29 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCUEMK/JyAhUjX8yq7BFtiO8XW6Qomry+OBUIvmcFHqB6HLs/ITgi879wNps5nhS0STU/iSkK+MjWXoQxtwnFg0bvcVMtIh+nPvhMzUKpA== X-Google-Smtp-Source: AGHT+IH/SyHbONiltQMSLVK55V6RdwGGEYBivSCge/YeZNG+j7AhHx4fd78Tp13thMOxTJXKpBha X-Received: by 2002:a05:6830:22f4:b0:6e4:cfd4:877e with SMTP id t20-20020a05683022f400b006e4cfd4877emr786111otc.30.1709308289278; Fri, 01 Mar 2024 07:51:29 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1709308289; cv=pass; d=google.com; s=arc-20160816; b=uXs/gvqTQcN4wyiR/fcmBA4vaI9hwMS/R0kCVNnmKHwDghalIRTRfWmgTpB7y+bKgh oiR3q5aRvZeOjjfwb3paEm2ga/gfIyPtw1Eof2CFvhOQf4UP4MnwJt713PHwstYJoH+C xpVXlQvEMX37RUKOzBq+ISZGYdidVJQdMkDJONXXsHgk758tO9CkHb3P+dSnA/wMScil dJvlLXcrOgldrtvL5kTpslCoPVBOM+FHyqVtXsrOnMDZGbWDV4Q63DROE/sGXmQO1hSx xsFvElvU6a42yRf6ISe2R66WrN1A82gLOzr5Gu0GTAMawpRytqBZwE/LIFhp2lntARbX E5Ng== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:date:subject:cc:to :from:dkim-signature; bh=HbWnNzMjtf2Vwcxy/2U7UhLSFEOCGsArj12phpWpojo=; fh=Px8n5485VMW+PszSVMqClTsIRpLeKncr6Qm4BkQLwlA=; b=CGbGT2Xfot+5od/wHbzeea1nqNiDR4XgxQv01YLSSYHzeRKREgwvZioco1xlLU7ai1 udU1E9vYvGRLQd4aQyHEP4+BQTytkUFWIAD+xSg+S/bw351OdeC7XtQuBgZfpSg4v7Ci Ggity2uFgLdaWkinS4RapLfS2S6BfrZ1F+VwlY/j+43tFTRQOUSMd8lCi5/ex+2DfqJk GrCkzjni5/qHYfskZ172FBAHQDdLVpjKxMxJK3bTpmtrVzCiNomLbgCqvUmbG63Iv8nw dmtriSp0OOEUHJF1gi+FSH35+X6Gqaq2l/nAuUYDTR9X0XJ8nGbmPk35tIo6zsxaWQBC A0PQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=hxENJ5kg; arc=pass (i=1 spf=pass spfdomain=intel.com dkim=pass dkdomain=intel.com dmarc=pass fromdomain=intel.com); spf=pass (google.com: domain of linux-kernel+bounces-88642-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-88642-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id b25-20020a630c19000000b005dc55690b2bsi3984427pgl.324.2024.03.01.07.51.28 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 01 Mar 2024 07:51:29 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-88642-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=hxENJ5kg; arc=pass (i=1 spf=pass spfdomain=intel.com dkim=pass dkdomain=intel.com dmarc=pass fromdomain=intel.com); spf=pass (google.com: domain of linux-kernel+bounces-88642-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-88642-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id E462DB22A4A for ; Fri, 1 Mar 2024 15:51:27 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 630E76F514; Fri, 1 Mar 2024 15:51:22 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="hxENJ5kg" Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id EEBCD38DC3 for ; Fri, 1 Mar 2024 15:51:18 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.17 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709308281; cv=none; b=K/O6KOoh5g0FUbbySeAiAg0Cf1D67jOZGCJK/+0ONjX3sevqcyOZ8ZLTvi6WrpULYrsbGDZS/qkRNdzpxvK+MYAMpsXYz6kIu96P6+ljUIH2tKY0R6EDr4bgjbr2rwTZWh4Z4jNcl2eDWOg1kw2m/yMTB+ZLgZH/1g5kQsaPWp8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709308281; c=relaxed/simple; bh=d6MyUCxfd8VWHve1C20bkt0ftD6ke8XNB2uL/3fRcT8=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=pJ/3caYFOkHdfNsvz4j6pPzP6lFDtWe8383mnxRrkcqSW2p8rA7nL7cTA40WIpFRlQSQ9EKme3XOG0u8OIKtjspPNRU4G4/uV8t21+MSJPzsorWHkOQkwAx+f+hO6n0bebkXTP5QE7WZgl4w3Q6nJkfw/OSCPOLeGDsSWEDVcIs= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com; spf=pass smtp.mailfrom=intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=hxENJ5kg; arc=none smtp.client-ip=192.198.163.17 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=intel.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1709308279; x=1740844279; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=d6MyUCxfd8VWHve1C20bkt0ftD6ke8XNB2uL/3fRcT8=; b=hxENJ5kgqAHQtOXES5Ks2/IOAIspQUC45KT/d0svZ4g6WxOXh/8qdfUd Ud8d16EDKqiw6g7fc9slDVXni/80SGNfwj+A0GPbzU2XbA4vWC2CK4+tD Z80h1/DmoQ0YWILQ4+5S0WVacDlsjwp/7g+3MkwXLDmxUQD7iql4A8XJX nZ85STBOdeMlOBAMWevNlRz987MQe4F+74rJFGc82/b/w6KqDPom8/N9h vAxqnuCdPcR9QwezIJtH8MEQYTuDgYlhLfP/teNCeR+r7CXpH3oDQo1at ve7QyjrIr7iFFgRjNmo3Cd6/bExqaF2c9x4nj5rlHYjtpDR3dSOZi1+bM g==; X-IronPort-AV: E=McAfee;i="6600,9927,11000"; a="3700832" X-IronPort-AV: E=Sophos;i="6.06,196,1705392000"; d="scan'208";a="3700832" Received: from fmviesa008.fm.intel.com ([10.60.135.148]) by fmvoesa111.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 01 Mar 2024 07:51:18 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.06,196,1705392000"; d="scan'208";a="8370177" Received: from linux-pnp-server-09.sh.intel.com ([10.239.176.190]) by fmviesa008.fm.intel.com with ESMTP; 01 Mar 2024 07:51:15 -0800 From: rulinhuang To: urezki@gmail.com, bhe@redhat.com Cc: akpm@linux-foundation.org, colin.king@intel.com, hch@infradead.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, lstoakes@gmail.com, rulin.huang@intel.com, tianyou.li@intel.com, tim.c.chen@intel.com, wangyang.guo@intel.com, zhiguo.zhou@intel.com Subject: [PATCH v7 0/2] mm/vmalloc: lock contention optimization under multi-threading Date: Fri, 1 Mar 2024 10:54:15 -0500 Message-ID: <20240301155417.1852290-1-rulin.huang@intel.com> X-Mailer: git-send-email 2.43.0 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Hi, This version has the rearrangement of macros from the previous one. We are not sure whether we have completely moved these macros and their corresponding helper to the correct position. Could you please help to check whether they are correct? ~ 1. Motivation When allocating a new memory area where the mapping address range is known, it is observed that the vmap_node->busy.lock is acquired twice but one of the acquisitions is actually unnecessary. 2. Design Among the two acquisitions, the first one occurs in the alloc_vmap_area() function when inserting the vm area into the vm mapping red-black tree, and the second one occurs in the setup_vmalloc_vm() function when updating the properties of the vm, such as flags and address, etc. Combine these two operations together in alloc_vmap_area(), which improves scalability when the vmap_node->busy.lock is contended. By doing so, the need to acquire the lock twice can also be eliminated to once. 3. Test results With the above change, tested on intel sapphire rapids platform(224 vcpu), a 4% performance improvement is gained on stress-ng/pthread(https://github.com/ColinIanKing/stress-ng), which is the stress test of thread creations. rulinhuang [v1] https://lore.kernel.org/all/20240207033059.1565623-1-rulin.huang@intel.com/ [v2] https://lore.kernel.org/all/20240220090521.3316345-1-rulin.huang@intel.com/ [v3] https://lore.kernel.org/all/20240221032905.11392-1-rulin.huang@intel.com/ [v4] https://lore.kernel.org/all/20240222120536.216166-1-rulin.huang@intel.com/ [v5] https://lore.kernel.org/all/20240223130318.112198-2-rulin.huang@intel.com/ [v6] https://lore.kernel.org/lkml/aa8f0413-d055-4b49-bcd3-401e93e01c6d@intel.com/ rulinhuang (2): mm/vmalloc: Moved macros with no functional change happened mm/vmalloc: Eliminated the lock contention from twice to once mm/vmalloc.c | 314 +++++++++++++++++++++++++-------------------------- 1 file changed, 155 insertions(+), 159 deletions(-) base-commit: 10c2cf5fe97647d68ee89b1f921e982e71519f20 -- 2.43.0