Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp757938ybt; Wed, 24 Jun 2020 10:26:49 -0700 (PDT) X-Google-Smtp-Source: ABdhPJywGxBfeKQ7DIsKFdo6Z7wIbDiLrFt0j2M1zkZa5SEqdj4ZP8lSMvaA3i88ZWlGkhuJ4VSc X-Received: by 2002:aa7:c314:: with SMTP id l20mr12901336edq.150.1593019608832; Wed, 24 Jun 2020 10:26:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1593019608; cv=none; d=google.com; s=arc-20160816; b=qPoYc8TonX6cD4zyWQL35VGW9J+85A6SELsO0K3S+IJxu6F2Cw3Mv42GpOBVmyN6vt sWEgfId8jdfaSZ3KLQ4RSk35t6EENKqFnVLFGTYSeeEr5b/u3TlyDTwT0cbpfVKzs7lu kWHPY5FWxj2Vz5bzhbXSRqn5+wgx6xugnxwkPrAYwZ0dKYIiqPqD94ts1oSomNi8fJbp z/k9ZHPQfqP12cocxYogCUXNvXa/20DHB1V8Bp5TIWf7Uny0lGUOjFdFisYouSbemg3g uv3clkzhXQNn4G1SxMWOgoSE6gllMIJcgaFYlC3g+szmBws1xbJrp+bLbXlYL6gtDmoX +qwg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from; bh=X4YFg+TIR6Xv7SIqO/HShuStAOX45gW4HE90cqrWNCU=; b=HuhJwyKK0TjUPaeEN7/V1y65Iznh2DemiPZSrGY4DWubiqsdu2vMfzAGuERCgPT/5D cDr7oMWJ7x9JIehs7tDJxjPana7dDEtRJM0rfbZYW0pPsXGTYQYM9X53YN73tADh02E7 Ig52/C7NcQxUdadPK212cLP/2J4ntEow5U6RkLleZXwja/ujHZpVXgKENtT0XWM+ByEo 19hWvy7G+FymwLh1jL1dYRW+YtndmAfHrSkh8RHzmHo0v7ZvzUY885PXX4naES4d5KTu bCNje7RVggZmaWY5mLkWSO7J2/DeI6Ec+TnPFrOvryLn2nnL+4ggNvptMrXYF4SoMud3 2jXw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id lu24si6601921ejb.477.2020.06.24.10.26.24; Wed, 24 Jun 2020 10:26:48 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2405482AbgFXR0M (ORCPT + 99 others); Wed, 24 Jun 2020 13:26:12 -0400 Received: from foss.arm.com ([217.140.110.172]:46372 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2405478AbgFXR0M (ORCPT ); Wed, 24 Jun 2020 13:26:12 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 2AB851FB; Wed, 24 Jun 2020 10:26:11 -0700 (PDT) Received: from e107158-lin.cambridge.arm.com (e107158-lin.cambridge.arm.com [10.1.195.21]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 7E6A53F71E; Wed, 24 Jun 2020 10:26:09 -0700 (PDT) From: Qais Yousef To: Ingo Molnar , Peter Zijlstra Cc: Qais Yousef , Juri Lelli , Vincent Guittot , Dietmar Eggemann , Steven Rostedt , Ben Segall , Mel Gorman , Patrick Bellasi , Chris Redpath , Lukasz Luba , linux-kernel@vger.kernel.org Subject: [PATCH v3 0/2] sched: Optionally skip uclamp logic in fast path Date: Wed, 24 Jun 2020 18:26:03 +0100 Message-Id: <20200624172605.26715-1-qais.yousef@arm.com> X-Mailer: git-send-email 2.17.1 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This series attempts to address the report that uclamp logic could be expensive sometimes and shows a regression in netperf UDP_STREAM under certain conditions. The first patch is a fix for how struct uclamp_rq is initialized which is required by the 2nd patch which contains the real 'fix'. Worth noting that the root cause of the overhead is believed to be system specific or related to potential certain code/data layout issues, leading to worse I/D $ performance. Different systems exhibited different behaviors and the regression did disappear in certain kernel version while attempting to reporoduce. More info can be found here: https://lore.kernel.org/lkml/20200616110824.dgkkbyapn3io6wik@e107158-lin/ Having the static key seemed the best thing to do to ensure the effect of uclamp is minimized for kernels that compile it in but don't have a userspace that uses it, which will allow distros to distribute uclamp capable kernels by default without having to compromise on performance for some systems that could be affected. Changes in v3: * Avoid double negatives and rename the static key to uclamp_used * Unconditionally enable the static key through any of the paths where the user can modify the default uclamp value. * Use C99 named struct initializer for struct uclamp_rq which is easier to read than the memset(). Changes in v2: * Add more info in the commit message about the result of perf diff to demonstrate that the activate/deactivate_task pressure is reduced in the fast path. * Fix sparse warning reported by the test robot. * Add an extra commit about using static_branch_likely() instead of static_branc_unlikely(). Thanks -- Qais Yousef Cc: Juri Lelli Cc: Vincent Guittot Cc: Dietmar Eggemann Cc: Steven Rostedt Cc: Ben Segall Cc: Mel Gorman CC: Patrick Bellasi Cc: Chris Redpath Cc: Lukasz Luba Cc: linux-kernel@vger.kernel.org Qais Yousef (2): sched/uclamp: Fix initialization of strut uclamp_rq sched/uclamp: Protect uclamp fast path code with static key kernel/sched/core.c | 75 +++++++++++++++++++++++++++++++++++++++------ 1 file changed, 66 insertions(+), 9 deletions(-) -- 2.17.1