From mboxrd@z Thu Jan 1 00:00:00 1970 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 AC06BC48BC3 for ; Tue, 20 Feb 2024 19:54:43 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 090976B006E; Tue, 20 Feb 2024 14:54:43 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 040326B0071; Tue, 20 Feb 2024 14:54:42 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id E4A2A6B0072; Tue, 20 Feb 2024 14:54:42 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) by kanga.kvack.org (Postfix) with ESMTP id D38166B006E for ; Tue, 20 Feb 2024 14:54:42 -0500 (EST) Received: from smtpin09.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id 76E33A0B42 for ; Tue, 20 Feb 2024 19:54:42 +0000 (UTC) X-FDA: 81813234804.09.00CA282 Received: from sin.source.kernel.org (sin.source.kernel.org [145.40.73.55]) by imf22.hostedemail.com (Postfix) with ESMTP id 65389C000D for ; Tue, 20 Feb 2024 19:54:38 +0000 (UTC) Authentication-Results: imf22.hostedemail.com; dkim=pass header.d=linux-foundation.org header.s=korg header.b=okAhoWU3; dmarc=none; spf=pass (imf22.hostedemail.com: domain of akpm@linux-foundation.org designates 145.40.73.55 as permitted sender) smtp.mailfrom=akpm@linux-foundation.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1708458879; 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-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=Kh428TaamPep3v/kzMn0/vH06onidg0kyWRuhzTBbp4=; b=rz1oXyhoZyriVxGoYjE2KafRtnkqVsF+aPjKkL2EGeis/IDWXD7dnQ2w64NUYtZjM5B55E HlyX7w4EgoD9Ff3jIFr1sT0QK8EJeqJVTdi8EYKudeTfqUecxu7dIexvLwMjs3gjyYRpPt nwx3TQF62D72mDRkN2RG2hxVDWXt5sg= ARC-Authentication-Results: i=1; imf22.hostedemail.com; dkim=pass header.d=linux-foundation.org header.s=korg header.b=okAhoWU3; dmarc=none; spf=pass (imf22.hostedemail.com: domain of akpm@linux-foundation.org designates 145.40.73.55 as permitted sender) smtp.mailfrom=akpm@linux-foundation.org ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1708458879; a=rsa-sha256; cv=none; b=bBLACyzAbj8hfR9vO/52rTKOdfJzW9tVtaPiM3I7o6jrIDezp/I4oc9VshZF3bAzRhWyk/ L8xNVo6fezVyZi6kYK+fiOy49wtRzyK+Xl59x1KsH0feti6y+a4vb8sgDZeKekOw+rC91N 3AUVXGdKUFF/pU2qF0Yh2ccO+JkEZ+4= Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by sin.source.kernel.org (Postfix) with ESMTP id 6DA14CE1230; Tue, 20 Feb 2024 19:54:35 +0000 (UTC) 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) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Rspamd-Queue-Id: 65389C000D X-Rspam-User: X-Rspamd-Server: rspam04 X-Stat-Signature: t7p1c9ozwshuunj9oi7sdc4quz9r88d8 X-HE-Tag: 1708458878-796134 X-HE-Meta: U2FsdGVkX18v9hoGUEcJgOIex8U9X46XFRopUy/RNMIU1jB61EEvYtuM0sbIpvwwGAZ329B48Etf/mq3w4WcMon+kYDvKTqGwbHqZ/P4WR27hmlRTF+GKlCHNqB+KM9ZXJDYfpsjphiIdx3cDTL2+2TDB4iyPrOLfAkZSntTulgt1fta2lUjvPeyG7/dCCqdaCrVL6pi+jQFV/buLHTNfsw2kwYTjqEMg7SZIATb1poK1eytascF8VmmkbgaRlzUqC+dMLtTR5caajWbvOwffe2T0UkJtMkzgaxJWKmJoMYGr95znErb/6QmK4mPH4I2gxmxt+Alz+3kqZnEikznccn1msmt980ZeqW+RgSU3rGQjw4tUWtqiTXw8Z1i/6f1mDmWbpDsH9fGh/3txmEjo2wWPLi4SEwMkukZUn7xqA2Bf4Lud7XcUPmAfB9JoyeHyQYsnS8KN3m5GDuwKd2/sWQ/91RTZMEOPeofi1Icdfn9oYzSbeIpOErFImOw6bxii6wHED4pDYKqF6t1Y7oNVz22FA1+t8868hd7dbBquuzT3ZvA8lhgwt3MKrvARFRBXfoY8zeSAmoRp40lxHvpx0atiZNtDtFcsjx/zhLlqrXoOjp1EcDjNS/anS82uMO18Df+SEso+XO93h03eNSs4wvEP9byuXNEOVQa9hb3Rr51u+HlXsFJTaTntJNTZ9fq11FIZ/3yf9hBsdY9wux6ciWU966qG4zAM3JwFxjrC8ZZGkKoZ2nNPSMac6N9TGmgFs00afagqhVBRmU0LzkNIm67AuVCdiocR+aSZbdxSMxYLFCiL/3d8Dd4MSg9H3dFKhPcxnyIWrTUIa4WRH5yrcs/H7nsEQ36t2v8i/+YMilo1cDlgDd78Th3ujWFn7VmRSaFoY6Hi7ZqU+rYgrPAmhIYYgZPmB3sMsdyg/dhmlL2USfBfjLNsx4K4wmWTjpEkFJkc99HZbvAqhkCmt+ SgZpDtwz gq3LmSoldqV2zPS+Fh80vQ0k8cv2R9pdMRNEogD0Wacw/siepwqHZLnGEyvvyMpRjmTgsafRQrRuz5ReN7AglttPwIG3CPFxE5Z69qF6f5/+s05jM1YSG5OzgarlR+Z7C+ZYX7CMDqMqXuEyq2AiwHTniCHXa5JCVmiUd7Gy2GNIMINSyaMFyyBQo4hH3J3xygCYTimnZ749TTcuMZw0XJd9n1TGM3ph9fVET9t6iSBS3uAlTA9YIo9Dciqxd784/D6b478mVQm48mLEDWevH2g4a9fYlPzQzNia3IyVOx+UBupQTerXspeuGNcIMzZ3R0C27OeMqNA/rNzY= 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: 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.