mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Peter Zijlstra <peterz@infradead.org>
To: Vivek Goyal <vgoyal@redhat.com>
Cc: Fengguang Wu <fengguang.wu@intel.com>,
	John Stultz <john.stultz@linaro.org>,
	Ingo Molnar <mingo@kernel.org>,
	linux-kernel@vger.kernel.org, Jens Axboe <axboe@kernel.dk>,
	Tejun Heo <tj@kernel.org>
Subject: Re: [seqcount] INFO: trying to register non-static key.
Date: Tue, 12 Nov 2013 16:29:56 +0100	[thread overview]
Message-ID: <20131112152956.GY5056@laptop.programming.kicks-ass.net> (raw)
In-Reply-To: <20131112151541.GD24980@redhat.com>

On Tue, Nov 12, 2013 at 10:15:41AM -0500, Vivek Goyal wrote:
> I see that we allocate per cpu stats but don't do any initializations.
> 
> static void tg_stats_alloc_fn(struct work_struct *work)
> {
>         static struct tg_stats_cpu *stats_cpu;  /* this fn is non-reentrant */
>         struct delayed_work *dwork = to_delayed_work(work);
>         bool empty = false;
> 
> alloc_stats:
>         if (!stats_cpu) {
>                 stats_cpu = alloc_percpu(struct tg_stats_cpu);
>                 if (!stats_cpu) {
>                         /* allocation failed, try again after some time */
>                         schedule_delayed_work(dwork, msecs_to_jiffies(10));
>                         return;
>                 }
>         }
> 
>         spin_lock_irq(&tg_stats_alloc_lock);

Absolutely!

Something like this perhaps? Did I miss more blkg_[rw]stats? If I read
the git grep output right, this was the last one.

---
 block/blk-throttle.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/block/blk-throttle.c b/block/blk-throttle.c
index 8331aba9426f..fd743d98c41d 100644
--- a/block/blk-throttle.c
+++ b/block/blk-throttle.c
@@ -256,6 +256,12 @@ static struct throtl_data *sq_to_td(struct throtl_service_queue *sq)
 	}								\
 } while (0)
 
+static void tg_stats_init(struct tg_stats_cpu *tg_stats)
+{
+	blkg_rwstat_init(&tg_stats->service_bytes);
+	blkg_rwstat_init(&tg_stats->serviced);
+}
+
 /*
  * Worker for allocating per cpu stat for tgs. This is scheduled on the
  * system_wq once there are some groups on the alloc_list waiting for
@@ -269,12 +275,16 @@ static void tg_stats_alloc_fn(struct work_struct *work)
 
 alloc_stats:
 	if (!stats_cpu) {
+		int cpu;
+
 		stats_cpu = alloc_percpu(struct tg_stats_cpu);
 		if (!stats_cpu) {
 			/* allocation failed, try again after some time */
 			schedule_delayed_work(dwork, msecs_to_jiffies(10));
 			return;
 		}
+		for_each_possible_cpu(cpu)
+			tg_stats_init(per_cpu(stats_cpu, cpu));
 	}
 
 	spin_lock_irq(&tg_stats_alloc_lock);

  reply	other threads:[~2013-11-12 15:30 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-11-11  1:29 Fengguang Wu
2013-11-11 15:45 ` Peter Zijlstra
2013-11-11 16:03   ` Vivek Goyal
2013-11-12  9:41   ` Fengguang Wu
2013-11-12  9:50     ` Ingo Molnar
2013-11-12 10:01     ` Peter Zijlstra
2013-11-12 15:03       ` Fengguang Wu
2013-11-12 15:18         ` Fengguang Wu
2013-11-12 15:15       ` Vivek Goyal
2013-11-12 15:29         ` Peter Zijlstra [this message]
2013-11-12 15:46           ` Vivek Goyal
2013-11-13  3:35           ` Fengguang Wu
2013-11-13  3:35           ` John Stultz

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20131112152956.GY5056@laptop.programming.kicks-ass.net \
    --to=peterz@infradead.org \
    --cc=axboe@kernel.dk \
    --cc=fengguang.wu@intel.com \
    --cc=john.stultz@linaro.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=tj@kernel.org \
    --cc=vgoyal@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome