Received: by 10.223.185.116 with SMTP id b49csp2249418wrg; Sat, 24 Feb 2018 15:02:08 -0800 (PST) X-Google-Smtp-Source: AH8x224TxYaqYay8wwSdUnDx35E03R+8k3ZS/YXqThi5trH3qUvpJisB7Sd0C3q8JQHLZ5tD0LFV X-Received: by 2002:a17:902:5322:: with SMTP id b31-v6mr5900904pli.61.1519513328137; Sat, 24 Feb 2018 15:02:08 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519513328; cv=none; d=google.com; s=arc-20160816; b=nUh+XPy5J/Pn9AZzXjMMEAlcEqFFhUF4PNM2V+c4/EkNcn+xXmN2t815PrJLDfZXXp UufGmF348OybDdM4w90irVwdEVLtG7mj4Ck1EQvkypqGThPwCex4MGHGjbbONQkG4Y8M Q1OMgRvMhj2HK19I3v7DNYU/b9X8gK5xbicUqjJVLPoJvTwm/uj/xuTy5ua4YL93IvgT C/Jz1YdPmKUH1QP5pCO8aRXGyuqdTbXdnWTjWJso5e+S1E6N6wqPT57Zgbx3hL+tZUmp Uks4l06OJzQRPV8IoBEZ31nhdAKBeMNrck+bErEpKjKVZMsHpgvMoLkJqi5byb9QsmCL U3wA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dkim-signature :arc-authentication-results; bh=jwvnfljzQWJ74FRlfWrqvOc30cQ7U/d3qqKGK8SBH0Q=; b=yJEa8ZJJiSGaMKQCKZkf559KQPLzLokSZPt9xYy5vaXXYJ8N2wHJO9XsFrm7flbkK+ uWgI54gsurkz/rGIwNwW+gQOVBurwV9k9nrMKqa4CRjY5pJIHORnB/fiZTW3ILhYgIPn q0QJDBvwJIN6JKMwAFUl8vdAzlXJdKvlprqKyy5wseqSfH36USvgmAWsfiR/fzZItmGc Ly5tSPW5SY+dA7vugj2kITlVH+6oQMSvuTHC8Ye1vKDQ4rzuAgaa0ozVE83OgWtmq9g8 qESEtp2x/7iZxMj0Ncc8hyXuyqKiZdtiVtFGMIlMkw/75zPLFQ9NEyaU7X5Tn1lSrsqq nBxQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=WbJ/YpKA; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id s3-v6si4108117plp.461.2018.02.24.15.01.52; Sat, 24 Feb 2018 15:02:08 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=WbJ/YpKA; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751531AbeBXXBO (ORCPT + 99 others); Sat, 24 Feb 2018 18:01:14 -0500 Received: from mail-wr0-f193.google.com ([209.85.128.193]:33822 "EHLO mail-wr0-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751474AbeBXXBM (ORCPT ); Sat, 24 Feb 2018 18:01:12 -0500 Received: by mail-wr0-f193.google.com with SMTP id m5so17552081wrg.1 for ; Sat, 24 Feb 2018 15:01:11 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=jwvnfljzQWJ74FRlfWrqvOc30cQ7U/d3qqKGK8SBH0Q=; b=WbJ/YpKA9Zdq6Q08uc/A6ejh5oWIVoIkYHLkk2UTzBWWIKO4sq8m8Qlwu40kpxcSTA t9g/CeYq+1AOQb1xnE1/0wLVBi4WVmQtJi16ug6m1xvbqdHH5gMSJ2Bm9FmVFq2mu5TY wbtz5fnYZcxvr9Sq5yiIUCpp7sZ7v+HtPlahc= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=jwvnfljzQWJ74FRlfWrqvOc30cQ7U/d3qqKGK8SBH0Q=; b=eg0qnVrmfxdWzrQeEKrGhgZBsn/fqsJ2TQIA4+goNylPyjkHbi8Mb6l/u6p4t2grT2 3ED2eqz0ZbC8v5Sk+MT/lenHjTyoU7rTtZrjIWjyy5iF0MtPKMyKM0p2p+bd0yh4v9jw XfRE5bQF/gHHVmTBiVc9ODx2sHFHW8IuBjDboOk40JmOtXhbgMNNkJJJlh4/46sGpiJk 3gDgLVH1YdS1D2atyVI9JHxZlxJR3+DCoIFkVSmosscxlCg8SjH+KNE0hg7SK2rTQXKa 1t0AYlRRj0xZy1i9IkjmmeHRQp1bTb6ACMzEUuh3DSSW00xIUe2upGT55zq7LULZ699+ OTmQ== X-Gm-Message-State: APf1xPC4fZ7AMsY0nfmPGbEpURzlA0XN/xKt9oCMIq9OC2tes1WI2se+ SmN2dyTJdUD0/7Jyqz1lpmatZQ== X-Received: by 10.223.144.2 with SMTP id h2mr167145wrh.114.1519513270732; Sat, 24 Feb 2018 15:01:10 -0800 (PST) Received: from ?IPv6:2001:41d0:fe90:b800:74db:86cd:8643:bb85? ([2001:41d0:fe90:b800:74db:86cd:8643:bb85]) by smtp.googlemail.com with ESMTPSA id c56sm10727678wrc.82.2018.02.24.15.01.08 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 24 Feb 2018 15:01:09 -0800 (PST) Subject: Re: [PATCH V2 6/7] thermal/drivers/cpu_cooling: Introduce the cpu idle cooling driver To: Vincent Guittot Cc: Eduardo Valentin , Kevin Wangtao , Leo Yan , Amit Kachhap , linux-kernel , Javi Merino , Zhang Rui , Daniel Thompson , "open list:THERMAL" , Viresh Kumar References: <1519226968-19821-1-git-send-email-daniel.lezcano@linaro.org> <1519226968-19821-7-git-send-email-daniel.lezcano@linaro.org> From: Daniel Lezcano Message-ID: <097594b4-fb9a-0c3a-b673-03f092066e68@linaro.org> Date: Sun, 25 Feb 2018 00:01:08 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.6.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 23/02/2018 16:26, Vincent Guittot wrote: > Hi Daniel, > > On 21 February 2018 at 16:29, Daniel Lezcano wrote: >> + >> +/** >> + * struct cpuidle_cooling_device - data for the idle cooling device >> + * @cdev: a pointer to a struct thermal_cooling_device >> + * @cpumask: a cpumask containing the CPU managed by the cooling device >> + * @timer: a hrtimer giving the tempo for the idle injection cycles >> + * @kref: a kernel refcount on this structure >> + * @count: an atomic to keep track of the last task exiting the idle cycle >> + * @idle_cycle: an integer defining the duration of the idle injection >> + * @state: an normalized integer giving the state of the cooling device >> + */ >> +struct cpuidle_cooling_device { >> + struct thermal_cooling_device *cdev; >> + struct cpumask *cpumask; >> + struct list_head node; >> + struct hrtimer timer; >> + struct kref kref; >> + atomic_t count; >> + unsigned int idle_cycle; >> + unsigned int state; >> +}; >> + >> +/** >> + * @tsk: an array of pointer to the idle injection tasks >> + * @waitq: the waiq for the idle injection tasks >> + */ >> +struct cpuidle_cooling_tsk { >> + struct task_struct *tsk; >> + wait_queue_head_t waitq; > > Why are you creating one wait_queue_head_t per cpu instead of one per > cooling device and then save a pointer in the per cpu struct > cpuidle_cooling_tsk ? > Then, you can use wake_up_interruptible_all() to wake up all threads > instead of using for_each_cpu ... wake_up_process() loop in > cpuidle_cooling_wakeup() ? Yes, that should do the trick. I will give it a try. Linaro.org │ Open source software for ARM SoCs Follow Linaro: Facebook | Twitter | Blog