Received: by 2002:a05:6a10:1d13:0:0:0:0 with SMTP id pp19csp2380343pxb; Mon, 23 Aug 2021 20:11:24 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyCPnQ/fvm+l1mqqoxjnfmTIfqs8B/wJ8w/u0idSxF7/D4sbVZB5fAsPnjEgPzSyrh6dJ0U X-Received: by 2002:a05:6402:2288:: with SMTP id cw8mr39834746edb.216.1629774684132; Mon, 23 Aug 2021 20:11:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1629774684; cv=none; d=google.com; s=arc-20160816; b=L5QqH9boQpLpl9/yKEUJjLfP/dSpz52OiLHEVEF3SbpV/fmvcC8jHHdO0o19qiX5rb qUwFVWbzm5kbpWqoO8EJGG4INKEQanF+mfa91w0bAUprxSihy6YbOybkjcjrsspIpNLT NA8VjG3QdyAeBvQEby78aBRUPgDmtBkpnpj1Ex07oT+t2n/WI1srTwk3sISzKVuIz4VU 5J20+m2smPI7p79PK7QtfV8H69ScjYeT6YklQFMomnJum+2fWwagTTSiPAdVA6YXeGX6 pfi05Ep7GzdsNdzHs2oBlfJPuwL8Qx7dhb/V41cjttZEWA4hgM0XZHSOyGu+uXIy/DI8 iPEg== 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:dkim-signature:date; bh=TNl6fhGOST2/fJOT5KEyUhanXPoPPIsfVeF9RTPm3f8=; b=aXapBLU/hPpwJX1c0Xy0rtMwPtoIWAGPgIprnDxsZb3Rr5mVBu2Rj/DoPexCmdePOi thgbeZJ/PtS4tKbBmnIw/rhnMMx2PMJnfarO16knCwK+pt4dbV0xoKbiyQImeVROhc/N nMTaF3917TmaRxt+rjFUjGqppwQdj8pxqdkUWRiXXUCsio8jCUVCEs90n+0/735Xw/UT XiUnJEOusOsj01DrHLY2WP4KOBkq+kxjkUicYPUqyHDZHfUpaqFa6NkJSpBdlKH8z/Cr O0Euph6wtNvLMRobDDm4587wvC8sHBXnMIrlnuwTZp7Cc6wvlZ2uHHv5ikDRkqy5LQSN Gi6w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=M1FedzS7; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.dev Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id e23si15799671edc.286.2021.08.23.20.11.01; Mon, 23 Aug 2021 20:11:24 -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=@linux.dev header.s=key1 header.b=M1FedzS7; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.dev Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234799AbhHXDIG (ORCPT + 99 others); Mon, 23 Aug 2021 23:08:06 -0400 Received: from out0.migadu.com ([94.23.1.103]:28277 "EHLO out0.migadu.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233971AbhHXDB4 (ORCPT ); Mon, 23 Aug 2021 23:01:56 -0400 Date: Tue, 24 Aug 2021 11:01:50 +0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1629774058; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=TNl6fhGOST2/fJOT5KEyUhanXPoPPIsfVeF9RTPm3f8=; b=M1FedzS7dQXLVds3lnVYJWxcBJ1+V8R/nEnRHhP1Xgg0e9N1DH/ncbGJPPjxOZMt8YedDp uRQvfFI5hMbYogoHY+lKFi8i0TD/SdTqd+22aVQ09qPYvf7OE7D0qCyMS1BlsdwrLEOSHu bd3vyV5/kFdwd83pyRM0titMuhDArt4= X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: Tao Zhou To: Josh Don Cc: Peter Zijlstra , 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@linux.dev 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: X-Migadu-Flow: FLOW_OUT X-Migadu-Auth-User: tao.zhou@linux.dev Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Josh, 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 In the original pick_task(), when cookie is zero, we choose class pick task or force idle task. > 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. So, no need to search the core_tree when cookie is zero. But I'm not sure that force idle pick condition(in pick_task()) is also covered by this clause in the first filter max loop in the rewrite.. ' if (!max || prio_less(max, p, fi_before)) max = p; ' I just thought there are three(one add by Josh) places that can return max; 1, !cookie condition and class_pick > max 2, cookie equal condition and class_pick > max(add by Josh) 3, cookie not equal condition and class_pick > max. The rewrite change a little with the class pick, it loops all class to find the max first(finally will get one task and not be possible return NULL). This is not the same with the original. It is very possible that I'm getting wrong, then please shout to me. > > if (!p) > > - continue; > > + p = idle_sched_class.pick_task(rq_i); > > + } Thanks, Tao