Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp3231369pxf; Mon, 22 Mar 2021 00:54:10 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzOmsoVFCtGU2NjMoNyvMvIHZnXSqYUhhKojwwKWWcG61HEWvK3Cx2mcWDvhJ4ecr6K53xN X-Received: by 2002:a17:906:3e89:: with SMTP id a9mr17353568ejj.405.1616399650343; Mon, 22 Mar 2021 00:54:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1616399650; cv=none; d=google.com; s=arc-20160816; b=rN+zevG3dFAIE/nCpJpHO+J78TGgwHVNt60z5scN6TXJ0beRDkCNze4G0bSfrdkfen JhXrbO5kwYimr9swwyFX9GKc5C5QjR/fexpfLFyrfBpxcOgJpQ2G+G1o8NKVGwI5wOVe dQJ9K+9JiaNtsfBGdYejfEjvqS22tWhCHEytStN2E3hGgNz/Iu0Jd4YAkKF55sHhj1Vo a5qM8tc1whOiTB99FuJjQA2/a3alD07xx8Tf49A867h4FkejMRZVZgpnXy2a0QJZC3fd pFdaF0IQCJG98aNRaEg7va1Wyyw3q3mIWeufW7MfVZzDB9c2Ywbn5ehfCDaCoYm4xwC2 i6rg== 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=dt6zatLr1ldkapFUiR5unNuPn3qs8/VkjkQr1MrohGw=; b=HQkHTnnYJVqrB32xsq1ek7oLed8ctLtgLvwMUbtemxBVQkLVfcJ5AuRDIntOfuyJp7 jI19kTFUlSdz3VwTT91Kt93uDNni/BRrnIRBjSS8Wg0EUewQZX4IVHJbnIBsMrCnaFtT qsh46C5rMVWD+psosD0blBZPKhnJG+KiWuIBO18AcSrpQKMJtcDZBZBMAO0AsiOtsAtp aG6jKnNdSsKzE8ak7FMGDVZhaLGIn5WQfKGAWeK3Lq5almJS6JQM2Ht3d8jldXDudnZz ijVpLAriZrbsCkdFAF6miW6azKLfQSShalzVYd4fuq0rvJOXdsYtRY3f5JVow75JrAJg /2Rw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=XktlvvZb; 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 w15si11891252ejb.202.2021.03.22.00.53.48; Mon, 22 Mar 2021 00:54:10 -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=casper.20170209 header.b=XktlvvZb; 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 S229854AbhCVHw2 (ORCPT + 99 others); Mon, 22 Mar 2021 03:52:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47864 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229647AbhCVHv5 (ORCPT ); Mon, 22 Mar 2021 03:51:57 -0400 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BDB88C061574 for ; Mon, 22 Mar 2021 00:51:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.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; bh=dt6zatLr1ldkapFUiR5unNuPn3qs8/VkjkQr1MrohGw=; b=XktlvvZbNG4e7JUjyiOiXvbGSS FPdV0amIImt4ImS2le+tAdlqavcURgIRlkzZfkNtOm5Ds0oxGONLWWku/R5CpAAjlt9NWCB4YCeqK l6sK0aYrjrdPVH1f+jmN/RxabXXd/sRL7V4nw7p5nXBugZTBx4KAJhK5Ojk0Wc2L3ZuGI+tM3/YWt VmhUHJEUZ6VvZ5+Yy6oaTi8Z2QZnTIld2+Fy/R/5NvvOzR2vUQd8HDVqGoM+/sNFJNrr8gFrIssjG /mnJUex5KFuZeMPhwcl5HsM4NvYFI6ndoF9ck81wKqNd1M6qrJKCT3bjWa/Xe6b1AlaRIO+0j7C3F 9l+BBzTQ==; Received: from j217100.upc-j.chello.nl ([24.132.217.100] helo=noisy.programming.kicks-ass.net) by casper.infradead.org with esmtpsa (Exim 4.94 #2 (Red Hat Linux)) id 1lOFIy-008ASg-KT; Mon, 22 Mar 2021 07:48:58 +0000 Received: from hirez.programming.kicks-ass.net (hirez.programming.kicks-ass.net [192.168.1.225]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by noisy.programming.kicks-ass.net (Postfix) with ESMTPS id 1755F301A32; Mon, 22 Mar 2021 08:48:49 +0100 (CET) Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id ECFAF2CF553EB; Mon, 22 Mar 2021 08:48:48 +0100 (CET) Date: Mon, 22 Mar 2021 08:48:48 +0100 From: Peter Zijlstra To: "Li, Aubrey" Cc: "Joel Fernandes (Google)" , Nishanth Aravamudan , Julien Desfossez , Tim Chen , Vineeth Pillai , Aaron Lu , Aubrey Li , tglx@linutronix.de, linux-kernel@vger.kernel.org, mingo@kernel.org, torvalds@linux-foundation.org, fweisbec@gmail.com, keescook@chromium.org, Phil Auld , Valentin Schneider , Mel Gorman , Pawan Gupta , Paolo Bonzini , vineeth@bitbyteword.org, Chen Yu , Christian Brauner , Agata Gruza , Antonio Gomez Iglesias , graf@amazon.com, konrad.wilk@oracle.com, dfaggioli@suse.com, rostedt@goodmis.org, benbjiang@tencent.com, Alexandre Chartre , James.Bottomley@hansenpartnership.com, OWeisse@umich.edu, Dhaval Giani , chris.hyser@oracle.com, Josh Don , Hao Luo , Tom Lendacky , Aubrey Li Subject: Re: [PATCH 1/6] sched: migration changes for core scheduling Message-ID: References: <20210319203253.3352417-1-joel@joelfernandes.org> <20210319203253.3352417-2-joel@joelfernandes.org> <20210320153457.GX4746@worktop.programming.kicks-ass.net> <28e13609-c526-c6ee-22a3-898652aed5e6@linux.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <28e13609-c526-c6ee-22a3-898652aed5e6@linux.intel.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sun, Mar 21, 2021 at 09:34:00PM +0800, Li, Aubrey wrote: > Hi Peter, > > On 2021/3/20 23:34, Peter Zijlstra wrote: > > On Fri, Mar 19, 2021 at 04:32:48PM -0400, Joel Fernandes (Google) wrote: > >> @@ -7530,8 +7543,9 @@ int can_migrate_task(struct task_struct *p, struct lb_env *env) > >> * We do not migrate tasks that are: > >> * 1) throttled_lb_pair, or > >> * 2) cannot be migrated to this CPU due to cpus_ptr, or > >> - * 3) running (obviously), or > >> - * 4) are cache-hot on their current CPU. > >> + * 3) task's cookie does not match with this CPU's core cookie > >> + * 4) running (obviously), or > >> + * 5) are cache-hot on their current CPU. > >> */ > >> if (throttled_lb_pair(task_group(p), env->src_cpu, env->dst_cpu)) > >> return 0; > >> @@ -7566,6 +7580,13 @@ int can_migrate_task(struct task_struct *p, struct lb_env *env) > >> return 0; > >> } > >> > >> + /* > >> + * Don't migrate task if the task's cookie does not match > >> + * with the destination CPU's core cookie. > >> + */ > >> + if (!sched_core_cookie_match(cpu_rq(env->dst_cpu), p)) > >> + return 0; > >> + > >> /* Record that we found atleast one task that could run on dst_cpu */ > >> env->flags &= ~LBF_ALL_PINNED; > >> > > > > This one is too strong.. persistent imbalance should be able to override > > it. > > > > IIRC, this change can avoid the following scenario: > > One sysbench cpu thread(cookieA) and sysbench mysql thread(cookieB) running > on the two siblings of core_1, the other sysbench cpu thread(cookieA) and > sysbench mysql thread(cookieB) running on the two siblings of core2, which > causes 50% force idle. > > This is not an imbalance case. But suppose there is an imbalance; then this cookie crud can forever stall balance. Imagine this cpu running a while(1); with a uniqie cookie on, then it will _never_ accept other tasks == BAD.