Received: by 2002:a05:7412:cfc7:b0:fc:a2b0:25d7 with SMTP id by7csp1951104rdb; Tue, 20 Feb 2024 11:54:47 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCUW7XHnzX0LI3lknN8djtP4IFuObSkI5j3zVgdTxN7wxee73dklbAy3HXw8MrjNOctLCft+RnSG7tzelKGtXRL2Rm4dvvDKzQs+yYgRag== X-Google-Smtp-Source: AGHT+IFI4w3/QQb3NtKBp/4dqwJ3VV3QHt+rLi065eWXuuufPr3/WMICDrzQvoptqwfT4b6RtroS X-Received: by 2002:a17:906:f8ca:b0:a3e:ff8d:c6d9 with SMTP id lh10-20020a170906f8ca00b00a3eff8dc6d9mr1785886ejb.71.1708458887380; Tue, 20 Feb 2024 11:54:47 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708458887; cv=pass; d=google.com; s=arc-20160816; b=JFyf9NqutRxevNQCWEAgBwB170xMe++xPtGFPjcrPFFDHxK2EN2Ax6TNZa6J4v6aqf vHecBeqeAoXA4ID1U3LaF0yObo0QCyYE8gFtsy8WG2I4RHAz9HTDUZMDLKp7pAHRRAnU TJbovYt16ZMpQiFvuJZKaLABf6LwnFUQMIGpHXeaDmdjGZG/NBrsRBQ6ZvsrQ8+tAlFu I/UMm4ZBQJrEubkzrimn/x5p24LJdXT+WFsj7OGvoX1d9RQiSZssP7w12CfXTQrAh4MH 1lXY4jqKczujFTRUJkex01SSIPRraVMc2MfK7DFMxkmdblOIQ0PnGmU0Skp3SLpL1O4R vKCA== 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=Kh428TaamPep3v/kzMn0/vH06onidg0kyWRuhzTBbp4=; fh=NtYcQR+8YbgsfkrCBScO9F/E1hCD8DNvtWI20aA/uwM=; b=gwFFNhtHiT78vB6fHnmEPVQEb0bTx6r4ffInm6aRt3lriBoLmHUgbJPjQvyyT2WTgp wcfpTeoD4hvdK4uFF6XET6EPhWMk7sCzCsX8bydAOn1RfHFNV0RLDxFMAnKBwbRDnEcl Xyi5W+Lv2UU5m26M9Y7HfXXXzA1ZO0DUCH7hPV1PL/b3071QiIzsYV8gmEE1MlIFy+h8 ygtwv81pmLGuqZGEMP1mKB6a6NV+SpCEPlRcI3QZ9SNWKqSewLwg30Yui8J3fQ5R0dUu UOWMjHH/AoGuEiH+dPuV5NxRInh+Uozq+oWXzSKVb2Ya/tYelujO5DjVdjrcJIRm+HZZ zCVg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=korg header.b=okAhoWU3; arc=pass (i=1 dkim=pass dkdomain=linux-foundation.org); spf=pass (google.com: domain of linux-kernel+bounces-73624-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-73624-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id go10-20020a1709070d8a00b00a3f15778a0dsi525549ejc.1037.2024.02.20.11.54.47 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 20 Feb 2024 11:54:47 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-73624-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=korg header.b=okAhoWU3; arc=pass (i=1 dkim=pass dkdomain=linux-foundation.org); spf=pass (google.com: domain of linux-kernel+bounces-73624-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-73624-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 am.mirrors.kernel.org (Postfix) with ESMTPS id 1E6581F21B35 for ; Tue, 20 Feb 2024 19:54:47 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 25FBA14A4D0; Tue, 20 Feb 2024 19:54:36 +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="okAhoWU3" 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 3E02578B75 for ; Tue, 20 Feb 2024 19:54:34 +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=1708458875; cv=none; b=sOX3G65Lv7hDR17nmDXWoRuOB6imRpnz2IavE8vJS7kGRh9isNM7YReupw32kzK53vMVpsOIIbnK6mLmjtOF+xjbbYVWOq2YOq2r2i3R/xjH3nHDArNq9I4+ONNQnKSYvOegO9MOxtR2kc8QsZtXb6927LlgRAF6FOeaXsLnmcI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708458875; c=relaxed/simple; bh=zyWiwr3kr66iv0H03kPtFHH2VSqtORK0ZNZADANCIcU=; h=Date:From:To:Cc:Subject:Message-Id:In-Reply-To:References: Mime-Version:Content-Type; b=R9uSfQR+K9qwssBtIuJ3D9HEhkc06pt+O4VH4EZbK2jHnPOXPWJAwb1QJWkcB/AY28ffsXPWsElfhSiUUrLu1oWpl2O18+hMoZmgWQhvC+aI7OrncRGly9XtsPZhQF9/gKZFgPXZdq2ll1gWmkEVQpkAqOuUx5/g0o9A/WVHDW0= 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=okAhoWU3; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 54B1DC433C7; Tue, 20 Feb 2024 19:54:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linux-foundation.org; s=korg; t=1708458874; bh=zyWiwr3kr66iv0H03kPtFHH2VSqtORK0ZNZADANCIcU=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=okAhoWU32N05cVz5+oGrrMXDJO7CCJ1uiIk/Bu7Kpix5pkm2k2o/AyZ1ED3wH44Jq G6nrzwhvSXazF055COs6GP12x13Odg9UqMizQi/Xv30izglzJd9njeOeYQRWJOZT7K NZM9xRpW8qKT0CXJaTJKFjRkXpSnKPzKbGMDVSuQ= Date: Tue, 20 Feb 2024 11:54:33 -0800 From: Andrew Morton To: rulinhuang Cc: urezki@gmail.com, colin.king@intel.com, hch@infradead.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, lstoakes@gmail.com, tim.c.chen@intel.com, zhiguo.zhou@intel.com, wangyang.guo@intel.com, tianyou.li@intel.com Subject: Re: [PATCH v2] mm/vmalloc: lock contention optimization under multi-threading Message-Id: <20240220115433.4d76e50c46454f7aabb7b93d@linux-foundation.org> In-Reply-To: <20240220090521.3316345-1-rulin.huang@intel.com> References: <20240209115147.261510-1-rulin.huang@intel.com> <20240220090521.3316345-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 Tue, 20 Feb 2024 04:05:21 -0500 rulinhuang wrote: > When allocating a new memory area where the mapping address range is > known, it is observed that the vmap_area 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_area lock is contended. By doing so, > the need to acquire the lock twice can also be eliminated. > With the above change, tested on intel icelake platform(160 vcpu, kernel > v6.7), a 6% performance improvement and a 7% reduction in overall > spinlock hotspot are gained on > stress-ng/pthread(https://github.com/ColinIanKing/stress-ng), which is > the stress test of thread creations. vmalloc.c has changed a lot lately. Please can you work against linux-next or against the mm-unstable branch of //git.kernel.org/pub/scm/linux/kernel/git/akpm/mm Thanks.