From patchwork Tue Nov 8 15:49:40 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Masami Hiramatsu (Google)" X-Patchwork-Id: 17110 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp2789919wru; Tue, 8 Nov 2022 07:50:50 -0800 (PST) X-Google-Smtp-Source: AMsMyM6CgVzrso9rDkPC9Pqxrw4wERVuN40NvORMUK4KQX3rkuZ9Cfz46Z/GHOqFvQxYDpXCC5kx X-Received: by 2002:a05:6402:414f:b0:456:c2c1:23ec with SMTP id x15-20020a056402414f00b00456c2c123ecmr57242413eda.420.1667922650211; Tue, 08 Nov 2022 07:50:50 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1667922650; cv=none; d=google.com; s=arc-20160816; b=g9UQ/ZRvad617qjTjbvF9cmic2dTvok5o2PbFY5X3L1oLBVlwJP98lXsyymb77jZkN uIZ48Svrf6TYOmbDzk5iVBM2u0NlBDaOvfSsfTQopOFuVBy9GH3Pnm7x80FXPrP1avtD lPHRZKCojPOpECS60c/m1gKeqlVC7RYc2fNXj22/QQFR42aU8/wEwC26ufDGOCwg6s9k AcbOpK2l110wCxdY1EDdKHqDwJBADgz9+SLGxaHEnGDBILAYB+WKg04fXLc3QaHwC5P5 39oVZhVIc8cBmDmz+X0eP7mnX9jOpO3M3XvciqTtNejkErBfo+jM+Ck8Ty06XmmOSk01 NG9w== 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 Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id rp16-20020a170906d97000b007ad86f97b36si10064874ejb.560.2022.11.08.07.50.25; Tue, 08 Nov 2022 07:50:50 -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 + 99 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 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1748943661081480795?= X-GMAIL-MSGID: =?utf-8?q?1748943661081480795?= 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;