From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (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 95A912D3725 for ; Wed, 13 May 2026 14:01:33 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.129.124 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778680894; cv=none; b=mXF+uDWCPSLk3orHuIqGk3IF1dFc8n2vTp0BxHnPpqUIfE6YIQ0O4BxuKxZwasogDjDD26orK41gu1AJ6m3a37PHrJsaVGmP8Zwev7O92jAlfLRO4fsjVIRN57d9wJ3yOYINdc+4AY/lA8dgy1BWgsHqRrPBcOJGL+yKR9jHarQ= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778680894; c=relaxed/simple; bh=l+tuulB0riY0GRYdM2IVFsbqdJVV/50LHxLUoHAzydo=; h=Message-ID:Subject:From:To:Cc:Date:In-Reply-To:References: Content-Type:MIME-Version; b=jbPAbiA1SqKtE1UzdrMXNPQ92QeYoQxjIIdccBf3dLrUH+c16twf+znbaY6iSofwOHUevKDAeSdL7ghBQppqRaY7tVxz03JvzIG6VvgcPxpw7KBBCCb4sXn20UGZVrcZrKK4dsQLxz+FKVHIVMshfPrwAvA/Ofq6cGjmfKEX6kQ= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=GjZVY2qV; dkim=pass (2048-bit key) header.d=redhat.com header.i=@redhat.com header.b=O92Z0qkG; arc=none smtp.client-ip=170.10.129.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="GjZVY2qV"; dkim=pass (2048-bit key) header.d=redhat.com header.i=@redhat.com header.b="O92Z0qkG" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1778680892; h=from:from: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:autocrypt:autocrypt; bh=2vp6YnCveJQi0MdMwxVG/KOX/sGbUHTBE2nWoNMMuKo=; b=GjZVY2qVsgk2XbzdFmZJtwArB75mVSAIMy+569dslZ2aGK4YgA+Q0mJvA/2QtxbX2hcyNA DogHORiyIXtc6yjs2WakjCD1CMsDkAs4obNb98MFPsedbhcG9xWJL7+AiawpJMwtqMPbZu Scp3hsc3aNoHTiLH95Ga5OIOsxpu4k4= Received: from mail-ej1-f70.google.com (mail-ej1-f70.google.com [209.85.218.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-345-8v7XSisoMz-V2m7eI1p7ow-1; Wed, 13 May 2026 10:01:30 -0400 X-MC-Unique: 8v7XSisoMz-V2m7eI1p7ow-1 X-Mimecast-MFC-AGG-ID: 8v7XSisoMz-V2m7eI1p7ow_1778680889 Received: by mail-ej1-f70.google.com with SMTP id a640c23a62f3a-bcc22a042b1so480734766b.2 for ; Wed, 13 May 2026 07:01:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=google; t=1778680889; x=1779285689; darn=vger.kernel.org; h=mime-version:user-agent:content-transfer-encoding:autocrypt :references:in-reply-to:date:cc:to:from:subject:message-id:from:to :cc:subject:date:message-id:reply-to; bh=2vp6YnCveJQi0MdMwxVG/KOX/sGbUHTBE2nWoNMMuKo=; b=O92Z0qkGgLJpuOteATZ9Bt8xVoHbEUq7fvTUKMYF0WHFwu64dWd27JBfJCdz+VBSoC gBbDubb8H1H9iGf6xErcSkJ6YgVvm9RHEh1yInaiAHWT7NSVsEspVHI7kEO+qMX/umaQ rer3lU7+Hg2Q9Xutc5h0SkKErdKQ8KPoEAWBM89xafTAdbaR9V3rBwC3wIcLYJjYnQ6k vVQDrsdG3+tbEAckXwP2yLixNUO6vTjva0SXlhbvwM3Equf5+FM2a3ZVNAkcOxRVJcVf 9vBjd2lJDQBbXKWQr9z4ppD1FexxFSvzdMenR1pTrfRFH7H/xQUE3R48FBBIsI6SUcll 1kTQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1778680889; x=1779285689; h=mime-version:user-agent:content-transfer-encoding:autocrypt :references:in-reply-to:date:cc:to:from:subject:message-id:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=2vp6YnCveJQi0MdMwxVG/KOX/sGbUHTBE2nWoNMMuKo=; b=KWKUKm+ZXin5aS+o07ZZeaZGnnnZWfEpz+Jh3lWxTAERGAVoOH5Y3RpxZeQG30/Khl /5OjAj2m7tU+yQkQZZqOt6E5DKjk7Uxg4bNkx9RB5z9tncDF25JDvDKJdUYx6uW+OG0V njpJJEZiI/wWmGctjxISwvfjuIHQsXmaPZsIjylDFvvPOiR+yO+SYKeB6MEVZrhofOqe dlmXsctP7TosbzpDFjbjqQ3eP5Mq/zcfpp8QgLXQ9aUMdfmhJmBuDMEfaePX61PYsL9h lE/5SQ2yztJVpbk9kR+rsbPOce0NT2t+muFfaGAGAF/RDqZHOwbCmL0OC4vd20ZG8IkU KbDA== X-Forwarded-Encrypted: i=1; AFNElJ/NU7yz5rHd4nRfZLFcagMZfhv5oHryulSTW53cWCodhWuhETyx8/E0NOLp40wsHxb28cLeWzZayHKF5V4=@vger.kernel.org X-Gm-Message-State: AOJu0YzIIetc/EaLTZw5qKYj3iThYelGzy8VblbXWDzNB0UDEWao+i8h uJffGeApBFGvvJNThGE/aezaW+MVDAQha5BumDOL3GFFKWuTYoNbMTM5TtESl4D4FytDr4RbDiw QenLoqIgrVJoUNfY9zl2crQv9AXP5B1x7gs06ZoflafnLMmi/giwDgp76EaSIoXTIRsb4gSNoFX 4E X-Gm-Gg: Acq92OFCdsFVIhbC7TSOwO1QKGbJ/3pFmMv27W686qBnudaVdSkxpvYogs0Wk94sb/r gurSKu94kwm7P8Auc03poBTbISi9Q4jk5WXoMxzyzTZUUwGvTZbTybMdfJHP/rBm+Ztbjq/lUOu BWAWCLoDyxZq8yoZpHO2lFiuuLDz9L8x4ZLL1LSdm3B9xor0pB92ekc3tIFictbxUfKoYOH2n1y EwdVqyNT7BviaIM4w9xV4BZ4glA5aePvC37sWZynw4ncWIb+72QIm3o+sCyk11CT7DViaUxfSLX V+5pRHw5TKZT4NKkaPB7g+tI1XYrpSUG+va+tRRcEceKR+7kTz+M6aIxiogeUHuLcW9UPsBbrkA ot5tpOxPhngEQARiXgK7c6r3Oh2yISopwViVsM7BZDFw3RRlusF2xcaewBNEOajjMGoxTygnCo2 rlQjRbrRY2ViofvJw= X-Received: by 2002:a17:907:6b0e:b0:bc6:1c2:ee46 with SMTP id a640c23a62f3a-bd3bfa81b7cmr249323066b.11.1778680888653; Wed, 13 May 2026 07:01:28 -0700 (PDT) X-Received: by 2002:a17:907:6b0e:b0:bc6:1c2:ee46 with SMTP id a640c23a62f3a-bd3bfa81b7cmr249314266b.11.1778680887804; Wed, 13 May 2026 07:01:27 -0700 (PDT) Received: from gmonaco-thinkpadt14gen3.rmtit.csb (212-8-243-115.hosted-by-worldstream.net. [212.8.243.115]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-45491ca383asm39761892f8f.28.2026.05.13.07.01.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 13 May 2026 07:01:27 -0700 (PDT) Message-ID: <668f83581c58644a84cab5e6736864a439bb8e28.camel@redhat.com> Subject: Re: [RFC PATCH v2 04/10] rv/da: add pre-allocated storage pool for per-object monitors From: Gabriele Monaco To: wen.yang@linux.dev Cc: linux-trace-kernel@vger.kernel.org, linux-kernel@vger.kernel.org, Steven Rostedt Date: Wed, 13 May 2026 16:01:25 +0200 In-Reply-To: <2774332570ee823be60cfe84ba85e9573b4df478.1778522945.git.wen.yang@linux.dev> References: <2774332570ee823be60cfe84ba85e9573b4df478.1778522945.git.wen.yang@linux.dev> Autocrypt: addr=gmonaco@redhat.com; prefer-encrypt=mutual; keydata=mDMEZuK5YxYJKwYBBAHaRw8BAQdAmJ3dM9Sz6/Hodu33Qrf8QH2bNeNbOikqYtxWFLVm0 1a0JEdhYnJpZWxlIE1vbmFjbyA8Z21vbmFjb0BrZXJuZWwub3JnPoiZBBMWCgBBFiEEysoR+AuB3R Zwp6j270psSVh4TfIFAmjKX2MCGwMFCQWjmoAFCwkIBwICIgIGFQoJCAsCBBYCAwECHgcCF4AACgk Q70psSVh4TfIQuAD+JulczTN6l7oJjyroySU55Fbjdvo52xiYYlMjPG7dCTsBAMFI7dSL5zg98I+8 cXY1J7kyNsY6/dcipqBM4RMaxXsOtCRHYWJyaWVsZSBNb25hY28gPGdtb25hY29AcmVkaGF0LmNvb T6InAQTFgoARAIbAwUJBaOagAULCQgHAgIiAgYVCgkICwIEFgIDAQIeBwIXgBYhBMrKEfgLgd0WcK eo9u9KbElYeE3yBQJoymCyAhkBAAoJEO9KbElYeE3yjX4BAJ/ETNnlHn8OjZPT77xGmal9kbT1bC1 7DfrYVISWV2Y1AP9HdAMhWNAvtCtN2S1beYjNybuK6IzWYcFfeOV+OBWRDQ== Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable User-Agent: Evolution 3.60.1 (3.60.1-1.fc44) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Sorry for the spam, I accidentally mapped ctrl+Enter to send without confirmation and can't teach my fingers not to press it instead of ctrl+del= ete.. > That's definitely a good addition, kmalloc_nolock was not that good alrea= dy so > I tried some way have a preallocation, though I realise it isn't really > flexible. >=20 > Since you're using spinlocks, isn't that going to sleep on PREEMPT_RT? >=20 > Isn't this similar to what you'd do with a kmem_cache. That was my origin= al > idea although that uses spinlocks too. >=20 > I quickly tried an implementation like yours using > mempool_create_slab_pool(prealloc_count) and mempool_alloc_preallocated()= and > it still explodes with my monitors, but perhaps now that tracepoints no l= onger > disable preemption it could play well with some monitors. >=20 > The selftests with tlob seem to work just the same with this kmem_cache (= up to > the unrelated RCU stall). To be fair since you only allocate from the upr= obe > handler, you'd probably be just fine with kmalloc_nolock, but let's conti= nue > with the preallocation logic. >=20 >=20 > The API is starting to get complex (well, not that it wasn't already). > We have essentially 3 ways to allocate: > * fully automatic with kmalloc_nolock > * semi-automatic with pool preallocation > * manual with direct storage preallocation >=20 > We can have a macro DA_MON_ALLOCATION_STRATEGY =3D {DA_ALLOC_AUTO, > DA_ALLOC_POOL, DA_ALLOC_MANUAL} where DA_MON_POOL also requires > DA_MON_POOL_SIZE to be define (force that with an #error). Anyway, this way you probably wouldn't need to define a different init func= tion and let everything handled more transparently. Also you don't need to call da_create_or_get() explicitly, da_handle_start_event() should do it for you. The only manual step required is da_create_storage() when you explicitly ca= nnot lock when calling da_handle_start_event() (that would be DA_ALLOC_MANUAL, y= ou don't need that). Hope I didn't create too much confusion. Thanks, Gabriele