From patchwork Mon Sep 26 19:13:54 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Stultz X-Patchwork-Id: 4352 Return-Path: X-Original-To: patchwork@peony.canonical.com Delivered-To: patchwork@peony.canonical.com Received: from fiordland.canonical.com (fiordland.canonical.com [91.189.94.145]) by peony.canonical.com (Postfix) with ESMTP id BD7B123F57 for ; Mon, 26 Sep 2011 19:14:12 +0000 (UTC) Received: from mail-fx0-f52.google.com (mail-fx0-f52.google.com [209.85.161.52]) by fiordland.canonical.com (Postfix) with ESMTP id B18A7A1860E for ; Mon, 26 Sep 2011 19:14:12 +0000 (UTC) Received: by mail-fx0-f52.google.com with SMTP id 23so8797872fxe.11 for ; Mon, 26 Sep 2011 12:14:12 -0700 (PDT) Received: by 10.223.30.151 with SMTP id u23mr1663741fac.122.1317064452520; Mon, 26 Sep 2011 12:14:12 -0700 (PDT) X-Forwarded-To: linaro-patchwork@canonical.com X-Forwarded-For: patch@linaro.org linaro-patchwork@canonical.com Delivered-To: patches@linaro.org Received: by 10.152.3.234 with SMTP id f10cs48602laf; Mon, 26 Sep 2011 12:14:12 -0700 (PDT) Received: by 10.150.63.3 with SMTP id l3mr6281984yba.274.1317064451357; Mon, 26 Sep 2011 12:14:11 -0700 (PDT) Received: from e4.ny.us.ibm.com (e4.ny.us.ibm.com. [32.97.182.144]) by mx.google.com with ESMTPS id g38si9763502anh.87.2011.09.26.12.14.10 (version=TLSv1/SSLv3 cipher=OTHER); Mon, 26 Sep 2011 12:14:11 -0700 (PDT) Received-SPF: pass (google.com: domain of jstultz@us.ibm.com designates 32.97.182.144 as permitted sender) client-ip=32.97.182.144; Authentication-Results: mx.google.com; spf=pass (google.com: domain of jstultz@us.ibm.com designates 32.97.182.144 as permitted sender) smtp.mail=jstultz@us.ibm.com Received: from d01relay04.pok.ibm.com (d01relay04.pok.ibm.com [9.56.227.236]) by e4.ny.us.ibm.com (8.14.4/8.13.1) with ESMTP id p8QIoBSa015708; Mon, 26 Sep 2011 14:50:11 -0400 Received: from d03av03.boulder.ibm.com (d03av03.boulder.ibm.com [9.17.195.169]) by d01relay04.pok.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id p8QJE8bX150806; Mon, 26 Sep 2011 15:14:08 -0400 Received: from d03av03.boulder.ibm.com (loopback [127.0.0.1]) by d03av03.boulder.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id p8QJE4L9013586; Mon, 26 Sep 2011 13:14:04 -0600 Received: from kernel.beaverton.ibm.com ([9.47.67.96]) by d03av03.boulder.ibm.com (8.14.4/8.13.1/NCO v10.0 AVin) with ESMTP id p8QJE4HK013507; Mon, 26 Sep 2011 13:14:04 -0600 Received: by kernel.beaverton.ibm.com (Postfix, from userid 1056) id 0D3B71E7515; Mon, 26 Sep 2011 12:14:03 -0700 (PDT) From: John Stultz To: lkml Cc: John Stultz , "Rafael J. Wysocki" , arve@android.com, markgross@thegnar.org, Alan Stern , amit.kucheria@linaro.org, farrowg@sg.ibm.com, "Dmitry Fink (Palm GBU)" , linux-pm@lists.linux-foundation.org, khilman@ti.com, Magnus Damm , mjg@redhat.com, peterz@infradead.org Subject: [PATCH 6/6] [RFC] alarmtimer: Deboost on nanosleep Date: Mon, 26 Sep 2011 12:13:54 -0700 Message-Id: <1317064434-1829-7-git-send-email-john.stultz@linaro.org> X-Mailer: git-send-email 1.7.3.2.146.gca209 In-Reply-To: <1317064434-1829-1-git-send-email-john.stultz@linaro.org> References: <1317064434-1829-1-git-send-email-john.stultz@linaro.org> Example of deboosting tasks before blocking on a wakeup source like alarmtimer based nanosleep. With this final patch, the kernel will be able to suspend when SCHED_STAYAWAKE flagged tasks are blocked on the alarmtimer. CC: Rafael J. Wysocki CC: arve@android.com CC: markgross@thegnar.org CC: Alan Stern CC: amit.kucheria@linaro.org CC: farrowg@sg.ibm.com CC: Dmitry Fink (Palm GBU) CC: linux-pm@lists.linux-foundation.org CC: khilman@ti.com CC: Magnus Damm CC: mjg@redhat.com CC: peterz@infradead.org Signed-off-by: John Stultz --- kernel/time/alarmtimer.c | 5 +++-- 1 files changed, 3 insertions(+), 2 deletions(-) diff --git a/kernel/time/alarmtimer.c b/kernel/time/alarmtimer.c index 00ee80f..c855d40 100644 --- a/kernel/time/alarmtimer.c +++ b/kernel/time/alarmtimer.c @@ -568,9 +568,10 @@ static int alarmtimer_do_nsleep(struct alarm *alarm, ktime_t absexp) do { set_current_state(TASK_INTERRUPTIBLE); alarm_start(alarm, absexp, ktime_set(0, 0)); - if (likely(alarm->data)) + if (likely(alarm->data)) { + sched_deboost_task_active_count(current); schedule(); - + } alarm_cancel(alarm); } while (alarm->data && !signal_pending(current));