From patchwork Mon May 6 23:50:21 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Colin Cross X-Patchwork-Id: 2529151 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 E28263FE81 for ; Mon, 6 May 2013 23:55:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932331Ab3EFXz5 (ORCPT ); Mon, 6 May 2013 19:55:57 -0400 Received: from mail-gg0-f202.google.com ([209.85.161.202]:54290 "EHLO mail-gg0-f202.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932364Ab3EFXzn (ORCPT ); Mon, 6 May 2013 19:55:43 -0400 Received: by mail-gg0-f202.google.com with SMTP id 4so425417ggm.1 for ; Mon, 06 May 2013 16:55:42 -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=IseCsrJsDe2kjNMRlnF89e0Z+H4Hl14jtQVD3i8E9wU=; b=BlJy4dAdC+r374Z/GFrrlB21/ZP/h5YxYWTSEicfOVLE85dmk74EO+Woz2saXLncKy zaeMmtuAEJeKL1rpoBPtXEob2Qowh9k1TIisVcvpVko+bNlnaMnFufnboNQRx4aBR2Z7 KJEFlpk+mW7HRnXHKyAGfQdokLNVabmDMf/V1C5akkQ7Qqyzj6El6ZAJT96vxetDMKnK e40N6u9Vm3fGPpK6jDlgADHnb5sCjaVntWA5bMr6C5Q4P12lFqKoiOIomhchdnQKqMpT 0fUf3aXcKEzO39KtPjX57b3IwHZ6WsIgtppm+rez0ZCV5Jzf7By4TR2SzMfQTfLyc/OZ /Ing== X-Received: by 10.236.181.234 with SMTP id l70mr16971363yhm.53.1367884237446; Mon, 06 May 2013 16:50:37 -0700 (PDT) Received: from corp2gmr1-2.hot.corp.google.com (corp2gmr1-2.hot.corp.google.com [172.24.189.93]) by gmr-mx.google.com with ESMTPS id n23si2636753yhi.7.2013.05.06.16.50.37 for (version=TLSv1.1 cipher=AES128-SHA bits=128/128); Mon, 06 May 2013 16:50:37 -0700 (PDT) Received: from walnut.mtv.corp.google.com (walnut.mtv.corp.google.com [172.18.105.48]) by corp2gmr1-2.hot.corp.google.com (Postfix) with ESMTP id 45BC55A4250; Mon, 6 May 2013 16:50:37 -0700 (PDT) Received: by walnut.mtv.corp.google.com (Postfix, from userid 99897) id 04E8416078C; Mon, 6 May 2013 16:50:36 -0700 (PDT) From: Colin Cross To: linux-kernel@vger.kernel.org Cc: Pavel Machek , "Rafael J. Wysocki" , Peter Zijlstra , Ingo Molnar , Andrew Morton , Mandeep Singh Baines , Colin Cross , Oleg Nesterov , linux-nfs@vger.kernel.org, linux-pm@vger.kernel.org, netdev@vger.kernel.org, Linus Torvalds , Tejun Heo , "David S. Miller" , Eric Dumazet , Al Viro , "Eric W. Biederman" , Gao feng Subject: [PATCH v3 16/16] af_unix: use freezable blocking calls in read Date: Mon, 6 May 2013 16:50:21 -0700 Message-Id: <1367884221-20462-17-git-send-email-ccross@android.com> X-Mailer: git-send-email 1.8.2.1 In-Reply-To: <1367884221-20462-1-git-send-email-ccross@android.com> References: <1367884221-20462-1-git-send-email-ccross@android.com> X-Gm-Message-State: ALoCoQnjqujX21i8lFmr/458NPVFZpazR48xTT3UypYrRpMxM/YDz71lI8/cI3VHM+8M+KnLtBsLN5EhZX2gm/IoLfvuZp8jWb6xYL2oR8Wtp6Ag6+55OXeK9H9uB1nLpaCYgW81yOw6ztWmk0aqReH2BdhxCWzIIar/uacci6YOiCMR9HZqP83weEKOjW43ZTwZELOE3RIW 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 read call on an AF_UNIX socket 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. Acked-by: Tejun Heo Signed-off-by: Colin Cross --- net/unix/af_unix.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/net/unix/af_unix.c b/net/unix/af_unix.c index 2db702d..2bcac57 100644 --- a/net/unix/af_unix.c +++ b/net/unix/af_unix.c @@ -114,6 +114,7 @@ #include #include #include +#include struct hlist_head unix_socket_table[2 * UNIX_HASH_SIZE]; EXPORT_SYMBOL_GPL(unix_socket_table); @@ -1880,7 +1881,7 @@ static long unix_stream_data_wait(struct sock *sk, long timeo) set_bit(SOCK_ASYNC_WAITDATA, &sk->sk_socket->flags); unix_state_unlock(sk); - timeo = schedule_timeout(timeo); + timeo = freezable_schedule_timeout(timeo); unix_state_lock(sk); clear_bit(SOCK_ASYNC_WAITDATA, &sk->sk_socket->flags); }