Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp3835228rwb; Tue, 8 Nov 2022 08:54:33 -0800 (PST) X-Google-Smtp-Source: AMsMyM7Mvnszqf64rPCMSotFh7o1FYKQWywD+n9L6cmHgQhtOlTkg0hkpSccw7CJ2fAgYNbs7UOz X-Received: by 2002:a05:6402:4148:b0:440:cb9f:d10f with SMTP id x8-20020a056402414800b00440cb9fd10fmr56329350eda.77.1667926473148; Tue, 08 Nov 2022 08:54:33 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1667926473; cv=none; d=google.com; s=arc-20160816; b=gB/Jzz9Ugad7rID022ki8I9JL2hlSlbuWgYbSuBy4bOekjSVMPB+BX8s3GtZlcU74I r1Y1g+icKc6mUXCXfwlsKXq8oA8cMhkXuY/jl5bWkm9FgI0syyfyv7mJu327b5u4rrxU zZr0tBo9u8y0veYFmlCYymk+/zQ0Xhz/Sam/Rd+F6IdgTrGS82XyDbc8+Fy1B+a22Uzg B/S539rXiD/E8uPr0f4B7D1mvol+dqaSICab8SH2X6GYYfTPuNUDbd8XrJ35GaXdC83y 230x32BIVxvZtNogkyjuIZYzXpRApORclIV8jKgjWKSbksI3wJGNaY7GmUKKLZbTjkio HJ+g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=m8ZD7OdX+naM8TDvuxfAXgHmlWN3WM5LibwsMO+5WzY=; b=wx/UOqrx0N+Bs2XJ+P1KXA2O5yFEyQU0uea9JQRYwZQU5gLEEAkspIOq3fcq4mIlvK zOjNM0LXbVA1k6DMSQLWPa9SPBakMI6ECJ4nWpdllQ/nbAbBoV+LW+QNM7dVsV13wW/y A3eY5pesbfuszvla8Yo+qelFxHG6UO046tyYaTQRgZVgR+9Hkdxx67Z5gKl5juzrI8pz X853NQ6HcLgSUfo+huY3EpsYPGjRFKmKNlysKpvcgXgpi+flRfY6jCgD0SOqHXu9Lzfb m6jETiMC+YFj5RhqioFP81jO1F8QsyjNqau1becwqA+Bx4I60K3EVgkIZcxRnoOv6Iwf XidQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=FnpNtXzD; 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=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id d10-20020a056402144a00b00461c531d8casi11557192edx.305.2022.11.08.08.54.07; Tue, 08 Nov 2022 08:54:33 -0800 (PST) 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=@kernel.org header.s=k20201202 header.b=FnpNtXzD; 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=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234539AbiKHPt5 (ORCPT + 91 others); Tue, 8 Nov 2022 10:49:57 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37804 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234534AbiKHPtr (ORCPT ); Tue, 8 Nov 2022 10:49:47 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1A4CD59FD1; Tue, 8 Nov 2022 07:49:47 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id CADA6B81B4E; Tue, 8 Nov 2022 15:49:45 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E1BD1C433C1; Tue, 8 Nov 2022 15:49:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1667922584; bh=uMXIDE3N6tRBHy0qXfA/qokcfkSD+HhNMwAWfevtvoA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=FnpNtXzDxAK2M6pLW9kmncWOhCnju9bsKZbgWOiCYcpFvFaxcReDv/KxBA48ZcWoA QgQ22yAHHLYksfvtv3faGTRtAXU3szPKsmiwM9dWyjY2ZHT8DPV6lzDViNIkGrJP/t J8Eu1mvbAg+TAxIVnT2BWKwiTjID7VJOgVZL8TB9StnjE0iuJ03B9E3/oK+c73qgnS yODE9YrDGn0CTGkarxF6xdONjbxk/vzDo9v9aoNxIAzTlkie4gw6AY4+n1Fa2ZDgew TQPL2XiuTg0694xRAGAOsQXJFYmRkqn1nSr89f6NOZbN4It7+xs1Msl5VT89kYL5nr hInTg/gdFVQgA== From: "Masami Hiramatsu (Google)" To: linux-trace-kernel@vger.kernel.org Cc: linux-kernel@vger.kernel.org, Steven Rostedt , mhiramat@kernel.org, Florent Revest , Mark Rutland , Will Deacon Subject: [RFC PATCH 3/9] fprobe: Add nr_maxactive to specify rethook_node pool size Date: Wed, 9 Nov 2022 00:49:40 +0900 Message-Id: <166792258067.919356.10757785431344618724.stgit@devnote3> X-Mailer: git-send-email 2.38.1.431.g37b22c650d-goog In-Reply-To: <166792255429.919356.14116090269057513181.stgit@devnote3> References: <166792255429.919356.14116090269057513181.stgit@devnote3> User-Agent: StGit/0.19 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS 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 From: Masami Hiramatsu (Google) Add nr_maxactive to specify rethook_node pool size. This means the maximum number of actively running target functions concurrently for probing by exit_handler. Note that if the running function is preempted or sleep, it is still counted as 'active'. Signed-off-by: Masami Hiramatsu (Google) --- include/linux/fprobe.h | 2 ++ kernel/trace/fprobe.c | 5 ++++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/include/linux/fprobe.h b/include/linux/fprobe.h index e0d4e6136249..678f741a7b33 100644 --- a/include/linux/fprobe.h +++ b/include/linux/fprobe.h @@ -14,6 +14,7 @@ * @flags: The status flag. * @rethook: The rethook data structure. (internal data) * @entry_data_size: The private data storage size. + * @nr_maxactive: The max number of active functions. * @entry_handler: The callback function for function entry. * @exit_handler: The callback function for function exit. */ @@ -31,6 +32,7 @@ struct fprobe { unsigned int flags; struct rethook *rethook; size_t entry_data_size; + int nr_maxactive; void (*entry_handler)(struct fprobe *fp, unsigned long entry_ip, struct pt_regs *regs, void *entry_data); diff --git a/kernel/trace/fprobe.c b/kernel/trace/fprobe.c index fa25d09c9d57..f222848571f2 100644 --- a/kernel/trace/fprobe.c +++ b/kernel/trace/fprobe.c @@ -143,7 +143,10 @@ static int fprobe_init_rethook(struct fprobe *fp, int num) } /* Initialize rethook if needed */ - size = num * num_possible_cpus() * 2; + if (fp->nr_maxactive) + size = fp->nr_maxactive; + else + size = num * num_possible_cpus() * 2; if (size < 0) return -E2BIG;