From patchwork Thu May 2 01:35:02 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Colin Cross X-Patchwork-Id: 2509711 Return-Path: X-Original-To: patchwork-linux-pm@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork1.kernel.org (Postfix) with ESMTP id 514173FC5A for ; Thu, 2 May 2013 01:37:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1759031Ab3EBBgl (ORCPT ); Wed, 1 May 2013 21:36:41 -0400 Received: from mail-gg0-f201.google.com ([209.85.161.201]:59834 "EHLO mail-gg0-f201.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757675Ab3EBBfS (ORCPT ); Wed, 1 May 2013 21:35:18 -0400 Received: by mail-gg0-f201.google.com with SMTP id k25so14312ggl.0 for ; Wed, 01 May 2013 18:35:18 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-received:from:to:cc:subject:date:message-id:x-mailer:in-reply-to :references:x-gm-message-state; bh=40LBjCApOT21JpaPt9C3RXyftZOOdOwCKSKfV+KTCZ0=; b=Mo2YJVH7ghfGeKkz2N0G+UDNNXKBoWKVPmpnndLeN1cradMrjvexmTTd5Qe0H8pC1X mNqIP56swqhKnmlAlU0HA/B8JJfB/4T9dIKaQBeEWSaAE6bt1mvMmF1+9KLE3VTK1srS +hO5slniNYGRRX1YZqXqUj2ACEb3uNeiLVg3thUtMMo9s/DfmIswhztnIbdvMCDr94VC DOGbJ6+l4omqJwft1xjqeV/HJtOARS+kJ2EwX5Evg+cFAf1Uhp4qd2GhnXulxAE0I8rP fUCnhUXWtHkgfil7wiqoPXNSqY/2QdCAMvt1y8XfXUC/JgwwhX/0vp9DaMbdZ+YhOYvO gVWQ== X-Received: by 10.236.145.131 with SMTP id p3mr3683799yhj.6.1367458518142; Wed, 01 May 2013 18:35:18 -0700 (PDT) Received: from corp2gmr1-1.hot.corp.google.com (corp2gmr1-1.hot.corp.google.com [172.24.189.92]) by gmr-mx.google.com with ESMTPS id s48si395390yhe.6.2013.05.01.18.35.18 for (version=TLSv1.1 cipher=AES128-SHA bits=128/128); Wed, 01 May 2013 18:35:18 -0700 (PDT) Received: from walnut.mtv.corp.google.com (walnut.mtv.corp.google.com [172.18.105.48]) by corp2gmr1-1.hot.corp.google.com (Postfix) with ESMTP id F01CF31C2F3; Wed, 1 May 2013 18:35:17 -0700 (PDT) Received: by walnut.mtv.corp.google.com (Postfix, from userid 99897) id B06AB160D29; Wed, 1 May 2013 18:35:17 -0700 (PDT) From: Colin Cross To: linux-pm@vger.kernel.org Cc: linux-kernel@vger.kernel.org, "Rafael J. Wysocki" , arve@android.com, Tejun Heo , Oleg Nesterov , Colin Cross , Greg Kroah-Hartman , Al Viro , "Eric W. Biederman" , Sachin Kamat , devel@driverdev.osuosl.org Subject: [PATCH v2 04/10] binder: use freezable blocking calls Date: Wed, 1 May 2013 18:35:02 -0700 Message-Id: <1367458508-9133-5-git-send-email-ccross@android.com> X-Mailer: git-send-email 1.8.2.1 In-Reply-To: <1367458508-9133-1-git-send-email-ccross@android.com> References: <1367458508-9133-1-git-send-email-ccross@android.com> X-Gm-Message-State: ALoCoQmL7UUBmNAm1Q+qjS5h4q3TpQORfgDbu0QSpkdqyE60hdEbMA8zh3GNScVhAaVFofd/XTW0Ev8z0XXUWKt12s9xIKRZzdvWZpqJQkxqjJbsVuZOnSU6T9JohUDtoOx+8kr1j4VhsZYTCRNHvZzfHu0eQJTQiiD9t+oDOG+nFluX20MKOAEj2XE2OiVBpxRoWXU/3NDK Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org Avoid waking up every thread sleeping in a binder call during suspend and resume by calling a freezable blocking call. Previous patches modified the freezer to avoid sending wakeups to threads that are blocked in freezable blocking calls. This call was selected to be converted to a freezable call because it doesn't hold any locks or release any resources when interrupted that might be needed by another freezing task or a kernel driver during suspend, and is a common site where idle userspace tasks are blocked. Signed-off-by: Colin Cross --- drivers/staging/android/binder.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/staging/android/binder.c b/drivers/staging/android/binder.c index 24456a0..af8fba4 100644 --- a/drivers/staging/android/binder.c +++ b/drivers/staging/android/binder.c @@ -20,6 +20,7 @@ #include #include #include +#include #include #include #include @@ -2140,13 +2141,13 @@ retry: if (!binder_has_proc_work(proc, thread)) ret = -EAGAIN; } else - ret = wait_event_interruptible_exclusive(proc->wait, binder_has_proc_work(proc, thread)); + ret = wait_event_freezable_exclusive(proc->wait, binder_has_proc_work(proc, thread)); } else { if (non_block) { if (!binder_has_thread_work(thread)) ret = -EAGAIN; } else - ret = wait_event_interruptible(thread->wait, binder_has_thread_work(thread)); + ret = wait_event_freezable(thread->wait, binder_has_thread_work(thread)); } binder_lock(__func__);