Received: by 2002:a05:6358:9144:b0:117:f937:c515 with SMTP id r4csp456142rwr; Wed, 3 May 2023 00:50:15 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6+RBYHjZz4zCU1PncxIEc9TH5ScaScCtG+KbFg0BDUr4mNuswF6QUhnVL8NwDBJMdQsIfW X-Received: by 2002:a05:6a20:914e:b0:d9:8a1b:3315 with SMTP id x14-20020a056a20914e00b000d98a1b3315mr26572776pzc.59.1683100214914; Wed, 03 May 2023 00:50:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1683100214; cv=none; d=google.com; s=arc-20160816; b=QPYAuTplTpJQR73SyR9GOFtRVEsB9Obx7XFlEaV7mODbGuowU6Ns7kSkbe98Lvur35 Fo3lBkrANUBwf3RTKySARwDq+zG/mm+B6eJ/TENNeoDAiSomOSHafgC+0ZtXlm6iWOms AnsUEftNdbE/H7r5iZTIPW3D0a2Dys+fLZI7QjCkOG2JAkWPwIxrcLC4MqVzzazL6nG6 WkFAh4Qat3ikbTtZmIQ1do0WAyvkQgX6kwxMr/dkTrZ7XXRlXrMpqSWzL3p9yOEDQ6of pdpGbge8gAbDM24oE7LMtUcBIWNboyNQWt5qXJDy9DbW8xKbcK004W2puoftgsbTYW2u wohw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=i3Hzbp6Fc0h0hj5rYtAeMr0Bup0FedFGgjm/ljEsba4=; b=M/FOIldt/lBX4hhIv+/Jfrl8C+4ElrWRrbvv5oKEKTybAQkUrhvw+siNUG+S6ZXSOU n7E8BFdhD8okrfUAtR1innESFVfT6RDpKxnCWQwdT59ZqP1Km2n9bvBSzMC9/ljXNiDW Mzu1dX9u4K/rX2QV1STCI+ttuXkI7X9PD0m3eUgj9wj2tb3lS9ar9SgUmP7TQbYd3Mg0 FyWkw+RDbayY/B+iC257rmettEBb6RHUVgwMYY8j7TXGBxXIS853e2hYL2mGlMhoF/+E SlKrj0tJGpX6iZmj31+/Uhnecj6oDTHC4OaDnALZLo16DM83OmpsA1Lzew7ej9toEa4t Klqg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.com header.s=susede1 header.b=A1RUCh5E; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=suse.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id j72-20020a638b4b000000b0051ba2478f52si3121875pge.524.2023.05.03.00.50.01; Wed, 03 May 2023 00:50:14 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@suse.com header.s=susede1 header.b=A1RUCh5E; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=suse.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229698AbjECHgE (ORCPT + 99 others); Wed, 3 May 2023 03:36:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43204 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229544AbjECHgC (ORCPT ); Wed, 3 May 2023 03:36:02 -0400 Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 08B022736; Wed, 3 May 2023 00:36:00 -0700 (PDT) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id 50EBC20072; Wed, 3 May 2023 07:35:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1683099359; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=i3Hzbp6Fc0h0hj5rYtAeMr0Bup0FedFGgjm/ljEsba4=; b=A1RUCh5ESqnCmqQHykA4qtiRA0TnekVST89bVweUc4YoOPAxXPAgcnp/rVynH6+pRPkp+z 0FzTPxhVUa0WAN3v90MiKxX/mhoNEqn2v/EhT/wx95G56Ej/zpg/VQwdKLa255ScGTYoBo r9VjFKfCEoqB/4FmnoBqhK5sAhIi958= Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 0FDBE1331F; Wed, 3 May 2023 07:35:59 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id M6TzAt8OUmR+UgAAMHmgww (envelope-from ); Wed, 03 May 2023 07:35:59 +0000 Date: Wed, 3 May 2023 09:35:58 +0200 From: Michal Hocko To: Suren Baghdasaryan Cc: akpm@linux-foundation.org, kent.overstreet@linux.dev, vbabka@suse.cz, hannes@cmpxchg.org, roman.gushchin@linux.dev, mgorman@suse.de, dave@stgolabs.net, willy@infradead.org, liam.howlett@oracle.com, corbet@lwn.net, void@manifault.com, peterz@infradead.org, juri.lelli@redhat.com, ldufour@linux.ibm.com, catalin.marinas@arm.com, will@kernel.org, arnd@arndb.de, tglx@linutronix.de, mingo@redhat.com, dave.hansen@linux.intel.com, x86@kernel.org, peterx@redhat.com, david@redhat.com, axboe@kernel.dk, mcgrof@kernel.org, masahiroy@kernel.org, nathan@kernel.org, dennis@kernel.org, tj@kernel.org, muchun.song@linux.dev, rppt@kernel.org, paulmck@kernel.org, pasha.tatashin@soleen.com, yosryahmed@google.com, yuzhao@google.com, dhowells@redhat.com, hughd@google.com, andreyknvl@gmail.com, keescook@chromium.org, ndesaulniers@google.com, gregkh@linuxfoundation.org, ebiggers@google.com, ytcoode@gmail.com, vincent.guittot@linaro.org, dietmar.eggemann@arm.com, rostedt@goodmis.org, bsegall@google.com, bristot@redhat.com, vschneid@redhat.com, cl@linux.com, penberg@kernel.org, iamjoonsoo.kim@lge.com, 42.hyeyoo@gmail.com, glider@google.com, elver@google.com, dvyukov@google.com, shakeelb@google.com, songmuchun@bytedance.com, jbaron@akamai.com, rientjes@google.com, minchan@google.com, kaleshsingh@google.com, kernel-team@android.com, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, iommu@lists.linux.dev, linux-arch@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-mm@kvack.org, linux-modules@vger.kernel.org, kasan-dev@googlegroups.com, cgroups@vger.kernel.org Subject: Re: [PATCH 34/40] lib: code tagging context capture support Message-ID: References: <20230501165450.15352-1-surenb@google.com> <20230501165450.15352-35-surenb@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230501165450.15352-35-surenb@google.com> X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon 01-05-23 09:54:44, Suren Baghdasaryan wrote: [...] > +static inline void add_ctx(struct codetag_ctx *ctx, > + struct codetag_with_ctx *ctc) > +{ > + kref_init(&ctx->refcount); > + spin_lock(&ctc->ctx_lock); > + ctx->flags = CTC_FLAG_CTX_PTR; > + ctx->ctc = ctc; > + list_add_tail(&ctx->node, &ctc->ctx_head); > + spin_unlock(&ctc->ctx_lock); AFAIU every single tracked allocation will get its own codetag_ctx. There is no aggregation per allocation site or anything else. This looks like a scalability and a memory overhead red flag to me. > +} > + > +static inline void rem_ctx(struct codetag_ctx *ctx, > + void (*free_ctx)(struct kref *refcount)) > +{ > + struct codetag_with_ctx *ctc = ctx->ctc; > + > + spin_lock(&ctc->ctx_lock); This could deadlock when allocator is called from the IRQ context. > + /* ctx might have been removed while we were using it */ > + if (!list_empty(&ctx->node)) > + list_del_init(&ctx->node); > + spin_unlock(&ctc->ctx_lock); > + kref_put(&ctx->refcount, free_ctx); -- Michal Hocko SUSE Labs