Received: by 2002:a25:f815:0:0:0:0:0 with SMTP id u21csp2149897ybd; Mon, 24 Jun 2019 01:28:07 -0700 (PDT) X-Google-Smtp-Source: APXvYqwUzvfrhW2JAWaZApZuSPzJIE+43rjAgwfbUN4nCyV7LWRhXXpBfgLkvesWADvkq2h9d/ob X-Received: by 2002:a63:4d05:: with SMTP id a5mr29602159pgb.19.1561364887052; Mon, 24 Jun 2019 01:28:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1561364887; cv=none; d=google.com; s=arc-20160816; b=bbNPUsgYEkrlWPFJ4N0uYfkGajlstytX5UAOVsSKJ1nLlajoXj1TWChW1uMfLF+cuR 6WKTnYXAaaeLivLDur/7kyXCup4ZwiZyu4YpI/nYkv7aq2JCB06JFfo/vpnmM0aMQg84 +YBwx6EiG933WrxqBhVN3NMzKevKrogT/qpY8gh78LlGeqi7+38fzQziMzPL7U3wmy0s WROA92d+giTn2bivO7ngqdBfcrPNXbJLOr3KaN3CfFotNo88XlpVmx0lcfas5p4ILUsa tXdFHWtAbGMzPC1xa1CzKxOUn7NV0Qz9+ziaUK/yge9GlJp2s+cvkb+K24US/TE4gmx9 Byxg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=YKFDzPGybk5R8ch9oFESg0knJ0Pigl4fK6opa7BBhXs=; b=sQvwNs12BYdwudHs6aaQ1xj71g3mIDuIS/YuY1GdDwtj00MUUebG5dfP5+/ELzaOfa JNupj9RXruw+V0FvKpBmmbbAvPPQFRVxMc72XF8DnF6te3BsoTMqzgn+7Y6qYuVXT5pC xBvejhfB8LnmFfFRi4VXMiKyROBszGDE8DLZpIh7YzG0elSIKo2RlXiCs4AynSl+zYrR OeSROoZql+H5Ij/r8y9lzqkZD6TBtR1j0BT3PJvRlj8/uI/P7y8dd2gTMUTBisrtExba bB3VTD7XNY6JDk/gGgwKtMMjr3M2P3RyrKQBRxHqeJirjQo4K4vF6JwwVs3mFm1AZ9Vn ljtw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=merlin.20170209 header.b="V/yp/xFp"; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 1si9866029plz.129.2019.06.24.01.27.50; Mon, 24 Jun 2019 01:28:07 -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=fail header.i=@infradead.org header.s=merlin.20170209 header.b="V/yp/xFp"; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727921AbfFXHzf (ORCPT + 99 others); Mon, 24 Jun 2019 03:55:35 -0400 Received: from merlin.infradead.org ([205.233.59.134]:41492 "EHLO merlin.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725916AbfFXHzf (ORCPT ); Mon, 24 Jun 2019 03:55:35 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=merlin.20170209; 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:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=YKFDzPGybk5R8ch9oFESg0knJ0Pigl4fK6opa7BBhXs=; b=V/yp/xFpxovkcAEcUvqU2xT2w qZ1urH3v0huiIIxE8ng2FZ16RZ70VMmsBfveNRAEXtlOyufCpaMhYw5iQet+dPtxzV5LunBfZeJ4G 4HajUwoG5PQce29O0CDx+kZL3A4lJ9hid6H9v4p9Mt1D5Dol+Ojc/CJ2vzLWHFJS2+7kha2UZzvZ6 5tgGA4cI/PBbY8Rxb8LXuyMjwd0kVzzVQ4+xNgyOld88OQwXHIu67FDhw7S3qOdyMm2FcHyPTqDCq hys5xkq/YBuxtuq2/4aE3VveM5+I8weU1ke5TsvZC4dQefBvmASfU7DAcAaHIb8JZ4LgMzMKgTEBa l+qv6HU3w==; Received: from j217100.upc-j.chello.nl ([24.132.217.100] helo=hirez.programming.kicks-ass.net) by merlin.infradead.org with esmtpsa (Exim 4.92 #3 (Red Hat Linux)) id 1hfJov-0005PR-8T; Mon, 24 Jun 2019 07:55:21 +0000 Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id 2002D203C05DA; Mon, 24 Jun 2019 09:55:20 +0200 (CEST) Date: Mon, 24 Jun 2019 09:55:20 +0200 From: Peter Zijlstra To: Ian Rogers Cc: Ingo Molnar , Arnaldo Carvalho de Melo , Alexander Shishkin , Jiri Olsa , Namhyung Kim , LKML , Kan Liang , Andi Kleen , Stephane Eranian Subject: Re: [PATCH] perf cgroups: Don't rotate events for cgroups unnecessarily Message-ID: <20190624075520.GC3436@hirez.programming.kicks-ass.net> References: <20190601082722.44543-1-irogers@google.com> <20190621082422.GH3436@hirez.programming.kicks-ass.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Jun 21, 2019 at 11:01:29AM -0700, Ian Rogers wrote: > On Fri, Jun 21, 2019 at 1:24 AM Peter Zijlstra wrote: > > > > On Sat, Jun 01, 2019 at 01:27:22AM -0700, Ian Rogers wrote: > > > @@ -3325,6 +3331,15 @@ static int flexible_sched_in(struct perf_event *event, void *data) > > > sid->can_add_hw = 0; > > > } > > > > > > + /* > > > + * If the group wasn't scheduled then set that multiplexing is necessary > > > + * for the context. Note, this won't be set if the event wasn't > > > + * scheduled due to event_filter_match failing due to the earlier > > > + * return. > > > + */ > > > + if (event->state == PERF_EVENT_STATE_INACTIVE) > > > + sid->ctx->rotate_necessary = 1; > > > + > > > return 0; > > > } > > > > That looked odd; which had me look harder at this function which > > resulted in the below. Should we not terminate the context interation > > the moment one flexible thingy fails to schedule? > > If we knew all the events were hardware events then this would be > true, as there may be software events that always schedule then the > continued iteration is necessary. But this is the 'old' code, where this is guaranteed by the context. That is, if this is a hardware context; there wil only be software events due to them being in a group with hardware events. If this is a software group, then we'll never fail to schedule and we'll not get in this branch to begin with. Or am I now confused for having been staring at two different code-bases at the same time?