Received: by 2002:a05:7412:251c:b0:e2:908c:2ebd with SMTP id w28csp1331006rda; Mon, 23 Oct 2023 09:17:14 -0700 (PDT) X-Google-Smtp-Source: AGHT+IG2ao9i9/XaC9swXJb1jXChlE/F0ID+bdJwxpjz58PfAuQfSURRakG9JcMj+HildvOJgZiH X-Received: by 2002:a05:6a20:4323:b0:13d:d5bd:7593 with SMTP id h35-20020a056a20432300b0013dd5bd7593mr92493pzk.12.1698077834501; Mon, 23 Oct 2023 09:17:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698077834; cv=none; d=google.com; s=arc-20160816; b=GXfRjC7ZZn7mEdinVyfpP47EkaEyAGSvn+DTAJgOPsWNHTopnNy+ixLxmJtLxILPjo ZcT4wkg6wYrmBmGdsVN0+S1cCUxL37IqsgizWeD7VKmAkPJKPpbm3mHDGkybBJdkQ63B fYF01arA0Al/k+F3rQw0ALmbasvHbGbX47M3G3/DIk6CzJAlCo1V7QJVBZwKWX/M7vn0 BNZ7TlTdFaGBd1XoFe83v0s1gFIpck3YujelOFh81A3hntl/vo/cerThW6gKVDeRThqZ /TU8T6p7lTxbyxxOKbX5Oh4KoYysnrC/EZR5cuOKxbmZnmKpAso80Oe3aYb8FPq1Io3r nDvA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=9tHn32Hb+H9q5/wYxwsubEfubdWSQHXuWNQ2b+po3Bg=; fh=ClZrlmqypC8gyPFrg/phNYXzlKrWLi1ezKQD4pdvko4=; b=mkUQ0ctunJubkHuzrCRkebr08kZgtzmafHK3ye/f3l26JKQ39DE/Uba3zYx5saCcMU NR7gbZ3smbJo3CuLC+ueTscKz/3kifDFT4z3sGtVNNJxsLAihoFNlJbWGdx34YetZ4HU OcEr4mj5LJTGNd+fagLSaXN5gaj9hclfc+PfziREIu5gjU9GRX31xrt+hfb5Vyq8J9Om W27pZIYi1Pu5+m77RAIGB3Lfe4p5lCxi7qX65VnJSUqeUm/RNxRfdOY3vCOWX2KfZtPf mpeo96p+J3U2xG9LRuzlnJbBRN8zVFFiIm58Jw9J2PCcv5HZkQuwuvZTZlwi2qUum80k /uCg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=kjB7o6FV; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from groat.vger.email (groat.vger.email. [2620:137:e000::3:5]) by mx.google.com with ESMTPS id p19-20020a639513000000b00565ead2509asi6545565pgd.199.2023.10.23.09.17.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 23 Oct 2023 09:17:14 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) client-ip=2620:137:e000::3:5; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=kjB7o6FV; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by groat.vger.email (Postfix) with ESMTP id AA3538078327; Mon, 23 Oct 2023 09:17:11 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at groat.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233520AbjJWQRC (ORCPT + 99 others); Mon, 23 Oct 2023 12:17:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35160 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233574AbjJWQRA (ORCPT ); Mon, 23 Oct 2023 12:17:00 -0400 Received: from mail-pj1-x102b.google.com (mail-pj1-x102b.google.com [IPv6:2607:f8b0:4864:20::102b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5C617D78 for ; Mon, 23 Oct 2023 09:16:54 -0700 (PDT) Received: by mail-pj1-x102b.google.com with SMTP id 98e67ed59e1d1-27d153c7f00so2187399a91.3 for ; Mon, 23 Oct 2023 09:16:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1698077814; x=1698682614; darn=vger.kernel.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=9tHn32Hb+H9q5/wYxwsubEfubdWSQHXuWNQ2b+po3Bg=; b=kjB7o6FV+BU5bNjwOyX2O8b/1iO9WEMWc280KsJwCVFw6YIslDsPfXYBlqCfBwOSM6 Vn9vqos/XynNwQ4/YNXiT/YwGM/BOZXoKClF/KcbGVQiKilmXbtBx37y8HyepqBeqQpP ZjTh2Hk32DvjtxIqtveD9B0EjX16xEfQ/peu9W9aKeguQeJ+IbqHFydsqSw4/u5UHM8n f8QMBIRzhvWxAETQOsASyVPVUCEsjIKq2kPvAJBMS3/Lz4G1eDa6dJTT3XLoH2SdjopQ OrXZXqo8RM/FzSvp4H/4nZhjq8gwZIVsTj1nOI7HWMKLYdf8JBZAcgn/+r6SnXLkEM15 G0KA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698077814; x=1698682614; h=content-transfer-encoding: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=9tHn32Hb+H9q5/wYxwsubEfubdWSQHXuWNQ2b+po3Bg=; b=ZO3YW/nTU4PJr4FVIvgcZsUZNiwRvTg5UYOeX12626uS6ONxLeooPzrqz7nO/K5nLf Hu4jPye7KR4VFUVy9bN3/z5MTsMBvJwgCRieXL30r2e9H+gpn/yDUuOW9btyj0oUegdY f4jQOJSKn8sRDI93h1EIFO9IUM+bohvVfRkafmJCdAM5CrYM2v0cw66i+Y23nR0yIECl cSgySpc8EsBXLEf128zEz0PJO9UlvZQUlMvoMXydbzu+mfJwIhDOyUT3dSSHYDH8uvCq wUxFGQPcevYeAqCZVrGaX4xFEr3UW71vpBBhNwa0vuuctONdr6zCpNA03ynzPai0yyBV EGMA== X-Gm-Message-State: AOJu0YwrjLnMSgCiHKQyg6BIyhqOatgtjFWc9C4C7yg8xk1b4t8+QLD8 gKSaWvziueq7rdMupyeDwON9aGekaZ6ny/msBCw= X-Received: by 2002:a17:90a:b903:b0:27d:5504:4cc8 with SMTP id p3-20020a17090ab90300b0027d55044cc8mr7495426pjr.9.1698077813463; Mon, 23 Oct 2023 09:16:53 -0700 (PDT) MIME-Version: 1.0 References: <5c5eca8a53ea53352794de57c87440ec509c9bbc.1694625260.git.andreyknvl@google.com> In-Reply-To: From: Andrey Konovalov Date: Mon, 23 Oct 2023 18:16:42 +0200 Message-ID: Subject: Re: [PATCH v2 11/19] lib/stackdepot: use read/write lock To: Alexander Potapenko Cc: andrey.konovalov@linux.dev, Marco Elver , Dmitry Vyukov , Vlastimil Babka , kasan-dev@googlegroups.com, Evgenii Stepanov , Oscar Salvador , Andrew Morton , linux-mm@kvack.org, linux-kernel@vger.kernel.org, Andrey Konovalov Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-0.6 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on groat.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (groat.vger.email [0.0.0.0]); Mon, 23 Oct 2023 09:17:11 -0700 (PDT) On Mon, Oct 9, 2023 at 11:45=E2=80=AFAM Alexander Potapenko wrote: > > > static struct stack_record *depot_fetch_stack(depot_stack_handle_t han= dle) > > { > > union handle_parts parts =3D { .handle =3D handle }; > > - /* > > - * READ_ONCE pairs with potential concurrent write in > > - * depot_init_pool. > > - */ > > - int pools_num_cached =3D READ_ONCE(pools_num); > > void *pool; > > size_t offset =3D parts.offset << DEPOT_STACK_ALIGN; > > struct stack_record *stack; > > > > - if (parts.pool_index > pools_num_cached) { > > + lockdep_assert_held(&pool_rwlock); > > Shouldn't it be lockdep_assert_held_read()? Indeed, this is more precise. Will fix in v3, thanks!