From patchwork Wed Apr 24 11:42:54 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 16374 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-la0-f70.google.com (mail-la0-f70.google.com [209.85.215.70]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 37E1123918 for ; Wed, 24 Apr 2013 11:47:36 +0000 (UTC) Received: by mail-la0-f70.google.com with SMTP id ev20sf2294916lab.5 for ; Wed, 24 Apr 2013 04:46:44 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-received:mime-version:x-beenthere:x-received:received-spf :x-received:x-forwarded-to:x-forwarded-for:delivered-to:x-received :received-spf:x-received:from:to:cc:subject:date:message-id:x-mailer :in-reply-to:references:in-reply-to:references:x-gm-message-state :x-original-sender:x-original-authentication-results:precedence :mailing-list:list-id:x-google-group-id:list-post:list-help :list-archive:list-unsubscribe; bh=3iNTk3mebmwd+PUyOMT6BiEyd+DcD0V89ZlcHv1I6aY=; b=F1BiQBKXVlHfJJU0OiJIP6blhDvykTMhAODuR7ji0RAwub/lCUluCChQQ3k/ikCS7r UJhQYGykE2L7yRTnLTgRkfBU3/0CTV25RufalwxxSyW/7FMUAellCmaFfDdRwndi/xQF ZZXdX26nGmmiy3xUTX+30nJ13bXW/FQ2QKRrC6le2cfS7He66FOdgLj2QH3cf1jzrG0f bgZRKC323JyfvqpZu7YBub83GmHl3di/n7fcake4TZlEv4fyVeLuPzOSlh1xHTiRPQbZ rRz6aKibiWczJGacB6AugxSRrFwOpd5tBIFwJMt+FyZednTNaqyx1HuBfvXqj9qJQOoE NemQ== X-Received: by 10.180.10.230 with SMTP id l6mr20009208wib.3.1366804003972; Wed, 24 Apr 2013 04:46:43 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.180.93.201 with SMTP id cw9ls477557wib.14.gmail; Wed, 24 Apr 2013 04:46:43 -0700 (PDT) X-Received: by 10.194.235.196 with SMTP id uo4mr67847588wjc.30.1366804003905; Wed, 24 Apr 2013 04:46:43 -0700 (PDT) Received: from mail-ve0-x231.google.com (mail-ve0-x231.google.com [2607:f8b0:400c:c01::231]) by mx.google.com with ESMTPS id t9si755268wiv.68.2013.04.24.04.46.43 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 24 Apr 2013 04:46:43 -0700 (PDT) Received-SPF: neutral (google.com: 2607:f8b0:400c:c01::231 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=2607:f8b0:400c:c01::231; Received: by mail-ve0-f177.google.com with SMTP id cy12so665924veb.8 for ; Wed, 24 Apr 2013 04:46:42 -0700 (PDT) X-Received: by 10.221.0.199 with SMTP id nn7mr25213120vcb.14.1366804002845; Wed, 24 Apr 2013 04:46:42 -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.58.127.98 with SMTP id nf2csp169529veb; Wed, 24 Apr 2013 04:46:42 -0700 (PDT) X-Received: by 10.68.254.225 with SMTP id al1mr47881429pbd.69.1366804001981; Wed, 24 Apr 2013 04:46:41 -0700 (PDT) Received: from mail-pd0-f170.google.com (mail-pd0-f170.google.com [209.85.192.170]) by mx.google.com with ESMTPS id pl14si2655040pab.198.2013.04.24.04.46.41 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 24 Apr 2013 04:46:41 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.192.170 is neither permitted nor denied by best guess record for domain of viresh.kumar@linaro.org) client-ip=209.85.192.170; Received: by mail-pd0-f170.google.com with SMTP id 10so1081633pdi.1 for ; Wed, 24 Apr 2013 04:46:41 -0700 (PDT) X-Received: by 10.68.180.132 with SMTP id do4mr47037227pbc.96.1366804001551; Wed, 24 Apr 2013 04:46:41 -0700 (PDT) Received: from localhost ([122.172.242.146]) by mx.google.com with ESMTPSA id ew5sm2786329pbc.9.2013.04.24.04.46.34 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Wed, 24 Apr 2013 04:46:40 -0700 (PDT) From: Viresh Kumar To: tj@kernel.org Cc: davem@davemloft.net, airlied@redhat.com, axboe@kernel.dk, tglx@linutronix.de, peterz@infradead.org, mingo@redhat.com, rostedt@goodmis.org, linux-rt-users@vger.kernel.org, linux-kernel@vger.kernel.org, robin.randhawa@arm.com, Steve.Bannister@arm.com, Liviu.Dudau@arm.com, charles.garcia-tobin@arm.com, arvind.chauhan@arm.com, linaro-kernel@lists.linaro.org, patches@linaro.org, Viresh Kumar Subject: [PATCH V5 2/5] workqueue: Add system wide power_efficient workqueues Date: Wed, 24 Apr 2013 17:12:54 +0530 Message-Id: X-Mailer: git-send-email 1.7.12.rc2.18.g61b472e In-Reply-To: References: In-Reply-To: References: X-Gm-Message-State: ALoCoQkgKZFncp5UbP9kwgjzPqyw7B9JMigEtqxCZ77BsopsFM2fYsjBI82Ce+R62rP2+bnxLAxY X-Original-Sender: viresh.kumar@linaro.org X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 2607:f8b0:400c:c01::231 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) 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: , This patch adds system wide workqueues aligned towards power saving. This is done by allocating them with WQ_UNBOUND flag if 'wq_power_efficient' is set to 'true'. Signed-off-by: Viresh Kumar --- include/linux/workqueue.h | 7 +++++++ kernel/workqueue.c | 13 ++++++++++++- 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/include/linux/workqueue.h b/include/linux/workqueue.h index 83fa570..ac3e0e29 100644 --- a/include/linux/workqueue.h +++ b/include/linux/workqueue.h @@ -336,11 +336,18 @@ enum { * * system_freezable_wq is equivalent to system_wq except that it's * freezable. + * + * *_power_efficient_wq are inclined towards saving power. They are converted + * into WQ_UNBOUND variants, if 'wq_power_efficient' is set to 'true'. Otherwise + * they are same as their sibling types. Like: system_power_efficient_wq will + * behave like system_wq if 'wq_power_efficient' is not set to 'true'. */ extern struct workqueue_struct *system_wq; extern struct workqueue_struct *system_long_wq; extern struct workqueue_struct *system_unbound_wq; extern struct workqueue_struct *system_freezable_wq; +extern struct workqueue_struct *system_power_efficient_wq; +extern struct workqueue_struct *system_freezable_power_efficient_wq; static inline struct workqueue_struct * __deprecated __system_nrt_wq(void) { diff --git a/kernel/workqueue.c b/kernel/workqueue.c index a327027..cb1c2cc 100644 --- a/kernel/workqueue.c +++ b/kernel/workqueue.c @@ -313,6 +313,10 @@ struct workqueue_struct *system_unbound_wq __read_mostly; EXPORT_SYMBOL_GPL(system_unbound_wq); struct workqueue_struct *system_freezable_wq __read_mostly; EXPORT_SYMBOL_GPL(system_freezable_wq); +struct workqueue_struct *system_power_efficient_wq __read_mostly; +EXPORT_SYMBOL_GPL(system_power_efficient_wq); +struct workqueue_struct *system_freezable_power_efficient_wq __read_mostly; +EXPORT_SYMBOL_GPL(system_freezable_power_efficient_wq); static int worker_thread(void *__worker); static void copy_workqueue_attrs(struct workqueue_attrs *to, @@ -4985,8 +4989,15 @@ static int __init init_workqueues(void) WQ_UNBOUND_MAX_ACTIVE); system_freezable_wq = alloc_workqueue("events_freezable", WQ_FREEZABLE, 0); + system_power_efficient_wq = alloc_workqueue("events_power_efficient", + WQ_POWER_EFFICIENT, 0); + system_freezable_power_efficient_wq = alloc_workqueue("events_freezable_power_efficient", + WQ_FREEZABLE | WQ_POWER_EFFICIENT, + 0); BUG_ON(!system_wq || !system_highpri_wq || !system_long_wq || - !system_unbound_wq || !system_freezable_wq); + !system_unbound_wq || !system_freezable_wq || + !system_power_efficient_wq || + !system_freezable_power_efficient_wq); return 0; } early_initcall(init_workqueues);