From patchwork Mon Apr 29 21:45:38 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Colin Cross X-Patchwork-Id: 2502691 Return-Path: X-Original-To: patchwork-linux-pm@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork2.kernel.org (Postfix) with ESMTP id 53DA7DF25A for ; Mon, 29 Apr 2013 21:47:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932563Ab3D2VqA (ORCPT ); Mon, 29 Apr 2013 17:46:00 -0400 Received: from mail-qa0-f74.google.com ([209.85.216.74]:44004 "EHLO mail-qa0-f74.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1759535Ab3D2Vpz (ORCPT ); Mon, 29 Apr 2013 17:45:55 -0400 Received: by mail-qa0-f74.google.com with SMTP id bs12so240616qab.1 for ; Mon, 29 Apr 2013 14:45:54 -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=lT7zAVZWQdKADr+3i8scobI+kqfPG/Xyr7i+fhQpbII=; b=f+jAZm+jcp3B3QpmTV1DUqXOX+LZmpuVcoY5IyQQ5dzoVblM/OwLqF8x7tZAW+59X4 Iskrn09Q/DBBRqWPnc1Iv6Ql2Vc0ADEFjiwa/zmlW6DHyS5BHnxBy+O1kyAUrJnWPGRg wTnhOMnj4x9OFJLjRHQOZB7KzgipCDoYBpXaf/L76LoJZ9lTqy12vBR7r123NNXi6+qO M+xHPwFjHjthxpVVEMgzw78sOO9kWHxhYnlrCMM4WAEdBbG8vBZV/9Zu+vtGdqsKhEb2 agJ6RcLOLErKW4JCo6OI6Ekrq3aQFF7N4NpCXkv5Au6wp851GEjSfMkz072FSOs2M5pj XXrg== X-Received: by 10.236.63.101 with SMTP id z65mr17880161yhc.47.1367271954654; Mon, 29 Apr 2013 14:45:54 -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 u58si1361531yhe.2.2013.04.29.14.45.54 for (version=TLSv1.1 cipher=AES128-SHA bits=128/128); Mon, 29 Apr 2013 14:45:54 -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 7854F5A41F9; Mon, 29 Apr 2013 14:45:54 -0700 (PDT) Received: by walnut.mtv.corp.google.com (Postfix, from userid 99897) id 1E5A8161D2A; Mon, 29 Apr 2013 14:45:49 -0700 (PDT) From: Colin Cross To: linux-pm@vger.kernel.org Cc: linux-kernel@vger.kernel.org, "Rafael J. Wysocki" , arve@android.com, Colin Cross , Tejun Heo , Li Zefan , Len Brown , Pavel Machek , containers@lists.linux-foundation.org, cgroups@vger.kernel.org Subject: [PATCH 02/10] freezer: skip waking up tasks with PF_FREEZER_SKIP set Date: Mon, 29 Apr 2013 14:45:38 -0700 Message-Id: <1367271946-7239-3-git-send-email-ccross@android.com> X-Mailer: git-send-email 1.8.2.1 In-Reply-To: <1367271946-7239-1-git-send-email-ccross@android.com> References: <1367271946-7239-1-git-send-email-ccross@android.com> X-Gm-Message-State: ALoCoQmvCwU3XcX7GNAAqVYq0h2rLaOf21ZarHH/aU5Fly+cHqK6pg/f/bE70x7y3bNxT5RVXI+XQSvNpi13brSGNz9pN/bi/qq7EeN2EwmkHC5E/mIxXQS2h9RSy+CH18eg8ce73SO4cccmEZzCWtKnzuCnPF0zl4z5TNf4+A7J3aR48M3zjK+JAZlAhM+wLdjLs1jdjw1M Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org If a task has called freezer_do_not_count(), don't bother waking it up. If it happens to wake up later it will call freezer_count() and immediately enter the refrigerator. Signed-off-by: Colin Cross --- kernel/cgroup_freezer.c | 5 ++++- kernel/power/process.c | 4 ++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/kernel/cgroup_freezer.c b/kernel/cgroup_freezer.c index 75dda1e..406dd71 100644 --- a/kernel/cgroup_freezer.c +++ b/kernel/cgroup_freezer.c @@ -331,8 +331,11 @@ static void freeze_cgroup(struct freezer *freezer) struct task_struct *task; cgroup_iter_start(cgroup, &it); - while ((task = cgroup_iter_next(cgroup, &it))) + while ((task = cgroup_iter_next(cgroup, &it))) { + if (freezer_should_skip(task)) + continue; freeze_task(task); + } cgroup_iter_end(cgroup, &it); } diff --git a/kernel/power/process.c b/kernel/power/process.c index eb7e6c1..0680be2 100644 --- a/kernel/power/process.c +++ b/kernel/power/process.c @@ -46,10 +46,10 @@ static int try_to_freeze_tasks(bool user_only) todo = 0; read_lock(&tasklist_lock); do_each_thread(g, p) { - if (p == current || !freeze_task(p)) + if (p == current || freezer_should_skip(p)) continue; - if (!freezer_should_skip(p)) + if (freeze_task(p)) todo++; } while_each_thread(g, p); read_unlock(&tasklist_lock);