Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp320166imu; Mon, 10 Dec 2018 22:48:34 -0800 (PST) X-Google-Smtp-Source: AFSGD/XWadXaWBWnaB4LNnH7AdFPhXvliiOJd3gzXFSKMjyUEMEN3wtR8H5R22l9zWSQZ0dKVAKr X-Received: by 2002:a62:56c7:: with SMTP id h68mr15947983pfj.134.1544510914856; Mon, 10 Dec 2018 22:48:34 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1544510914; cv=none; d=google.com; s=arc-20160816; b=Wyx4BO+PqJsK5CFSNoUIxAuc4z36N9ceMWqjP6u59t90SRJPw+WzjMx6Ss/w22Q41b QtEJAiWge2Y/+mYt+23vaItQFWKukTvrPv/XDyXPOe7VrPD6Vnni0N1CdCRXWU1x/ETV G0JkSZm3UTSBM75lqUV82uSHJJ5UvlCytjz4AvsQslE7JHmeIncD1LNd9IyBswi0XCJr j3w/AjHwQuOyYuEq3OLth626bZepqpj6Try2dUOVWt+K3kY75fO1JCfaT7ai3UV3iy1g SJ+wDOQ0j/HBUF+XsT+ZPQwcuspHQlk3tGh2kK4XBxeOG6v5x2Hi4ST7lP87jjv+AJDK Pn8g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=CnOioxp3vDzfIMXN+0QKYzFMGiHbItJfW9ABVFt0Gi4=; b=VAO/jhVoWMegxflMQCnfQDVfzXSb4Qrf3rV5lA8W09Zqy4GO3hH+4N9PhDNkjMz8CH 1DimAv+Ycf/Xcj26BbMHkipfmwckcO+zvyHWnpZmZbOQhsn3qjyKjssABhsfuyaeAyMZ n5eD8TFvQqYAW9vz+WgIT6HAPzrpSpb7H31iALSaXzwX2LTz/eerpVw96lbEuox/Zt5b NtZ1RwL/RbjWIA4xjBMfTzvOIJ2Ni0Fp8iHBbckc4ebaffeaFNoJUo/qUzImUyEh95cf EeWzCzyXsDtMWIGqKS/NGQB4W5Jt1c16Ywb5bvBIhmpTXfQ2UEApsb49pTFJNlMHXeze Vh/A== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 32si11839613ple.72.2018.12.10.22.48.19; Mon, 10 Dec 2018 22:48:34 -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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729794AbeLKDEs (ORCPT + 99 others); Mon, 10 Dec 2018 22:04:48 -0500 Received: from mga18.intel.com ([134.134.136.126]:25976 "EHLO mga18.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728393AbeLKDEs (ORCPT ); Mon, 10 Dec 2018 22:04:48 -0500 X-Amp-Result: UNSCANNABLE X-Amp-File-Uploaded: False Received: from orsmga007.jf.intel.com ([10.7.209.58]) by orsmga106.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 10 Dec 2018 19:04:47 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.56,340,1539673200"; d="scan'208";a="97756301" Received: from chenyu-desktop.sh.intel.com (HELO chenyu-desktop) ([10.239.160.132]) by orsmga007.jf.intel.com with ESMTP; 10 Dec 2018 19:04:45 -0800 Date: Tue, 11 Dec 2018 11:12:21 +0800 From: Yu Chen To: joeyli Cc: "Rafael J. Wysocki" , Len Brown , linux-kernel@vger.kernel.org, Lenny Szubowicz , Jacob Pan , Rui Zhang , linux-acpi@vger.kernel.org Subject: Re: [PATCH][RFC v2] ACPI: acpi_pad: Do not launch acpi_pad threads on idle cpus Message-ID: <20181211031220.GA23975@chenyu-desktop> References: <1525521202-32519-1-git-send-email-yu.c.chen@intel.com> <20181210063153.GO5327@linux-l9pv.suse> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20181210063153.GO5327@linux-l9pv.suse> User-Agent: Mutt/1.9.4 (2018-02-28) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Joey, On Mon, Dec 10, 2018 at 02:31:53PM +0800, joeyli wrote: > Hi Chen Yu and ACPI experts, > > On Sat, May 05, 2018 at 07:53:22PM +0800, Chen Yu wrote: > > According to current implementation of acpi_pad driver, > > it does not make sense to spawn any power saving threads > > on the cpus which are already idle - it might bring > > unnecessary overhead on these idle cpus and causes power > > waste. So verify the condition that if the number of 'busy' > > cpus exceeds the amount of the 'forced idle' cpus is met. > > This is applicable due to round-robin attribute of the > > power saving threads, otherwise ignore the setting/ACPI > > notification. > > > > Suggested-by: Lenny Szubowicz > > Suggested-by: Len Brown > > Cc: "Rafael J. Wysocki" > > Cc: Lenny Szubowicz > > Cc: Len Brown > > Cc: Jacob Pan > > Cc: Rui Zhang > > Cc: linux-acpi@vger.kernel.org > > Signed-off-by: Chen Yu > > Do you have any news for this patch? Why it did not merged by kernel > maineline? > We are evaluating if this could be integrated into idle injection framework. May I know if there's any requirement/background from SUSE on this? Best, Ryan(Yu) > Thanks a lot! > Joey Lee > > > --- > > drivers/acpi/acpi_pad.c | 52 ++++++++++++++++++++++++++++++++++++++++++++++++- > > 1 file changed, 51 insertions(+), 1 deletion(-) > > > > diff --git a/drivers/acpi/acpi_pad.c b/drivers/acpi/acpi_pad.c > > index 552c1f7..515e60e 100644 > > --- a/drivers/acpi/acpi_pad.c > > +++ b/drivers/acpi/acpi_pad.c > > @@ -254,12 +254,62 @@ static void set_power_saving_task_num(unsigned int num) > > } > > } > > > > +/* > > + * Extra acpi_pad threads should not be created until > > + * the requested idle count is less than/equals to the > > + * number of the busy cpus - it does not make sense to > > + * throttle the idle cpus. > > + */ > > +#define SAMPLE_INTERVAL_JIF 20 > > + > > +static u64 get_idle_time(int cpu) > > +{ > > + u64 idle, idle_usecs = -1ULL; > > + > > + idle_usecs = get_cpu_idle_time_us(cpu, NULL); > > + > > + if (idle_usecs == -1ULL) > > + idle = kcpustat_cpu(cpu).cpustat[CPUTIME_IDLE]; > > + else > > + idle = idle_usecs * NSEC_PER_USEC; > > + > > + return idle; > > +} > > + > > +static bool idle_nr_valid(unsigned int num_cpus) > > +{ > > + int busy_nr = 0, i = 0, load_thresh = 100 - idle_pct; > > + > > + if (!num_cpus) > > + return true; > > + > > + for_each_online_cpu(i) { > > + u64 wall_time, idle_time; > > + unsigned int elapsed_delta, idle_delta, load; > > + > > + wall_time = jiffies64_to_nsecs(get_jiffies_64()); > > + idle_time = get_idle_time(i); > > + /* Wait and see... */ > > + schedule_timeout_uninterruptible(SAMPLE_INTERVAL_JIF); > > + > > + idle_delta = get_idle_time(i) - idle_time; > > + elapsed_delta = jiffies64_to_nsecs(get_jiffies_64()) - wall_time; > > + idle_delta = (idle_delta > elapsed_delta) ? elapsed_delta : idle_delta; > > + load = 100 * (elapsed_delta - idle_delta) / elapsed_delta; > > + if (load >= load_thresh) > > + busy_nr++; > > + } > > + > > + return (busy_nr >= num_cpus) ? true : false; > > +} > > + > > static void acpi_pad_idle_cpus(unsigned int num_cpus) > > { > > get_online_cpus(); > > > > num_cpus = min_t(unsigned int, num_cpus, num_online_cpus()); > > - set_power_saving_task_num(num_cpus); > > + if (idle_nr_valid(num_cpus)) > > + set_power_saving_task_num(num_cpus); > > > > put_online_cpus(); > > } > > -- > > 2.7.4 > > > > -- > > To unsubscribe from this list: send the line "unsubscribe linux-acpi" in > > the body of a message to majordomo@vger.kernel.org > > More majordomo info at http://vger.kernel.org/majordomo-info.html