Received: by 10.192.165.148 with SMTP id m20csp5051431imm; Tue, 1 May 2018 08:16:40 -0700 (PDT) X-Google-Smtp-Source: AB8JxZobJ/2V9nbhunTquFnk9mkKWWUtByyp/opAjmqemyXFLNNEAgqtSbwaANTK4Sj9TqBHNiaa X-Received: by 2002:a63:6445:: with SMTP id y66-v6mr13312442pgb.206.1525187800362; Tue, 01 May 2018 08:16:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1525187800; cv=none; d=google.com; s=arc-20160816; b=bW7waugJq2kX8Rk5vtTLl6UzX0DNrPL+d8qjOhviyMVYuh1zYIgFsh81kLgx7F3vgj s76melAY1KZztjxD89iazLY6z5MmYwFHQvnnQWU+VtMITKEhD+01J+TCh/CryUolQQUg Huxv4oYc9l3tphYZEz5V4NDl6jQrwM2tZRr88jRtdMxkxUJOPeZbsO1IvTsvik9b4P5M PnjApi+NDLW2d9WsISd4qF3DiQl2jekT2m59l1de8Rlfd9/MKB9y8GjVAentkoJ9fASk fYloXSElZiK94gJKbVw88LydiETnrN+LhFfyv6wi3/LXtzXV0pbdeqQG3kPoTFKnGPrV e57w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature :arc-authentication-results; bh=c7qf5bLQWlP/N0RI3fa6xt1b3k1a/5IUQHZ1+ddY1RE=; b=sE22uKp28mPHwCDggCJgbdcJ7z0jzpvz5fUcLkDaFxtZIQ5MRJDanGMnMXDMBjkAxU IFf8TwKcTAGbxSo6DkG0bJn595mZQL3kVe6YtntLA2JWuimOHRWz011ubG8AokXPB5W9 icygsaG41GIyKy+pTr+yG/Bq/nt0Rfa/z1LZpe/BHU9XgaAxyTamtn45/Gw10ekxQ2TC G+A6ytgqYWVSsYhVa5h0CEgy7OsHLEEB6tc5la2zEQ8iWqR1gwsOMl7ibdtsVmsfwTEp ZEodC146MxEiYzrQxXf0XMWkwtP6fWBiP5EutYMn9Yxq3SiWZMEfHAH9rPtv3QXgar54 lklw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=hQS7OjUs; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id bf1-v6si1281972plb.422.2018.05.01.08.16.25; Tue, 01 May 2018 08:16:40 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=hQS7OjUs; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755534AbeEAPQP (ORCPT + 99 others); Tue, 1 May 2018 11:16:15 -0400 Received: from mail-it0-f67.google.com ([209.85.214.67]:39084 "EHLO mail-it0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755074AbeEAPQO (ORCPT ); Tue, 1 May 2018 11:16:14 -0400 Received: by mail-it0-f67.google.com with SMTP id c3-v6so13447257itj.4 for ; Tue, 01 May 2018 08:16:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=c7qf5bLQWlP/N0RI3fa6xt1b3k1a/5IUQHZ1+ddY1RE=; b=hQS7OjUsL+uAJ9NA2ldNblzUTXf/V1kAg9jGDif55juhd+4X2xJ/L/Uo1uFMRxl3Ji wRDRYFARjNThNXoDwgcxcu+ZGf+O6YsRZIITSYy/cYcvNCfTyrt6cW17x5DatnjsNY46 wg3E33djm5PsfQaHUhDo2ApCQrd9/2klBeD6Mfux3GTSCtGj25ftE8pVpGAGaWEg67LJ JnVwbZv8S7r8qBVH1QWEeg7VaIchSuYyhumB2l0KlM2GLVkLF9Bklo1FChmjieYWNzp4 fNMJ6VdmMS+dxX+ER71v05qBS7eqtoeb0zJoBnildtZv2oSh6rkgoXYAf8KuHtrCntFT fCpw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=c7qf5bLQWlP/N0RI3fa6xt1b3k1a/5IUQHZ1+ddY1RE=; b=dF1Tk+eqogH+zQ9jvjgfEcuDfGD6H58xKLApsK68bTTyj4O3JxJHo6aGkPzmvkHpkK oSgKfxDo6NX83N3TvB8L2Los9rUOP+1LNaYKJeCgGB/d614xy3fpB5PGl33o10yofwyt kev0p38F6rZkXMYfxuOftpv/ptsbbgmqb9ghfdWU4xKbi/mJ3UK9P9IP1tRuZD8D0HY3 YB00SY+iZywtUE5Yy0ejs0V3vzdVGKcYEgcty/Od2a0qvzeZfnRQtYo+qrlPEZL2qtTD Cm6bSt5ykNt0uraVjGvbT4e9+X9dpPnzHx+J3e/fG9esKfNJZyaVTdnm4ZbKIOYZuquq Py7w== X-Gm-Message-State: ALQs6tC5X8kQ5MKVMn4xeYAlDNoQ6EbMhTZ8lJuSPoqJkxI3RLADHe4+ 8TEkk3Kbh7RtEazQxfQTnkv9rpJE/XIitKje18huTg== X-Received: by 2002:a24:c4c1:: with SMTP id v184-v6mr11549266itf.41.1525187772886; Tue, 01 May 2018 08:16:12 -0700 (PDT) MIME-Version: 1.0 References: <20180501014204.67548-1-joelaf@google.com> <20180501014204.67548-6-joelaf@google.com> <20180501102401.2cac5781@gandalf.local.home> <20180501143601.GG26088@linux.vnet.ibm.com> In-Reply-To: <20180501143601.GG26088@linux.vnet.ibm.com> From: Joel Fernandes Date: Tue, 01 May 2018 15:16:02 +0000 Message-ID: Subject: Re: [PATCH RFC v5 5/6] tracepoint: Make rcuidle tracepoint callers use SRCU To: Paul McKenney Cc: Steven Rostedt , LKML , Peter Zijlstra , Ingo Molnar , Mathieu Desnoyers , Tom Zanussi , Namhyung Kim , Thomas Gleixner , Boqun Feng , "Cc: Frederic Weisbecker" , Randy Dunlap , Masami Hiramatsu , Fenguang Wu , Baohong Liu , Vedang Patel , "Cc: Android Kernel" Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, May 1, 2018 at 7:34 AM Paul E. McKenney wrote: > On Tue, May 01, 2018 at 10:24:01AM -0400, Steven Rostedt wrote: > > On Mon, 30 Apr 2018 18:42:03 -0700 > > Joel Fernandes wrote: > > > > > In recent tests with IRQ on/off tracepoints, a large performance > > > overhead ~10% is noticed when running hackbench. This is root caused to > > > calls to rcu_irq_enter_irqson and rcu_irq_exit_irqson from the > > > tracepoint code. Following a long discussion on the list [1] about this, > > > we concluded that srcu is a better alternative for use during rcu idle. > > > Although it does involve extra barriers, its lighter than the sched-rcu > > > version which has to do additional RCU calls to notify RCU idle about > > > entry into RCU sections. > > > > > > In this patch, we change the underlying implementation of the > > > trace_*_rcuidle API to use SRCU. This has shown to improve performance > > > alot for the high frequency irq enable/disable tracepoints. > [ . . . ] > > > --- a/kernel/tracepoint.c > > > +++ b/kernel/tracepoint.c > > > @@ -31,6 +31,9 @@ > > > extern struct tracepoint * const __start___tracepoints_ptrs[]; > > > extern struct tracepoint * const __stop___tracepoints_ptrs[]; > > > > > > +DEFINE_SRCU(tracepoint_srcu); > > > +EXPORT_SYMBOL_GPL(tracepoint_srcu); > > > + > > > /* Set to 1 to enable tracepoint debug output */ > > > static const int tracepoint_debug; > > > > > > @@ -67,11 +70,16 @@ static inline void *allocate_probes(int count) > > > return p == NULL ? NULL : p->probes; > > > } > > > > > > -static void rcu_free_old_probes(struct rcu_head *head) > > > +static void srcu_free_old_probes(struct rcu_head *head) > > > { > > > kfree(container_of(head, struct tp_probes, rcu)); > > > } > > > > > > +static void rcu_free_old_probes(struct rcu_head *head) > > > +{ > > > + call_srcu(&tracepoint_srcu, head, srcu_free_old_probes); > > > > Hmm, is it OK to call call_srcu() from a call_rcu() callback? I guess > > it would be. > It is perfectly legal, and quite a bit simpler than setting something > up to wait for both to complete concurrently. Cool. Also in this case if we call both in sequence, then I felt there could be a race to free the old data since both callbacks would try to do the same thing. The same thing being freeing of the same set of old probes which would need some synchronization between the 2 callbacks. With the chaining, since the ordering is assured there wouldn't be a question of such a race. I could add this reasoning to the changelog as well. thanks, - Joel