Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp2887853pxb; Mon, 18 Oct 2021 04:09:41 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxTSIXP/ngYC1sv2C1H5KVlGvMuhbpx1MWJUWjJu9mQZsKj9YBSvldtN9wqfSMzQ9QLEzoQ X-Received: by 2002:a17:903:22cc:b0:13e:fa73:6fef with SMTP id y12-20020a17090322cc00b0013efa736fefmr27075296plg.25.1634555381403; Mon, 18 Oct 2021 04:09:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1634555381; cv=none; d=google.com; s=arc-20160816; b=zRwJGBp8RgC0CwrUUMH5GlDW3PUeoUqgSFj7loF8Hf09b0+c7VCJQ/+YBW/TN7uMMO 8U//C5mITyZj5WDoPRVO/wEJ5T74I8iWfgQ7ca0eHvPKq1uXQZjYkEXf6meaz7gud0D1 zg2vA57kBNuXi37SkcOqUt07TcbSWTC919JU+dzr9gEcVhhNh2Bo99NWyXKG+Rq/HH3f /GospWq2bQQhVxMr1o7Lff9dLNWFA0+IlAyYA/WYmnjb4+XmF7ulrmreymSi8cMHJhXh QqoY5xuUoDA1Bu68g4St6bzepOXvXwk6ngaeP3FIs88p80cBU4k7wAk3JGBAhPE6uV4Q hraQ== 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=G5Cu0qEBL4VFE/qKE/uyMI2QAvj/eVnrcPAfSn5b3xg=; b=QmyMrtfgImivrguKaFn/7wWIZt7CBEXfQgw+4naRa0qtgO5fdnu53y4/OiX348xZqd hfUUV06PlcfvCKTszzD3ycsbGN6jkzgI41jiKAx8wAj9rvYEGydNGhKnPOoBorzeGBn7 M35tXzhwLjXyyli887ZaesFRBKDyZozKp0vYj49yI55t74TYviClHK+gm7i+uPc5Z4F3 DSZnZIT5MBfaj9MCAYvLSI+QcmeDIY7c5cDZuhfW4M58lr/4s1FCjiSYRz0FFfenYLm8 mhP31rrqT5K+smCEdIct+kagpUcSr3A54afzYsSZXwCF6DILlD0KH9KgxUbM0KNjN9kK pj8g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=desiato.20200630 header.b=U2nv7UTJ; 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 n25si15937392pgm.224.2021.10.18.04.09.28; Mon, 18 Oct 2021 04:09:41 -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=U2nv7UTJ; 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 S229778AbhJRLKS (ORCPT + 99 others); Mon, 18 Oct 2021 07:10:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57792 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229668AbhJRLKQ (ORCPT ); Mon, 18 Oct 2021 07:10: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 7DE44C06161C for ; Mon, 18 Oct 2021 04:08:05 -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=G5Cu0qEBL4VFE/qKE/uyMI2QAvj/eVnrcPAfSn5b3xg=; b=U2nv7UTJR2aVCCKvSp31a4r/rY 6LkR+LfXoYBqfhMXEIzxqU42ApVBguBdYUhLK06W5EbPj+rekuZr0+VKwIqDcWpO4xMdZxWXWTIBc uq6oVokraHjVNPend+8swk57BjEGgZ8bXSGkTu6TAPaw/wrmOVl1NJtidgK4sKVLmuKy9a0LQeOog 4s7N/b3boWDWx/dGWLas18nkZcxhqmlXyKIhQyVt343DTdfkh9WmZSKYm3zquDdP0UntlYydzI7Ya C+ixP52gg1fgpn501sA3kdaPGOAEsRNnfdX3EkcZ2FKdUZqTSrfHTT9834V7X5x/bn7StRboXBqGl If/lOTZA==; 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 #2 (Red Hat Linux)) id 1mcQUl-00AXK6-Dp; Mon, 18 Oct 2021 11:07:55 +0000 Received: from hirez.programming.kicks-ass.net (hirez.programming.kicks-ass.net [192.168.1.225]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (Client did not present a certificate) by noisy.programming.kicks-ass.net (Postfix) with ESMTPS id E818730024D; Mon, 18 Oct 2021 13:07:54 +0200 (CEST) Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id D8CB7286E0A07; Mon, 18 Oct 2021 13:07:54 +0200 (CEST) Date: Mon, 18 Oct 2021 13:07:54 +0200 From: Peter Zijlstra To: Song Liu Cc: Athira Rajeev , Arnaldo Carvalho de Melo , Jiri Olsa , "linux-kernel@vger.kernel.org" , "maddy@linux.vnet.ibm.com" , "kjain@linux.ibm.com" , "mingo@redhat.com" , "eranian@google.com" Subject: Re: [V2] perf/core: Avoid calling perf_mux_hrtimer_restart multiple times when scheduling event groups Message-ID: References: <20211015070403.4809-1-atrajeev@linux.vnet.ibm.com> <6E561141-B584-4DB8-A33E-BCD3FF572FA4@fb.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <6E561141-B584-4DB8-A33E-BCD3FF572FA4@fb.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sat, Oct 16, 2021 at 01:08:04AM +0000, Song Liu wrote: > > > > On Oct 15, 2021, at 12:04 AM, Athira Rajeev wrote: > > > > Perf uses multiplexing if there are more events to be scheduled than the > > available counters. With multiplexing, event groups will be rotated at > > specified interval of time which is set using "hrtimer". During event > > scheduling, if any of the event group fails to schedule, multiplexing > > gets enabled by setting "rotate_necessary" for that event context and > > starting the hrtimer by calling "perf_mux_hrtimer_restart". > > > > Patch adds an optimisation to avoid calling "perf_mux_hrtimer_restart" > > multiple times if already rotate_necessary is set for that context. > > Even though "perf_mux_hrtimer_restart" will just return if hrtimer is > > already active, this could avoid the overhead of calling this function > > multiple times if there are many event groups. Patch adds the check to > > avoid calling perf_mux_hrtimer_restart() for each event group on > > every schedule. > > > > Signed-off-by: Athira Rajeev > > Acked-by: Song Liu Thanks!