From patchwork Mon May 5 20:47:43 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Stultz X-Patchwork-Id: 29676 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-qg0-f70.google.com (mail-qg0-f70.google.com [209.85.192.70]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 920E0202E6 for ; Mon, 5 May 2014 20:48:06 +0000 (UTC) Received: by mail-qg0-f70.google.com with SMTP id i50sf9105389qgf.1 for ; Mon, 05 May 2014 13:48:06 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:cc:subject :date:message-id:in-reply-to:references:x-original-sender :x-original-authentication-results:precedence:mailing-list:list-id :list-post:list-help:list-archive:list-unsubscribe; bh=AwrZqCvCZ+IqeU7bDLc9LkZlcszLaEf7IhZjfY2TgDk=; b=VGAhzlX5p7tc0Y44H6hX7rskv4x8Pz+46af8NJzW0mI22GAoMgEc8rJtyTdwcU4oOm XjGUE2qEepHDy4k54cinl22oifxZyI5GweNO9WDzmT3eBbct4cu090Utn3ZPiPFDKw3E 08oufAoKK+z/oYQs9oi+jLilYi8zgdNlqC128f0HQ0UNLIkOjAu0RjfJZMmIzSZJsWGP v+iPjzODVY3IzZU92g56hvODsGBn14H6chjktGe2ASon6h2jIHOrN/HYaVMEjZYlNjzc okoj3/ERZPKJxtEX+/LcVNJ0S0uaXKfbH2sH2Z66Nae5zICZTbDAOcsqH+yw1pPzRfV9 mV5g== X-Gm-Message-State: ALoCoQl6lq0A02l2o8t/3o7LiJzyu3BB9ulzW97xzpFltJlIMT6E3fEOkmAdZ3Ug4XEBAu4DuPMC X-Received: by 10.236.130.101 with SMTP id j65mr14917100yhi.29.1399322886394; Mon, 05 May 2014 13:48:06 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.106.98 with SMTP id d89ls796107qgf.57.gmail; Mon, 05 May 2014 13:48:06 -0700 (PDT) X-Received: by 10.220.162.6 with SMTP id t6mr29928317vcx.12.1399322886254; Mon, 05 May 2014 13:48:06 -0700 (PDT) Received: from mail-ve0-f177.google.com (mail-ve0-f177.google.com [209.85.128.177]) by mx.google.com with ESMTPS id ru8si1846627vcb.137.2014.05.05.13.48.06 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 05 May 2014 13:48:06 -0700 (PDT) Received-SPF: none (google.com: patch+caf_=patchwork-forward=linaro.org@linaro.org does not designate permitted sender hosts) client-ip=209.85.128.177; Received: by mail-ve0-f177.google.com with SMTP id db11so4647908veb.22 for ; Mon, 05 May 2014 13:48:06 -0700 (PDT) X-Received: by 10.52.227.138 with SMTP id sa10mr12364365vdc.25.1399322886163; Mon, 05 May 2014 13:48:06 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patches@linaro.org Received: by 10.220.221.72 with SMTP id ib8csp171021vcb; Mon, 5 May 2014 13:48:05 -0700 (PDT) X-Received: by 10.67.13.134 with SMTP id ey6mr34613892pad.44.1399322885448; Mon, 05 May 2014 13:48:05 -0700 (PDT) Received: from mail-pa0-f45.google.com (mail-pa0-f45.google.com [209.85.220.45]) by mx.google.com with ESMTPS id uu2si9664187pac.446.2014.05.05.13.48.05 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 05 May 2014 13:48:05 -0700 (PDT) Received-SPF: none (google.com: john.stultz@linaro.org does not designate permitted sender hosts) client-ip=209.85.220.45; Received: by mail-pa0-f45.google.com with SMTP id ey11so4983733pad.32 for ; Mon, 05 May 2014 13:48:05 -0700 (PDT) X-Received: by 10.66.142.42 with SMTP id rt10mr76420315pab.1.1399322884929; Mon, 05 May 2014 13:48:04 -0700 (PDT) Received: from localhost.localdomain (c-67-170-153-23.hsd1.or.comcast.net. [67.170.153.23]) by mx.google.com with ESMTPSA id ck10sm79423484pac.0.2014.05.05.13.48.01 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 05 May 2014 13:48:02 -0700 (PDT) From: John Stultz To: LKML Cc: John Stultz , Jan Kara , Peter Zijlstra , Jiri Bohac , Thomas Gleixner , Ingo Molnar , Andrew Morton , Steven Rostedt Subject: [PATCH 3/4] printk: Add printk_deferred_once Date: Mon, 5 May 2014 13:47:43 -0700 Message-Id: <1399322864-22861-4-git-send-email-john.stultz@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1399322864-22861-1-git-send-email-john.stultz@linaro.org> References: <1399322864-22861-1-git-send-email-john.stultz@linaro.org> X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: john.stultz@linaro.org X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: patch+caf_=patchwork-forward=linaro.org@linaro.org does not designate permitted sender hosts) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Precedence: list Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org List-ID: X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , Two of the three prink_deferred uses are really printk_once style uses, so add a printk_deferred_once macro to simplify those call sites. Cc: Jan Kara Cc: Peter Zijlstra Cc: Jiri Bohac Cc: Thomas Gleixner Cc: Ingo Molnar Cc: Andrew Morton Cc: Steven Rostedt Reviewed-by: Steven Rostedt Signed-off-by: John Stultz Reviewed-by: Jan Kara --- include/linux/printk.h | 11 +++++++++++ kernel/sched/deadline.c | 7 +------ kernel/sched/rt.c | 8 +------- 3 files changed, 13 insertions(+), 13 deletions(-) diff --git a/include/linux/printk.h b/include/linux/printk.h index 7847301..f086d6c 100644 --- a/include/linux/printk.h +++ b/include/linux/printk.h @@ -266,9 +266,20 @@ extern asmlinkage void dump_stack(void) __cold; printk(fmt, ##__VA_ARGS__); \ } \ }) +#define printk_deferred_once(fmt, ...) \ +({ \ + static bool __print_once __read_mostly; \ + \ + if (!__print_once) { \ + __print_once = true; \ + printk_deferred(fmt, ##__VA_ARGS__); \ + } \ +}) #else #define printk_once(fmt, ...) \ no_printk(fmt, ##__VA_ARGS__) +#define printk_deferred_once(fmt, ...) \ + no_printk(fmt, ##__VA_ARGS__) #endif #define pr_emerg_once(fmt, ...) \ diff --git a/kernel/sched/deadline.c b/kernel/sched/deadline.c index 657ed68..80837e9 100644 --- a/kernel/sched/deadline.c +++ b/kernel/sched/deadline.c @@ -348,12 +348,7 @@ static void replenish_dl_entity(struct sched_dl_entity *dl_se, * entity. */ if (dl_time_before(dl_se->deadline, rq_clock(rq))) { - static bool lag_once = false; - - if (!lag_once) { - lag_once = true; - printk_deferred("sched: DL replenish lagged to much\n"); - } + printk_deferred_once("sched: DL replenish lagged to much\n"); dl_se->deadline = rq_clock(rq) + pi_se->dl_deadline; dl_se->runtime = pi_se->dl_runtime; } diff --git a/kernel/sched/rt.c b/kernel/sched/rt.c index e7dc728..ea4d500 100644 --- a/kernel/sched/rt.c +++ b/kernel/sched/rt.c @@ -890,14 +890,8 @@ static int sched_rt_runtime_exceeded(struct rt_rq *rt_rq) * but accrue some time due to boosting. */ if (likely(rt_b->rt_runtime)) { - static bool once = false; - rt_rq->rt_throttled = 1; - - if (!once) { - once = true; - printk_deferred("sched: RT throttling activated\n"); - } + printk_deferred_once("sched: RT throttling activated\n"); } else { /* * In case we did anyway, make it go away,