Received: by 2002:a05:7412:98c1:b0:fa:551:50a7 with SMTP id kc1csp1017106rdb; Sat, 6 Jan 2024 23:00:17 -0800 (PST) X-Google-Smtp-Source: AGHT+IGoh0NPPRNOylasOWG6ZVjgeA3CbrjJoggksIsBhpfFzXbXyNXDcuiv+J0uIjPAmvxXSB/R X-Received: by 2002:a50:d686:0:b0:557:2337:228a with SMTP id r6-20020a50d686000000b005572337228amr607584edi.21.1704610816956; Sat, 06 Jan 2024 23:00:16 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1704610816; cv=none; d=google.com; s=arc-20160816; b=rFwr7Rb3MmJ8G/+mwUG83tGJYFL1XPcwOZUwTbQoWxeFRgnZz5DSORWOcqyo1rGSni 1ciItlXQpWKgG3Daa6onXSSR5buSosIgbWdVpbj0howK9rIBsRkDmvk5Cs+Y9DfiXXQ2 PxRGTmz/DVQcSFY89JWn1KxsgtI8JBCGtslG9vp6k2xbffIspPn8Uyx9CZGyRco1Qp/p 5ds67jS31gUpcg2+nhxbSBESrgoI3/YiQO/kxUt6iM8NEv2b8WYtOb9wALIillVptBis 7JB9e8Kmxk52DkHFslq8SqZz4th3MkUYGaLNA0uqhIaJlun9stuSF3x+r5gKJmU8hLnA XLYw== ARC-Message-Signature: i=1; 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 :date:subject:cc:to:from; bh=ByizRyGDGo+oN/k/9Dua6jxTXwcaGVAO986Ht28pzEQ=; fh=javj8T/+4HE3IeCGJjXnJ0uTRqdid+sNTPKUXwsHRSY=; b=QtYeMP/5eF6G6+p3Iu68FK9wsfyL1CYemIojGEuuCbsePug2nIdNdEqhG2t2FXa4dz MrsjwKKQj7ETA7YZpx5onSBxLfY8wBfW9KddQup4U+VrQZO4IXvIbk4SsgStZpYmlGcm jzOaOuevCTVI310BUxmf5EcrEf5SQbLIzSHdtO2xmyU+gFXWovQGM1fWT8YdSoxNzFoZ pFehFqsfMXP/F28Yj5SLWLrGaP/AjV9s9C5Vc7ZGer09hw4iRGD/fZTBqhaHIhBHcb6Q 3ef4NNrC8meCxHGFEdGJHOw7s3UH2+xfeaj/OqO6hl8JeTAtPGgGOmbTSkD3VNG051Zn +EOg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel+bounces-18806-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-18806-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 s22-20020a05640217d600b005549bcf1284si2049738edy.105.2024.01.06.23.00.16 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 06 Jan 2024 23:00:16 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-18806-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; spf=pass (google.com: domain of linux-kernel+bounces-18806-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-18806-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 ABD7D1F21CCB for ; Sun, 7 Jan 2024 07:00:16 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 18C0412B6E; Sun, 7 Jan 2024 07:00:10 +0000 (UTC) X-Original-To: linux-kernel@vger.kernel.org Received: from mail115-69.sinamail.sina.com.cn (mail115-69.sinamail.sina.com.cn [218.30.115.69]) (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 48EFF125D7 for ; Sun, 7 Jan 2024 07:00:03 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=sina.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=sina.com X-SMAIL-HELO: localhost.localdomain Received: from unknown (HELO localhost.localdomain)([113.88.50.153]) by sina.com (10.75.12.45) with ESMTP id 659A4BE8000049C4; Sun, 7 Jan 2024 14:59:54 +0800 (CST) X-Sender: hdanton@sina.com X-Auth-ID: hdanton@sina.com Authentication-Results: sina.com; spf=none smtp.mailfrom=hdanton@sina.com; dkim=none header.i=none; dmarc=none action=none header.from=hdanton@sina.com X-SMAIL-MID: 85437231457880 X-SMAIL-UIID: 25D86A25DE9648949CD5BA5B556EC8F0-20240107-145954-1 From: Hillf Danton To: Uladzislau Rezki , Wen Gu Cc: linux-mm@kvack.org, LKML Subject: Re: [PATCH v3 04/11] mm: vmalloc: Remove global vmap_area_root rb-tree Date: Sun, 7 Jan 2024 14:59:42 +0800 Message-Id: <20240107065942.3141-1-hdanton@sina.com> In-Reply-To: References: <20240102184633.748113-1-urezki@gmail.com> <20240102184633.748113-5-urezki@gmail.com> <238e63cd-e0e8-4fbf-852f-bc4d5bc35d5a@linux.alibaba.com> <52766da2-41de-41ce-b60b-1118da343b8a@linux.alibaba.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit On Sat, 6 Jan 2024 17:36:23 +0100 Uladzislau Rezki > > > > Thank you! I tried the patch, and it seems that the wait for rwlock_t > > also exists, as much as using spinlock_t. (The flamegraph is attached. > > Not sure why the read_lock waits so long, given that there is no frequent > > write_lock competition) > > > > vzalloced shmem(spinlock_t) vzalloced shmem(rwlock_t) > > Requests/sec 583729.93 460007.44 > > > > So I guess the overhead in finding vmap area is inevitable here and the > > original spin_lock is fine in this series. > > > I have also noticed a erformance difference between rwlock and spinlock. > So, yes. This is what we need to do extra if CONFIG_HARDENED_USERCOPY is > set, i.e. find a VA. See if read bias helps to understand the gap between spinlock and rwlock. --- x/kernel/locking/qrwlock.c +++ y/kernel/locking/qrwlock.c @@ -23,7 +23,7 @@ void __lockfunc queued_read_lock_slowpat /* * Readers come here when they cannot get the lock without waiting */ - if (unlikely(in_interrupt())) { + if (1) { /* * Readers in interrupt context will get the lock immediately * if the writer is just waiting (not holding the lock yet),