From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 9790 invoked by alias); 19 Oct 2006 09:04:02 -0000 Received: (qmail 9508 invoked by uid 22791); 19 Oct 2006 09:03:58 -0000 X-Spam-Status: No, hits=0.2 required=5.0 tests=AWL,BAYES_00,TW_DJ,UNPARSEABLE_RELAY X-Spam-Check-By: sourceware.org Received: from mail9.hitachi.co.jp (HELO mail9.hitachi.co.jp) (133.145.228.44) by sourceware.org (qpsmtpd/0.31) with ESMTP; Thu, 19 Oct 2006 09:03:50 +0000 Received: from mlsv4.hitachi.co.jp (unknown [133.145.228.16]) by mail9.hitachi.co.jp (Postfix) with ESMTP id C034837C84 for ; Thu, 19 Oct 2006 18:03:48 +0900 (JST) Received: from mfilter-s2.hitachi.co.jp by mlsv4.hitachi.co.jp (8.12.10/8.12.10) id k9J93m38017436; Thu, 19 Oct 2006 18:03:48 +0900 Received: from vshuts5.hitachi.co.jp (unverified) by mfilter-s2.hitachi.co.jp (Content Technologies SMTPRS 4.3.17) with SMTP id ; Thu, 19 Oct 2006 18:03:48 +0900 Received: from hsdlgw92.sdl.hitachi.co.jp ([133.144.7.20]) by vshuts5.hitachi.co.jp with SMTP id M2006101918034718504 ; Thu, 19 Oct 2006 18:03:48 +0900 Received: from vgate2.sdl.hitachi.co.jp by hsdlgw92.sdl.hitachi.co.jp (8.9.3/3.7W06061314) id SAA20901; Thu, 19 Oct 2006 18:03:45 +0900 Received: from maila.sdl.hitachi.co.jp ([133.144.14.196]) by vgate2.sdl.hitachi.co.jp (SAVSMTP 3.1.1.32) with SMTP id M2006101918034604268 ; Thu, 19 Oct 2006 18:03:46 +0900 Received: from [127.0.0.1] ([10.232.9.172]) by maila.sdl.hitachi.co.jp (8.13.1/3.7W04031011) with ESMTP id k9J93kb8006561; Thu, 19 Oct 2006 18:03:46 +0900 Message-ID: <45373F5E.8000906@hitachi.com> Date: Thu, 19 Oct 2006 09:04:00 -0000 From: Masami Hiramatsu Organization: Systems Development Lab., Hitachi, Ltd., Japan User-Agent: Thunderbird 1.5.0.7 (Windows/20060909) MIME-Version: 1.0 To: "Keshavamurthy, Anil S" , Ananth N Mavinakayanahalli , Prasanna S Panchamukhi , Ingo Molnar , SystemTAP Cc: Masami Hiramatsu , Satoshi Oshima , Hideo Aoki , Yumiko Sugita Subject: [PATCH 5/5][djprobe] delayed invoking commit_djprobes() References: <45338593.6090207@hitachi.com> In-Reply-To: <45338593.6090207@hitachi.com> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Mailing-List: contact systemtap-help@sourceware.org; run by ezmlm Precedence: bulk List-Subscribe: List-Post: List-Help: , Sender: systemtap-owner@sourceware.org X-SW-Source: 2006-q4/txt/msg00181.txt.bz2 Hi, This patch invokes commit_djprobes() function from a worker. This worker is scheduled automatically by register/ unregister_djprobe() functions and is executed in 0.1 second. If the worker fails freezing processes, it will try again after 0.1 second. Thanks, -- Masami HIRAMATSU Linux Technology Center Hitachi, Ltd., Systems Development Laboratory E-mail: masami.hiramatsu.pt@hitachi.com --- kernel/djprobe.c | 23 ++++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) Index: linux-2.6.19-rc1-mm1/kernel/djprobe.c =================================================================== --- linux-2.6.19-rc1-mm1.orig/kernel/djprobe.c 2006-10-16 22:06:22.000000000 +0900 +++ linux-2.6.19-rc1-mm1/kernel/djprobe.c 2006-10-16 22:06:44.000000000 +0900 @@ -64,6 +64,15 @@ static LIST_HEAD(registering_list); static LIST_HEAD(unregistering_list); +static void commit_work_fn(void * data); +static DECLARE_WORK(commit_work, commit_work_fn, 0); +#define DJPROBE_COMMIT_DELAY (HZ/10) + +static __always_inline void kick_delayed_commit(void) +{ + schedule_delayed_work(&commit_work, DJPROBE_COMMIT_DELAY); +} + static int __djprobe_pre_handler(struct kprobe *kp, struct pt_regs *regs) { struct djprobe_instance *djpi = @@ -211,12 +220,18 @@ int __kprobes commit_djprobes(void) { - int ret; + int ret = 0; BUG_ON(in_interrupt()); + commit_work_fn(NULL); + return ret; +} + +static void commit_work_fn(void * data) +{ mutex_lock(&djprobe_mutex); - ret = __commit_djprobes(); + if (__commit_djprobes() < 0) + kick_delayed_commit();/* try again */ mutex_unlock(&djprobe_mutex); - return ret; } int __kprobes register_djprobe(struct djprobe *djp) @@ -265,6 +280,7 @@ djp->inst = djpi; INIT_LIST_HEAD(&djp->plist); list_add_rcu(&djp->plist, &djpi->plist); + kick_delayed_commit(); out: mutex_unlock(&djprobe_mutex); @@ -286,6 +302,7 @@ list_del_init(&djpi->rlist); arch_pre_remove_djprobe_instance(djpi); list_add(&djpi->rlist, &unregistering_list); + kick_delayed_commit(); } mutex_unlock(&djprobe_mutex); }