Received: by 2002:a05:6a10:1d13:0:0:0:0 with SMTP id pp19csp2560390pxb; Tue, 24 Aug 2021 01:56:45 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzuUSWTZPGZQrtbr9h8jSbUsZHlzujWE3FPzM+SnkVI1t1Ds656JtQhuk5xZQB1kCuveR1N X-Received: by 2002:a92:640d:: with SMTP id y13mr6012948ilb.184.1629795405069; Tue, 24 Aug 2021 01:56:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1629795405; cv=none; d=google.com; s=arc-20160816; b=ilc+tQKLeQBlAEIYK0BAo98OsPL3EADKmv790KW8j4d37+SEZ2laL8hNqTA2tY8oPY FlFOAksiDXmKTgHOQyRw9bNtPrwnf8pX/Gv5d3SOcI15lQtQUR36PCLDjTyV94GHvQRE Kg64olXulgOq0eB16Z0uJAh+fWl/C5EcWEB6bN75brSSMe32L2ib9VbynxPCwSgzWL6p cFYJ0uELXFb0DLOpy1O+gCH8Xes5f/AQ43cTtIJ8XLB6FOq//C/WXvANr77lK0O7fzSj Ge8r/cdgIJZxdZrd/sDCB95gbZ7tn+Y5alBiKI9a8P7WQvu5TkO7qUJGqrnpM0FBOMVj T35g== 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=25tLido20qf09e1xyoklr9DCNsjopfjqyz+wEdkRuCY=; b=z6m158O4xufoyzfyqs9fzRiQg/b/oyDWCXWL/7KlTGi4MZcbHgEZSFXKcepN4/OEUs jfLheI7ScOSp5Y4gNx83y7/HBI9cY7NuSl09JbL6P81zQHbehOotFuhiYdPNY8BtjKid Yegbb5SpVS2WvkMGLpq7zXxbFkw9W0waKNXgTzg+U3VGl5xo9o0la9CSpV5jGn03gkJk RqvBetkKo/T1iJD5jcj+nVhsgdirMvzwfxR8cETo8nqYbsrgcbvgbJLR3IjWrvSnBZ35 iU4o3Ny9OaAJvbhiyV39jQ84kn+KiBVsseo320Dtov+AzU99SdlKohVejju0Qu7xYHEF fWGQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=desiato.20200630 header.b=YbAVLprN; 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 y9si3110675jan.84.2021.08.24.01.56.33; Tue, 24 Aug 2021 01:56:45 -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=YbAVLprN; 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 S235345AbhHXI43 (ORCPT + 99 others); Tue, 24 Aug 2021 04:56:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55586 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234214AbhHXI42 (ORCPT ); Tue, 24 Aug 2021 04:56:28 -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 6CCD8C061757 for ; Tue, 24 Aug 2021 01:55:44 -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=25tLido20qf09e1xyoklr9DCNsjopfjqyz+wEdkRuCY=; b=YbAVLprNfZ9PX2CRrqfNQQ1D1C KwJrH2Pwj9usHTkfuvEPKk3gudguF/3CMYtJPKNdF/CCnfBRsRyJGQLFJsy2Yk6Oecpwd9BaWsiR4 LZpYdejC75u7PYTJD/H2crNVv8W7f2r4qpAsbVMqg5/KsEwndaoJW7IVlNlEboAaF4PKgGcWzTkzK M9+ZXXUYAwCDwZgZYHx9hlremX2qlxC/UY6RJsrlOM+xqsn9qezOYna+Nsh/78FOIopE5zK5i8YCN 82ZWldYyBVMVmUXUjiZ4lyprRTcQkSeRAaO5U/cRTW6QFmnxiQty1L9k8XK3SxAxReha37+VEzqfG tttEQz8w==; 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 1mISDM-00CXoZ-Ou; Tue, 24 Aug 2021 08:55:25 +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 9E5F2300024; Tue, 24 Aug 2021 10:55:23 +0200 (CEST) Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id 54D2D2C57D1E9; Tue, 24 Aug 2021 10:55:23 +0200 (CEST) Date: Tue, 24 Aug 2021 10:55:23 +0200 From: Peter Zijlstra To: Josh Don Cc: Ingo Molnar , Juri Lelli , Vincent Guittot , Dietmar Eggemann , Steven Rostedt , Ben Segall , Mel Gorman , Daniel Bristot de Oliveira , Joel Fernandes , Vineeth Pillai , linux-kernel , Tao Zhou Subject: Re: [PATCH] sched/core: fix pick_next_task 'max' tracking Message-ID: References: <20210818005615.138527-1-joshdon@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Aug 23, 2021 at 04:24:26PM -0700, Josh Don wrote: > Hi Peter, > > On Mon, Aug 23, 2021 at 4:17 AM Peter Zijlstra wrote: > [snip] > > + for_each_cpu(i, smt_mask) { > > + rq_i = cpu_rq(i); > > + p = rq_i->core_temp; > > > > - /* > > - * If this sibling doesn't yet have a suitable task to > > - * run; ask for the most eligible task, given the > > - * highest priority task already selected for this > > - * core. > > - */ > > - p = pick_task(rq_i, class, max, fi_before); > > + if (!cookie_equals(p, cookie)) { > > + p = NULL; > > + if (cookie) > > + p = sched_core_find(rq_i, cookie); > > In the case that 'max' has a zero cookie, shouldn't we search for a > match on this cpu if the original class pick ('p') had a non-zero > cookie? We don't enqueue tasks with zero cookie in the core_tree, so I > forget if there was some other reasoning here. IIRC we don't keep 0-cookies in the tree. Lemme check. Yeah, see sched_core_enqueue(), they bail for 0-cookie. This is indeed sub-optimal, but also having the 0-cookie tasks in the tree has other issues IIRC.