From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 96034C4338F for ; Tue, 24 Aug 2021 08:55:47 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 732666128A for ; Tue, 24 Aug 2021 08:55:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235382AbhHXI43 (ORCPT ); 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.