Received: by 2002:a05:7412:e794:b0:fa:551:50a7 with SMTP id o20csp1530994rdd; Thu, 11 Jan 2024 01:50:31 -0800 (PST) X-Google-Smtp-Source: AGHT+IGZ6hxRII/llygc4iBFlyJu9UkBXWG35TrnSWGCreeNVZPs61EMrf4i0BiUXRyto+sVW4F6 X-Received: by 2002:a05:6808:3987:b0:3bc:2800:3dc6 with SMTP id gq7-20020a056808398700b003bc28003dc6mr1449881oib.54.1704966631658; Thu, 11 Jan 2024 01:50:31 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1704966631; cv=none; d=google.com; s=arc-20160816; b=kvGQ826IdC3X/smhs29Tm8ByHw+g2bKEK1SPL/ilS+7r7uLCpJTC5UFAbZMilzPqM6 gh7pWLH6Bx+bsWikDT2epaApb+XyyHgTwVm5zBhB0Ev4SMuVTDgqg8aIbTmIZ4wC3pqT W+rk4essW9QF2eZIJ7Cz5X4Al0r9ApOnKwzghE59nOKbASKWx5fOEPkbCHPJvsyxwfDW ukjomJOq+iA7RxBhaaA8HDA/HYxCzT/dIMbkjA+s/oyg2U8NSJ0n8nfr3LR3qdYeORBi aW9d5n8NQH06a+/HsbwfdUs5PSOYYnWfJ79JeTRuuo65QbWRLg4+3GSX9NXmUrFROfuK ilGA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :dkim-signature; bh=eaM81UE8HNBCwln5s5TJQ6eHQuRiuHL2tpn+YpV4pcA=; fh=y9FUbJak5C6gzSTedbgzGWVmwnHgqmhZsHaMuLfouUI=; b=AMaIySt7/ipexpa5+WNgej7VYJokx4rctHsxmmY+COqQQp2ngRVr/Vuq/6lgXswIlC SQRsxY9Q9VOX8/4bWMwaBxQfgWmw2B2bX7GZymYN48mXjrgvoZiJxqyGP7xwag4UuVkz /QBBo6CdMADZf8Khwqpix3DGt0ZYGE26GKUyaTSjRf6xzP1zsNakJ2CjJhGnuXGOcSDk DrnA+o7mRRiG3WpcO8hGPUoSrsuNMl9DXfl5xl2ElbqqBu07S3NsjRIknPRvigQLHq+w +ikL5Mqdb2m7jrdtnxpp4/F73+szZHpnW04FRoGP4uCQuKz4KTWBNkalUSdF2Dyi5D8H ucuw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=AdJvJaDW; spf=pass (google.com: domain of linux-kernel+bounces-23335-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-23335-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.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 q3-20020a056a00084300b006d98e57acd3si684837pfk.401.2024.01.11.01.50.31 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 11 Jan 2024 01:50:31 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-23335-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=@google.com header.s=20230601 header.b=AdJvJaDW; spf=pass (google.com: domain of linux-kernel+bounces-23335-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-23335-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.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 6D1F1B21D57 for ; Thu, 11 Jan 2024 09:49:07 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 42CB314A9E; Thu, 11 Jan 2024 09:49:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="AdJvJaDW" Received: from mail-vk1-f169.google.com (mail-vk1-f169.google.com [209.85.221.169]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 0C3FA1429F for ; Thu, 11 Jan 2024 09:48:58 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=google.com Received: by mail-vk1-f169.google.com with SMTP id 71dfb90a1353d-4b74a9a9d4cso1538271e0c.1 for ; Thu, 11 Jan 2024 01:48:58 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1704966538; x=1705571338; darn=vger.kernel.org; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=eaM81UE8HNBCwln5s5TJQ6eHQuRiuHL2tpn+YpV4pcA=; b=AdJvJaDWTLBxh4UQ1ddX1nEUBNz/2Qe9P4wwum3PoWIl9TlgPuP8YNs3lheZPQpz8q bWGGYTnnDfQNbUQndnG4PT5FYmf+ZLIG/7MOp0SMADvBnbeERbOS6SyW2W/EAQ9tlEJE YuzmifAFrD+uiN8f3gSRnvhzeeL6BeJ61q/seZmdHFUsbV/OP6NTu9KhrwgXbN8G5cdn m4U3YbHhQ1IinzqK7kUxHVbkCxqOL/DkdqEzW5VXc/hqSZWH3+0xIoY3b5EdME3aq5Jz b7it8BYSWtNTJQl880dUtv0A6bYWMaEgrUYTVCJMUV+rmkJF4xFSk2FPMvtlY6M5+5s6 /tuQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1704966538; x=1705571338; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=eaM81UE8HNBCwln5s5TJQ6eHQuRiuHL2tpn+YpV4pcA=; b=lvxD94bK2o8Tb466743x+LWyv9IJ4i92PkQ5u7vMtkBLTTrOIRJwKe4pVMUQVxGf3x EdJsE4lenR5uA4fhLBz6VSaBy9Qssd6le6S5Ss99gy8m4+urz/6s5HkRGXMzUr8+tyDL cB0stbmufQ+MVWMTh4DLDqnv6GPu2x9Wlk7ZzvsQSwL9VrVdp3eH+n6KgsijQRPFwfGS F9nsn7oxJE9ecS9hxQAMe/huAP1tOYN3v+OGzbWw16piyPiIMTmC4BSmuh1v1VHSRfRO zoTVdhNcGbi0EOL0UhBY+KfDEzutkFu8pNdDO3uIWlI9NbCpPGWkXc7MOxK27FL2Y4Sq cgOg== X-Gm-Message-State: AOJu0Yyb1NUJ5IorXjuf3Fa5QOuA9L20gPz0p/ltC7bTVYJIVT5Xf/Fe cOktWfOCweuxrZut4pP2FvMctwiEmp9JwXe4ByEGThZJr8UR X-Received: by 2002:a05:6122:a20:b0:4b6:eb5a:ee98 with SMTP id 32-20020a0561220a2000b004b6eb5aee98mr227842vkn.14.1704966537737; Thu, 11 Jan 2024 01:48:57 -0800 (PST) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: <9f81ffcc4bb422ebb6326a65a770bf1918634cbb.1700502145.git.andreyknvl@google.com> <87sf34lrn3.fsf@linux.intel.com> In-Reply-To: <87sf34lrn3.fsf@linux.intel.com> From: Marco Elver Date: Thu, 11 Jan 2024 10:48:19 +0100 Message-ID: Subject: Re: [PATCH v4 12/22] lib/stackdepot: use read/write lock To: Andi Kleen Cc: Oscar Salvador , andrey.konovalov@linux.dev, Andrew Morton , Andrey Konovalov , Alexander Potapenko , Dmitry Vyukov , Vlastimil Babka , kasan-dev@googlegroups.com, Evgenii Stepanov , linux-mm@kvack.org, linux-kernel@vger.kernel.org, Andrey Konovalov Content-Type: text/plain; charset="UTF-8" On Thu, 11 Jan 2024 at 00:01, Andi Kleen wrote: > > Oscar Salvador writes: > >> > >> With this change, multiple users can still look up records in parallel. > > That's a severe misunderstanding -- rwlocks always bounce a cache line, > so the parallelism is significantly reduced. > > Normally rwlocks are only worth it if your critical region is quite long. > > >> > >> This is preparatory patch for implementing the eviction of stack records > >> from the stack depot. > >> > >> Reviewed-by: Alexander Potapenko > >> Signed-off-by: Andrey Konovalov > > > > Reviewed-by: Oscar Salvador > > > Has anyone benchmarked this on a high core count machine? It sounds > pretty bad if every lock aquisition starts bouncing a single cache line. > > Consider using RCU or similar. stackdepot is severely limited in what kernel facilities it may use due to being used by such low level facilities as the allocator itself. I've been suggesting percpu-rwsem here, but looking at it in more detail that doesn't work because percpu-rwsem wants to sleep, but stackdepot must work in non-sleepable contexts. :-/