Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp1749450pxb; Thu, 28 Oct 2021 09:20:31 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxh193N2vu8z5CcKaULnfjgVJFvbg6v+QLkUdCyAnJf352lTTiBh8JE6wi8v2qrcVVysT7a X-Received: by 2002:a17:90b:1d08:: with SMTP id on8mr13922861pjb.44.1635438031585; Thu, 28 Oct 2021 09:20:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1635438031; cv=none; d=google.com; s=arc-20160816; b=aYcm+rT7pv3NfsG70T7rdr4R9QWOh47OJbBSKATBB/P3L97xhXizOnwP9pQsTXwgx6 IfPzuLaKMZoMXZwu28HLumSxLMA0lCmgbjUL8Dwj5Gk6ugO8WCrbvQZxwZVXacRp/Nsq 96VDtBp3mMCnBhroHyPQ8t0VSasmP0zYUkguWNziKanVdC5OFSaMhY6EkTmsvDZXbj1L vIhWe2xFyuCPUeMQ+jhTIYv0mUhuZCxrLcnj2aE4IXIk8c8mJvf2SThtCPaMOkA5pAEe HJ4Gifb9lK5LZwG3vwlm5ek4/ReLhFv6MbP1FXRaYfmB29ElMRKJFPXfEynJ2qIMrLI2 EKbQ== 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=UKnFFiMfY0GxswzJmBjzLfl2Fj5DavTAFzb8a7nWObQ=; b=UL3vjcTHehlpmGmilxVlelclli/4icYLyL4PfujEkXQWOOhDB4e7dKSL7kSEIRQQ4s /0jf2+j2TyDCWblcu94+ttKRuPCpg36zg7R9M4SNCk9r1mfQdU8wIL/nvMUpu9WhmrFD YPYBoab4VTAnWOvP5QJSiGn5+vF9iKcww9+DcQEXSXKsVkLV6tL0WldDh7G62o8+LlK8 yMooUT963Vvajsuq/U9EeDsbhYIcUQaEIatIWcEYUAZreGbkO9md7tbI19HLetmCT0xn fdoC6NUot9j4KsZ2CxqqAozAZzPZmb3dUrIWXIZvTDSPtCbJBHX6k9ksoko9lWvK01oI t/Gw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=IMBJdvx4; 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 d20si3934746pfr.267.2021.10.28.09.20.18; Thu, 28 Oct 2021 09:20:31 -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=IMBJdvx4; 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 S230119AbhJ1QVl (ORCPT + 99 others); Thu, 28 Oct 2021 12:21:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57154 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229565AbhJ1QVk (ORCPT ); Thu, 28 Oct 2021 12:21:40 -0400 Received: from out10.migadu.com (out10.migadu.com [IPv6:2001:41d0:2:e8e3::]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 94400C061570 for ; Thu, 28 Oct 2021 09:19:13 -0700 (PDT) Date: Fri, 29 Oct 2021 00:19:48 +0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1635437951; 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=UKnFFiMfY0GxswzJmBjzLfl2Fj5DavTAFzb8a7nWObQ=; b=IMBJdvx4lTA/0WJec4tnZEwkaCDtgWkK6vn7ZWf+VhH4bFLgkkGfrYY2Eb/yg2GWRxuNdI WQX41RpqvbTCU/OcCdkcZy+JU7Z5BztpoBWQhr7cAhMGejXHNxq7R3QaPi2J9wEFo323yU jI1+q8H5txYSq6+eCyKpY4xGNpOYBlk= X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: Tao Zhou To: Mel Gorman Cc: Peter Zijlstra , Ingo Molnar , Vincent Guittot , Valentin Schneider , Aubrey Li , Barry Song , Mike Galbraith , Srikar Dronamraju , LKML , Tao Zhou Subject: Re: [PATCH 1/2] sched/fair: Couple wakee flips with heavy wakers Message-ID: References: <20211028094834.1312-1-mgorman@techsingularity.net> <20211028094834.1312-2-mgorman@techsingularity.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20211028094834.1312-2-mgorman@techsingularity.net> 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 Mel, On Thu, Oct 28, 2021 at 10:48:33AM +0100, Mel Gorman wrote: > @@ -5865,6 +5865,14 @@ static void record_wakee(struct task_struct *p) > } > > if (current->last_wakee != p) { > + int min = __this_cpu_read(sd_llc_size) << 1; > + /* > + * Couple the wakee flips to the waker for the case where it > + * doesn't accrue flips, taking care to not push the wakee > + * high enough that the wake_wide() heuristic fails. > + */ > + if (current->wakee_flips > p->wakee_flips * min) > + p->wakee_flips++; > current->last_wakee = p; > current->wakee_flips++; > } > @@ -5895,7 +5903,7 @@ static int wake_wide(struct task_struct *p) > > if (master < slave) > swap(master, slave); > - if (slave < factor || master < slave * factor) > + if ((slave < factor && master < (factor>>1)*factor) || master < slave * factor) So, the check like this include the above range: if ((slave < factor && master < slave * factor) || master < slave * factor) That "factor>>1" filter some. If "slave < factor" is true and "master < (factor>>1)*factor" is false, then we check "master < slave * factor".(This is one path added by the check "&& master < (factor>>1)*factor"). In the latter check "slave < factor" must be true, the result of this check depend on slave in the range [factor, factor>>1] if there is possibility that "master < slave * factor". If slave in [factor>>1, 0], the check of "master < slave * factor" is absolutly false and this can be filtered if we use a variable to load the result of master < (factor>>1)*factor. My random random inputs and continue confusing to move on. Thanks, Tao