Received: by 10.223.164.197 with SMTP id h5csp537748wrb; Sat, 4 Nov 2017 17:59:21 -0700 (PDT) X-Google-Smtp-Source: ABhQp+T617ZezZVuOOSRIC27sL6R+arEacq6kQafulcS3iJwMx/n18F+f+ReJicDkVnpDvg0vLeM X-Received: by 10.99.6.75 with SMTP id 72mr11274119pgg.350.1509843561553; Sat, 04 Nov 2017 17:59:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1509843561; cv=none; d=google.com; s=arc-20160816; b=CQPgAyqyDJa2CZugna+RkHB9+xyu/2cv2J+UXhOYRTR8npKJF0pFTXrAlfKXeImz2E /gZy93lgKk1OKfqrOHcgZXYiPeui4hEDZh+4oNgm+VJ/MZ4P5Cxc+HO68vqZtBwBdsch YysXLNYODeAV8uu7Sfv39RB6TZvW2jGzpNIN3vkGjKzMjvC5H0DwcoTN3gGR5pZpOrb4 iTZgI7RxxwOjJ42xRi+aRAmddXlm3024vJfsgAmoZrjv7+vMQr2qPfoJ1uf2YVy5NVlV s5gW3Hptm2ruNpteLtrnukTVfKtGmgKWlBbD/5VWi+PHRjl6b68992dQ6xINyEN2pOOJ ketg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :references:in-reply-to:mime-version:dkim-signature :arc-authentication-results; bh=LRfE3Big7IVxvSBdtea/am6k9ds2pPxJkVywJSs7Pz8=; b=mt5p+msgDB0w0I/AYswrFj0l1Vz+aBzEPKjPigZdHItCpD3BOX1BtKL2PkPGeIafRW Uz1aJPPsrCqXYKVgy2RaPiHyvdbscAtEfGYweF1HBhzixbPlPb6bwQ7GzFbFrlM26Sdf CMGpumxceYNhlLpOERSpJhBW+Fw/TJ5doH38kjWZybSZooS7+928XrhDWl8CkkCSyLKw j6CO6m05Dg9Y5QBc/pJVU9+O2ucK6NngFeA2p5katwpSIvhLgfOD/uzVWnAfEBhwNNUI ewrEmZIw4Y9gwU7sS3e/JxKT6toi0dZBHmOI4pJL4Qes/fYlWq2vMeOh1/Fpqxo80dot 95zw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=Z/uCNIGM; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d27si9636898pfk.146.2017.11.04.17.58.58; Sat, 04 Nov 2017 17:59:21 -0700 (PDT) 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=@google.com header.s=20161025 header.b=Z/uCNIGM; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752172AbdKEA6H (ORCPT + 94 others); Sat, 4 Nov 2017 20:58:07 -0400 Received: from mail-it0-f41.google.com ([209.85.214.41]:50400 "EHLO mail-it0-f41.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751808AbdKEA6F (ORCPT ); Sat, 4 Nov 2017 20:58:05 -0400 Received: by mail-it0-f41.google.com with SMTP id 72so1522030itl.5 for ; Sat, 04 Nov 2017 17:58:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=LRfE3Big7IVxvSBdtea/am6k9ds2pPxJkVywJSs7Pz8=; b=Z/uCNIGMDzKdWsIKAvNUHptaahnutEFiYdTiI6O4+h/6nZPOygePwMqxmoHAxlI6xy 1U6sji7lrhAJ1/9puvb1+T3pccdVIZaqwRxUMf6UcMFUHCFXxnpliALj8LtWQ/sHIF/4 lS0fVHuNKaZE6fEWoRpbPNCYJUbViP7ZrWnS9p+KmeWAHbLo24OWUstdqGZ0/emZDTfo +5qxqGGYTrBjjHiqY0HGvArQZgeQL5Ikc5SzsJyGdwGUemdAA1j8w0HHqKWXiI5JEzZ0 Wd07yeV19EyFvlNR7H1A0tTOThZK4t7AWJacH9UwR+xjzWmGsyUPUG1Hb4WdbQknjMci xb3w== 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; bh=LRfE3Big7IVxvSBdtea/am6k9ds2pPxJkVywJSs7Pz8=; b=XSHsYHxbDsuSyNuMHoSsBfBr4fAMyFWV94D7sgJNgzi53eaB8cgwrnX42txIVxSbmJ UC2oXQMjTVZ1BKm3B/VQAV9PcCXsrUSrBkgJV0pwavHqVojBLyax1aI3RkW3bmWelYmb bgtDvsZw1K6tdV9E8hSFJGzO5t8cLn8twJjdDrAtKf7hhDo3eYNgCYlfqFmJI9aGp56d wifFacs1ajyVZBDT5Hr47yGb+EHE5HFo+WfSR9z9sCfzwVd9VDREghlQDWDbzUCaEpmS bjX9jKUiP0AzpRQXQowQaFYYrFT2bu2NKjipcW/wR+9e5HGCUxWDm7T3OO1ZjwZu+rz3 Lx6w== X-Gm-Message-State: AJaThX5w0L9qPy43/AIcoo+xNiQ5rXKh4/azVPxp7iZwlZooU2StyU3U 1Ihf/ef1BRJS0y4sIdQtPGgdRWltGUcMfP5vc0BedA== X-Received: by 10.36.60.86 with SMTP id m83mr4247428ita.25.1509843484613; Sat, 04 Nov 2017 17:58:04 -0700 (PDT) MIME-Version: 1.0 Received: by 10.107.174.42 with HTTP; Sat, 4 Nov 2017 17:58:03 -0700 (PDT) In-Reply-To: <20171031082009.rxxa57goto6q5xld@hirez.programming.kicks-ass.net> References: <1509427662-25114-1-git-send-email-atish.patra@oracle.com> <1509427662-25114-2-git-send-email-atish.patra@oracle.com> <20171031082009.rxxa57goto6q5xld@hirez.programming.kicks-ass.net> From: Joel Fernandes Date: Sat, 4 Nov 2017 17:58:03 -0700 Message-ID: Subject: Re: [PATCH RFC 1/2] sched: Minimize the idle cpu selection race window. To: Peter Zijlstra Cc: Atish Patra , LKML , Brendan Jackman , Josef Bacik , Ingo Molnar Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Peter, On Tue, Oct 31, 2017 at 1:20 AM, Peter Zijlstra wrote: > On Tue, Oct 31, 2017 at 12:27:41AM -0500, Atish Patra wrote: >> Currently, multiple tasks can wakeup on same cpu from >> select_idle_sibiling() path in case they wakeup simulatenously >> and last ran on the same llc. This happens because an idle cpu >> is not updated until idle task is scheduled out. Any task waking >> during that period may potentially select that cpu for a wakeup >> candidate. >> >> Introduce a per cpu variable that is set as soon as a cpu is >> selected for wakeup for any task. This prevents from other tasks >> to select the same cpu again. Note: This does not close the race >> window but minimizes it to accessing the per-cpu variable. If two >> wakee tasks access the per cpu variable at the same time, they may >> select the same cpu again. But it minimizes the race window >> considerably. > > The very most important question; does it actually help? What > benchmarks, give what numbers? I collected some numbers with an Android benchmark called Jankbench. Most tests didn't show an improvement or degradation with the patch. However, one of the tests called "list view", consistently shows an improvement. Particularly striking is the improvement at mean and 25 percentile. For list_view test, Jankbench pulls up a list of text and scrolls the list, this exercises the display pipeline in Android to render and display the animation as the scroll happens. For Android, lower frame times is considered quite important as that means we are less likely to drop frames and give the user a good experience vs a perceivable poor experience. For each frame, Jankbench measures the total time a frame takes and stores it in a DB (the time from which the app starts drawing, to when the rendering completes and the frame is submitted for display). Following is the distribution of frame times in ms. count 16304 (@60 fps, 4.5 minutes) Without patch With patch mean 5.196633 4.429641 (+14.75%) std 2.030054 2.310025 25% 5.606810 1.991017 (+64.48%) 50% 5.824013 5.716631 (+1.84%) 75% 5.987102 5.932751 (+0.90%) 95% 6.461230 6.301318 (+2.47%) 99% 9.828959 9.697076 (+1.34%) Note that although Android uses energy aware scheduling patches, I turned those off to bring the test as close to mainline as possible. I also backported Vincent's and Brendan's slow path fixes to the 4.4 kernel that the Pixel 2 uses. Personally I am in favor of this patch considering this test data but also that in the past, I remember that our teams had to deal with the same race issue and used cpusets to avoid it (although they probably tested with "energy aware" CPU selection kept on). thanks, - Joel From 1582896495044646841@xxx Wed Nov 01 20:22:12 +0000 2017 X-GM-THRID: 1582749826108377580 X-Gmail-Labels: Inbox,Category Forums