Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp3229282pxf; Mon, 22 Mar 2021 00:49:05 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx5C32gA1sbIru8GDYNWxhx3quUcF3/GmqFiECtTeoPQL11KrA+YdrVIhos5unXKCEB6gV1 X-Received: by 2002:aa7:c957:: with SMTP id h23mr23752187edt.301.1616399344867; Mon, 22 Mar 2021 00:49:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1616399344; cv=none; d=google.com; s=arc-20160816; b=pv+xLwz6w+eDGxlgLFV3huhkyb7XpshKGsDKgYzB8GFw8XE1jgMtzwh2G+NrkaZkIR u6vGf/eKmgZarL8b8eW3ryjaed6J7T2UsUXDLYIjxSpLlWfELLAf7uZHAa9QTkGUhZLM 7ACFLtPBJZ00BNOPWBx6aTxEP8nL2aWG/B1ga4IuUnA4nxNiT98Da6W8jhrJNOgMCXRz OM8Wjkoh1NLh22HMqStYe14zZPs3DyqVb4jwIhVA1TpBfmO3oL6YLRol+3fJ+lp0wP7n VFmYlIiHAl9RvqBJcVjwVImwFOwVo5woPKtx0/Pxwc+9BEqvr43G7yqhRvaXIvCHPwrT rKrw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=a4V0ZQVQps4nQLfsOVFZP2e8Pz9X+P/+CA8XJe4x7Yo=; b=x2w6BEmTK6Z2R2sa0L4BY1HYorynf1fbAWRuqsKFige7F0xF6NttEHwMq7jYH6MKqr Piadqpn2Av2xbZTE9gvqLfTqTt/E/lUbnR5/pvlyny59F7N++fTuITfONGPaF6Bi/BOh x2byzK0yUul+QMFrahk+roJYzpIpYFGqfxywnHDLHPUY43t3d1miW9U+oD4OwdwUz/1g GTNvfGUDPK0u20gVl8gvaOoLJTWjBAxQbK4F7zgiAwtrcK3cQtnWL+WveEeeuUhagr/T YcIk2OCHyHQzYsLOnz2AO+BlhPJT1441kPe+J5z8WkupmGIT54A3lGIsXdl+q0VEEKY3 eo7w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=desiato.20200630 header.b="c/uasegk"; 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 ss17si10528531ejb.678.2021.03.22.00.48.42; Mon, 22 Mar 2021 00:49:04 -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; dkim=pass header.i=@infradead.org header.s=desiato.20200630 header.b="c/uasegk"; 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 S229760AbhCVHpm (ORCPT + 99 others); Mon, 22 Mar 2021 03:45:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46438 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229786AbhCVHpQ (ORCPT ); Mon, 22 Mar 2021 03:45:16 -0400 Received: from desiato.infradead.org (desiato.infradead.org [IPv6:2001:8b0:10b:1:d65d:64ff:fe57:4e05]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7A0F4C061574 for ; Mon, 22 Mar 2021 00:45:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=desiato.20200630; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=a4V0ZQVQps4nQLfsOVFZP2e8Pz9X+P/+CA8XJe4x7Yo=; b=c/uasegkc7omW3rWyYnu0TKByD JRmNtabOpMxwDKVYsIve3iMq8RF8WSfDzM0JZ+di7njstLLmb4VQ0ihxGIQ28BOdAk8c9/xyo8gW3 OeOd/b7pVIMNucscoPis58wW+RrqdHzmmc+z1qDS2909IOnsS39XvmvRM8XhR8Ip/iiutLssVMCcS HM915rD9cOxWkH63U/1Dbv2pLQTY4YAfEZ98DNEiedS4AyNDS3LyWy5cgPy11MV7j8XJGmqL1Gub2 DKcbhydT2P3JIcLfHvpaYEDDqbY3hrgnz93+ncnYCKvWByB9Cz+hBafP3s8htDNZlNSsXoAJAL6Tc UCTtQ90g==; Received: from j217100.upc-j.chello.nl ([24.132.217.100] helo=noisy.programming.kicks-ass.net) by desiato.infradead.org with esmtpsa (Exim 4.94 #2 (Red Hat Linux)) id 1lOFFR-00B6Fz-83; Mon, 22 Mar 2021 07:45:13 +0000 Received: from hirez.programming.kicks-ass.net (hirez.programming.kicks-ass.net [192.168.1.225]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by noisy.programming.kicks-ass.net (Postfix) with ESMTPS id 5744A301A32; Mon, 22 Mar 2021 08:45:12 +0100 (CET) Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id 3B0512CF553EB; Mon, 22 Mar 2021 08:45:12 +0100 (CET) Date: Mon, 22 Mar 2021 08:45:12 +0100 From: Peter Zijlstra To: Shakeel Butt Cc: Johannes Weiner , Ingo Molnar , linux-kernel@vger.kernel.org Subject: Re: [PATCH] psi: reduce calls to sched_clock() in psi Message-ID: References: <20210321205156.4186483-1-shakeelb@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210321205156.4186483-1-shakeelb@google.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sun, Mar 21, 2021 at 01:51:56PM -0700, Shakeel Butt wrote: > We noticed that the cost of psi increases with the increase in the > levels of the cgroups. Particularly the cost of cpu_clock() sticks out > as the kernel calls it multiple times as it traverses up the cgroup > tree. This patch reduces the calls to cpu_clock(). > > Performed perf bench on Intel Broadwell with 3 levels of cgroup. > > Before the patch: > > $ perf bench sched all > # Running sched/messaging benchmark... > # 20 sender and receiver processes per group > # 10 groups == 400 processes run > > Total time: 0.747 [sec] > > # Running sched/pipe benchmark... > # Executed 1000000 pipe operations between two processes > > Total time: 3.516 [sec] > > 3.516689 usecs/op > 284358 ops/sec > > After the patch: > > $ perf bench sched all > # Running sched/messaging benchmark... > # 20 sender and receiver processes per group > # 10 groups == 400 processes run > > Total time: 0.640 [sec] > > # Running sched/pipe benchmark... > # Executed 1000000 pipe operations between two processes > > Total time: 3.329 [sec] > > 3.329820 usecs/op > 300316 ops/sec > > Signed-off-by: Shakeel Butt Thanks!