Received: by 10.223.176.5 with SMTP id f5csp440646wra; Tue, 6 Feb 2018 01:24:15 -0800 (PST) X-Google-Smtp-Source: AH8x225opg3inMocCxXfHfvYoBu8y1VrDtMxt+SIog7aRfgWg33oUr3UTt1zvnuotLdJHs0nCSLR X-Received: by 10.99.114.90 with SMTP id c26mr1447701pgn.427.1517909055547; Tue, 06 Feb 2018 01:24:15 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1517909055; cv=none; d=google.com; s=arc-20160816; b=B8zhjH+ZZiBvQ/0nm+j5QXQIBaCNaQzRsz0vVF7rZr2kdrc0wIPJ5YpTXU9avvc8qd bYjDtE5ClMjcT7IECVwL5+cL2tgLGzQDV281xSzPKAHp61cC90yGcmoFgMxOIFofz6VT BVPPMsaEY8PpAuG+yKwaBQ13kvk1WtrqFmWBbQ251R3IYciOZEyV8IZe6C2vYRLnobXK C3S4AjqK/rc/QqbG7a97ZIMwwHzG4jDxVdmhzl0Yr9OMtATwdeflct1Wd+186QSFBl0M bP0oQ6ITb/I7Np9jxwwISERXmeFUWH0Tyf0l/fCdHC1gwdRUhumivTe1jYuwogNZg6Tn BMjQ== 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:cc:to:subject :message-id:date:from:references:in-reply-to:mime-version :dkim-signature:arc-authentication-results; bh=C3yYx7CQR2GedVdw+qFss2DJotgAgEUhUxCBWkyZBQI=; b=GaFWzTii6Dpphgsp7nBJeUIIpfwp0z4Gq4bVOHsrbk6ux4yuoW+jrKbBHiYRuM/sXg vlQJexEqHcdgfFzg3kT/th+q6Tuemt1fEdtwwi5BlmiaI2N/sSnNSbz85CTOSn4TqiqY BMHHX+GX2KegD/auEgTkfX9/vlDpiM09cAS7KVOooxPdefi9jRP3OvgKMJIOGSMcDBOP XZ+188N/0bHZfFxh6ozChq8z5SeS43hcOQYgegv1MdfXs2Gs3wG+5RNaTNktOsEETsh2 kN3Mg6jwUPmRmegmKxxzMfsU/s5xkFQNhqOUf8iPg2/SDCMvoHOyslxO8Cg5eUiX6kwl x60A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=X1fYXDW8; 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 z1-v6si1144052pln.408.2018.02.06.01.24.01; Tue, 06 Feb 2018 01:24:15 -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=X1fYXDW8; 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 S1752656AbeBFJW5 (ORCPT + 99 others); Tue, 6 Feb 2018 04:22:57 -0500 Received: from mail-io0-f193.google.com ([209.85.223.193]:39548 "EHLO mail-io0-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752207AbeBFJWv (ORCPT ); Tue, 6 Feb 2018 04:22:51 -0500 Received: by mail-io0-f193.google.com with SMTP id b198so1770912iof.6 for ; Tue, 06 Feb 2018 01:22:51 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=C3yYx7CQR2GedVdw+qFss2DJotgAgEUhUxCBWkyZBQI=; b=X1fYXDW8gw4ojvPF5FB01K2j3L1BEyr/D4JWsq4ZYx73AeHGMtGQvxijHMpkZ9cSI7 9q63pIyahw3FYFo5mr/JNwnc/R/j2VbB5fkDgD/NU5srwx8pkNnqiYn0xbGhUlaDHH5+ HGb2TXN2UZYBvJ8EuFO7gbh5kdzUFUUjcFgZ8= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=C3yYx7CQR2GedVdw+qFss2DJotgAgEUhUxCBWkyZBQI=; b=FmVDqvwGPGflJ/7aBOU9w0VWRVZP6wbV39OBkbTPJ0LRtv5onqjGd61j+JwufaD1QC +GBnMzJ9bJYIwARtsPwgkVFb6ys0LB7ys/5cNFhmd0aTItKoqQ2bqD8g/ZnFw15U8+z0 tz0/wjdy5LawwZQfXVBLYlgAZho0EbqbybEHLKOA7MFRmHcTkblPXg7SslTImR4BNOmw h26TcD0Nzmo3laX4HCQ1PcTOyGhZTb7PmaZQMZ039OjPHEr7CmFnci9hN6RyOyh06YeB M8G2hIfY3pO1va7iTYD5t4Lf4+YrvqSE1doF6xMVOf6NfymFV4D7zAO6LziKHfKSfxqO e5hA== X-Gm-Message-State: APf1xPDp0vO5SfXrKdzW+KfJ16NA0a3hdvXlFd6crC5yvMbdUxAc1kaU J8TZHZmyhUjYlK9ed6j/1yHAvj8prr4X0SGv5cbJZg== X-Received: by 10.107.169.94 with SMTP id s91mr2160782ioe.83.1517908970878; Tue, 06 Feb 2018 01:22:50 -0800 (PST) MIME-Version: 1.0 Received: by 10.107.50.198 with HTTP; Tue, 6 Feb 2018 01:22:30 -0800 (PST) In-Reply-To: <5694b3f8-9726-d5a8-dba3-e4c1619a05be@arm.com> References: <20171222075934.f6yenvcb2zkf2ysd@hirez.programming.kicks-ass.net> <20171222082915.4lcb7xyyooqyjpia@hirez.programming.kicks-ass.net> <20171222091221.ow5vn3ydx3hj4nht@hirez.programming.kicks-ass.net> <20171222185629.lysjebfifgdwvvhu@hirez.programming.kicks-ass.net> <20171222204247.kyc6ugyyu3ei7zhs@hirez.programming.kicks-ass.net> <20180115082609.GA6320@linaro.org> <20180118103807.GD28799@e105550-lin.cambridge.arm.com> <20180124082536.GA32318@linaro.org> <4fb17712-3f98-c407-42b3-4601a4f294d9@arm.com> <5694b3f8-9726-d5a8-dba3-e4c1619a05be@arm.com> From: Vincent Guittot Date: Tue, 6 Feb 2018 10:22:30 +0100 Message-ID: Subject: Re: [RFC PATCH 2/5] sched: Add NOHZ_STATS_KICK To: Valentin Schneider Cc: Peter Zijlstra , Morten Rasmussen , Ingo Molnar , linux-kernel , Brendan Jackman , Dietmar Eggemann , Morten Rasmussen Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 5 February 2018 at 23:18, Valentin Schneider wrote: > On 01/30/2018 11:41 AM, Valentin Schneider wrote: >> [...] >>> I have studied a way to keep track of how many cpus still have blocked >>> load to try to minimize the number of useless ilb kick but this add >>> more atomic operations which can impact the system throughput with >>> heavy load and lot of very small wake up. that's why i have propose >>> this solution which is more simple. But it's probably just a matter of >>> where we want to "waste" time. Either we accept to spent a bit more >>> time to check the state of idle CPUs or we accept to kick ilb from >>> time to time for no good reason. >>> >> >> Agreed. I have the feeling that spending more time doing atomic ops coul= d be worth it - I'll try to test this out and see if it's actually relevant= . >> > > I gave this a spin, still using Vincent's patches with the included patch= on top. Nothing too clever, just seeing how replacing nohz.stats_state wit= h a cpumask would go. > > I've replaced nohz.stats_state by nohz.stale_cpus_mask. I kept changes mi= nimal - there are some places where I think nohz.idle_cpus_mask could be su= bstituted by nohz.stale_cpus_mask. Speaking about that, I was about to writ= e a comment regarding the fact that nohz.stale_cpus_mask should be a subset= of nohz.idle_cpus_mask, but I realized it's actually not true: > > In the current implementation (cpumask or stats_state flag), an idle CPU = is defined as having blocked load as soon as it goes through nohz_balance_e= nter_idle(), and that flag is cleared when we go through _nohz_idle_balance= () (and newly idle load balance in my cpumask implementation). > However we can imagine a scenario where a CPU goes idle, is flagged as ha= ving blocked load, then it wakes up and goes through its periodic balance c= ode and updates that load. Yet, the flag (or cpumask) won't have been updat= ed. > So I think there could be a discussion on whether the flag should be clea= red on nohz_balance_exit_idle() if we assume periodic balance now takes car= e of this. It could cause issues if we have a weird scenario where a CPU ke= eps going online/idle but never stays online long enough for a tick though. > Alternatively we could clear that flag when going through the first perio= dic balance after idling, but then that's a bit weird because we're using a= nohz structure in a non-nohz context. > > > Anyway, I tried to get some profiling done with the cpumask but there's s= omething wrong with my setup, I would only get nonsense numbers (for both b= aseline & my patch), so I added start/end trace_printks to _nohz_idle_balan= ce(). It's ugly, inaccurate and unorthodox but it still gives a rough idea = of how the cpumask impacts stuff. > I ran 20 iterations of my "nohz update" test case (a task accumulates loa= d, goes to sleep, and another always-running task keeps kicking an ILB to d= ecay that blocked load) and the time saved by skipping CPUs is in the ballp= ark of 20%. Notebook is at [1]. Even if saving time in the ILB is interesting, we have to check the impact of bitmask operation on the wake up latency of the CPUs when the system is heavily used and generate a lot of sleep/wakeup on CPUs > > I'll try to get a proper function profiling working for when Vincent post= s his "v2". > > [1]: https://gist.github.com/valschneider/6f203143bee1e149f24c44e9582a9ef= f > > ---