From patchwork Mon Mar 18 15:23:27 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 2293621 Return-Path: X-Original-To: patchwork-linux-mmc@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 AD1F4DF215 for ; Mon, 18 Mar 2013 15:25:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753630Ab3CRPYu (ORCPT ); Mon, 18 Mar 2013 11:24:50 -0400 Received: from mail-da0-f53.google.com ([209.85.210.53]:33403 "EHLO mail-da0-f53.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752800Ab3CRPYt (ORCPT ); Mon, 18 Mar 2013 11:24:49 -0400 Received: by mail-da0-f53.google.com with SMTP id n34so1393159dal.26 for ; Mon, 18 Mar 2013 08:24:48 -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:in-reply-to:references:x-gm-message-state; bh=I3HYOADlcUjDzvIx81r9t4berb6Wl96pAmsQHDwfTS8=; b=gcrLVBe5JJjqI2bUDxl1iCvzRtVnVUn4GvER8SNRYdMKA25LoNhzth0r+7VO6zzo5M /dfoFgSavGU47sfox9dFWTzu9zcMp055Zd2/d9t69V1jFsv1jFC/vaZN2r44woDYIIRI 30fK+vJyC7i/RRniI1KlQ2U1qrZmQ7g/CXL09dZOuUi4joZdZMsXSmRRVoLQdIad424L i/ZwxMDm04gbsPHSjUCFU2vnuGlyKWXBXl6ME83f4e/E9FBxHTawfg2MiWZbx8yJGFgx difHXviTBHflTmqJDyTUAQgfsOWTpjlaclUNfKsjPuG90IfZD9LnhPAPxpNZuwxZ6NhE FQsA== X-Received: by 10.68.212.170 with SMTP id nl10mr34057673pbc.39.1363620288280; Mon, 18 Mar 2013 08:24:48 -0700 (PDT) Received: from localhost ([122.167.69.232]) by mx.google.com with ESMTPS id m18sm8598082pad.17.2013.03.18.08.24.41 (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Mon, 18 Mar 2013 08:24:47 -0700 (PDT) From: Viresh Kumar To: pjt@google.com, paul.mckenney@linaro.org, tglx@linutronix.de, tj@kernel.org, suresh.b.siddha@intel.com, venki@google.com, mingo@redhat.com, peterz@infradead.org, rostedt@goodmis.org Cc: linaro-kernel@lists.linaro.org, robin.randhawa@arm.com, Steve.Bannister@arm.com, Liviu.Dudau@arm.com, charles.garcia-tobin@arm.com, Arvind.Chauhan@arm.com, linux-rt-users@vger.kernel.org, linux-kernel@vger.kernel.org, Viresh Kumar , Chris Ball , linux-mmc@vger.kernel.org Subject: [PATCH V3 5/7] mmc: queue work on any cpu Date: Mon, 18 Mar 2013 20:53:27 +0530 Message-Id: <08070dbf56439c84b8c25837c2049ff8e8eafd6e.1363617402.git.viresh.kumar@linaro.org> X-Mailer: git-send-email 1.7.12.rc2.18.g61b472e In-Reply-To: References: In-Reply-To: References: X-Gm-Message-State: ALoCoQlOmmm1po/zna9e6oH3ZihU1/o2APVIWnPdTG6vCkQG0Er4Kdw0JgWOI8QcijiVkxn6RXd5 Sender: linux-mmc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-mmc@vger.kernel.org mmc uses workqueues for running mmc_rescan(). There is no real dependency of scheduling these on the cpu which scheduled them. On a idle system, it is observed that and idle cpu wakes up many times just to service this work. It would be better if we can schedule it on a cpu which isn't idle to save on power. By idle cpu (from scheduler's perspective) we mean: - Current task is idle task - nr_running == 0 - wake_list is empty This patch replaces the queue_delayed_work() with queue_delayed_work_on_any_cpu() siblings. This routine would look for the closest (via scheduling domains) non-idle cpu (non-idle from schedulers perspective). If the current cpu is not idle or all cpus are idle, work will be scheduled on local cpu. Cc: Chris Ball Cc: linux-mmc@vger.kernel.org Signed-off-by: Viresh Kumar Acked-by: Ulf Hansson Acked-by: Chris Ball --- drivers/mmc/core/core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/mmc/core/core.c b/drivers/mmc/core/core.c index 9290bb5..adf331a 100644 --- a/drivers/mmc/core/core.c +++ b/drivers/mmc/core/core.c @@ -85,7 +85,7 @@ MODULE_PARM_DESC( static int mmc_schedule_delayed_work(struct delayed_work *work, unsigned long delay) { - return queue_delayed_work(workqueue, work, delay); + return queue_delayed_work_on_any_cpu(workqueue, work, delay); } /*