Received: by 2002:ab2:3319:0:b0:1ef:7a0f:c32d with SMTP id i25csp124220lqc; Thu, 7 Mar 2024 12:11:50 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCUF3DoOOLw0NK1IGxj6VKC3jw7ZctjVNgvGhAW9lfzSwNU2UazFVgblaeGlppGrGKkfl4PT9FjNFC23+2gdfNAgBYUV8izHnNWLiqfi9g== X-Google-Smtp-Source: AGHT+IFWeRMhFtVlmsP/PJl9w+kSUzcoAZ5x3iwlsVUrz3+vcDQbAu+DjhCab/YXGuk6MPZP4OaV X-Received: by 2002:a05:6102:38d2:b0:472:7619:1a60 with SMTP id k18-20020a05610238d200b0047276191a60mr11327734vst.28.1709842309787; Thu, 07 Mar 2024 12:11:49 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1709842309; cv=pass; d=google.com; s=arc-20160816; b=Gp0k1nu4G37BWHen6AXupbhApbTNBY77YpIpRVyVtm2pByNMOEdEOHW1GCC6PFpAeh WuKyMNxX1sRBRd3DGTsISj4ASMvquNyfpruI5z0NzxVBeID/yMCVEGQDLg5u37PwXpdj Drs96lClpMtVChqHUqYH66FEn+mijcGcLRiaNitRIWEnEjewcwx3tFs6qgywZLFZmOsc o7T30Wud7iJ1sCizUQNRMrx7R5GjftBy47DUfX4R1PIpQjcGeJCCvMBHFmp3NmeP43fP Bxu3nrqwTr3f9vEIpGqhCs9BTbWKNveOSXYSCnIb67sYeQSaGM/h0WqCicmY9qh1Y5YP Nz3w== 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:references:in-reply-to:message-id :subject:cc:to:from:date:dkim-signature; bh=fCvL6fbeKTOs1E3CWgQdqAS2CWjZtpr19Nxp2XeyqPo=; fh=rp8OyDr7TTDGr21zpTinkz7RBZB+PqzJigzxuTBt0ws=; b=a4g2BNgPOeieKeAFcHudpqTjvuAF2fujoGATQutOE2lHgXWtBfSQau706/qMw1+ktn 1Utft5diBRJ3vyvWFEAVL5Llf2h6c5FQBj6d6Ic/4yFlkdYb2WhXAePbB8VrGStKlLX3 2ZOKVGMyy8sMHVokAqnp8En3QQeb7XOT8JEeOH1oIDdISy2JjwIxD5wS3iZgxpUBcomj TKPAFWo0s9RYBeXjhBkHGAWRdKlRXu8D0kFZvdjE4ICEiwqT8Lg1e07vCzr/ihyvt5x9 nFWbncps56gaYeGR+jKRhQyWB0AG0aSWqJcSj5lYcP4x/XJY1nmaZvsrhsmq42d40395 fGkA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=korg header.b=SdNPdVcq; arc=pass (i=1 dkim=pass dkdomain=linux-foundation.org); spf=pass (google.com: domain of linux-kernel+bounces-96165-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-96165-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id n2-20020a0561023ec200b00472f4ff4688si999053vsv.711.2024.03.07.12.11.49 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 07 Mar 2024 12:11:49 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-96165-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=korg header.b=SdNPdVcq; arc=pass (i=1 dkim=pass dkdomain=linux-foundation.org); spf=pass (google.com: domain of linux-kernel+bounces-96165-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-96165-linux.lists.archive=gmail.com@vger.kernel.org" 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 ny.mirrors.kernel.org (Postfix) with ESMTPS id 4DAD71C21F4F for ; Thu, 7 Mar 2024 20:11:22 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 33FE6138481; Thu, 7 Mar 2024 20:11:15 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux-foundation.org header.i=@linux-foundation.org header.b="SdNPdVcq" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 54F79137C52 for ; Thu, 7 Mar 2024 20:11:14 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709842274; cv=none; b=kJF1fUiIDD0QIvz7rn/lv9KajSEt8fAqfMV3q5RGheW8eW5RE+YJCkkt0hOctohGeWU9aGt1pG63lwEcZHTeF/5Mic7K4wyL5ZZJdk6zUpFsgYUzXoiPN0OPRPQZLSW2hOuNHoCcKbtfMJCkckX4NEat8hMi/NOExszFsq70pQQ= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709842274; c=relaxed/simple; bh=B6mfEbg7m6R6+7MIeFP+NGCTEGpLaAV/oieLgTsxJJg=; h=Date:From:To:Cc:Subject:Message-Id:In-Reply-To:References: Mime-Version:Content-Type; b=lJuh+SB6JdpifNOWOjNlsuEVAhnfjY2y8GQTgUPQUTSJnySIuhVU6uSpE5+s8cXiacuzVbNNmDj5P6shYKYpYm/vERlfl0N8wt3mn6qPdgeEP8EEn0kmSIw9shLry+2uqg22k5YwLTnTcUN81ezDxKrilmyljTmgDeXAnAoa1gg= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux-foundation.org header.i=@linux-foundation.org header.b=SdNPdVcq; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id A7751C433C7; Thu, 7 Mar 2024 20:11:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linux-foundation.org; s=korg; t=1709842274; bh=B6mfEbg7m6R6+7MIeFP+NGCTEGpLaAV/oieLgTsxJJg=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=SdNPdVcqPXz6WFeB8AcTxbuot3VsDMqNuXo9pWXMDBY+e7UjrNYXofmz6G33eO8js 0vmqVGIwlHF7Q752/q21DZhsgjO5e5uEJnuYRxDJ0clsrt2Hflx4VhGX4mscTvLgEF hLL3jWHamjjmzSJyz4rLUtusAUEN7GmKHklWX6Ls= Date: Thu, 7 Mar 2024 12:11:13 -0800 From: Andrew Morton To: rulinhuang Cc: urezki@gmail.com, bhe@redhat.com, colin.king@intel.com, hch@infradead.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, lstoakes@gmail.com, tianyou.li@intel.com, tim.c.chen@intel.com, wangyang.guo@intel.com, zhiguo.zhou@intel.com Subject: Re: [PATCH v8] mm/vmalloc: Eliminated the lock contention from twice to once Message-Id: <20240307121113.16cc480515195f1fe945bbac@linux-foundation.org> In-Reply-To: <20240307021440.64967-1-rulin.huang@intel.com> References: <20240307021440.64967-1-rulin.huang@intel.com> X-Mailer: Sylpheed 3.8.0beta1 (GTK+ 2.24.33; x86_64-pc-linux-gnu) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit On Wed, 6 Mar 2024 21:14:40 -0500 rulinhuang wrote: > 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. > > The first acquisition occurs in the alloc_vmap_area() function when > inserting the vm area into the vm mapping red-black tree. The second > acquisition 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. > > 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. > Thanks. We're late in -rc7 so I'll queue this up for merging in the next merge window.