Received: by 2002:ab2:3350:0:b0:1f4:6588:b3a7 with SMTP id o16csp1287386lqe; Mon, 8 Apr 2024 04:58:56 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXODF9wCrddcQoWK0m7BX4+6o6tzu8YbXAeoA98imKXpclnr1V6fQoIhVr18lkU3NZ2glMnKpRE5ys8jfb1e8/aySvYcDqawI2G9Lm+vQ== X-Google-Smtp-Source: AGHT+IEaQogNH9ulTP7VSk3Qbxnzxvt4+3J//zZjAhyo1m2yqpQZ3c5jzJFcTLbX7VvQKPs5ldoh X-Received: by 2002:a05:6808:14c8:b0:3c5:ef30:1f3e with SMTP id f8-20020a05680814c800b003c5ef301f3emr5445727oiw.3.1712577536459; Mon, 08 Apr 2024 04:58:56 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1712577536; cv=pass; d=google.com; s=arc-20160816; b=zVCs+gb8LeJxYJSZkQvBaBeg+dv9dUsZ5YJf++Vu0k1jECJt21Fvl9O0v8GxTFI9wR o7XU1PkO6m4+G60JIuRO6mZFTfS5w7Ed/3sAI0MH2SdZvoSQKPzYVpT/ihCcWEKXmG+v yPqEzGmHkzhNJ38lNVFvMwdiDmuGUFHl1OBuZF5wKxr8cE3fi9Y3fOU4XTni/1plltVG jwd06CSxlFIkWPojtgYRSl6lb2RYoieVSfcWGKwTddcBIjYUVne8m4I+Vyg9PO1YptGH 452dl6B/mBQzJ1C6KWf2MmLmXAtHOOY7n19KZ/PHzZUKSCHnSKH/7WCOQXLaQg9D40Tg UDEw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date:dkim-signature; bh=ijMJyTNW0bbtVuJy5mr07gclVu+CJ/ZwMsLdwX+81G0=; fh=POaJYdjjl7v76+h/t4J0j+2/I+bvkcyesow38CQqCdM=; b=WBLbIqkTJEfMJ4h8TMj9WNva1s2Xi6K0VffTHOZJ/ZiKNjZn60EwlkS6m4sgkn9wSL V/YpZIDrYRH0W+W+7aCv0jkZhPPZ+N3E6huNLw0OprYod1Eukow8GYNt+xgeWrpOrqNp jL+LenrC4rhp1EFtWgNcWdI8hRDwk2S2L5bXc+4zPqyFOWbkYB79jW893hLjM3us0JVJ aKBjeMj6KaXJVm62YfGVw4hjIvgac7GT3tr5jzXr4uKQRl2TBzOM4kbL/Z+OzKAIWhob si2lxzhaREKI2B6wbWf6kqO6sT4uyHR8IgGZF4cmc3IP0N6YfKuhZ07Dkah+N6rZ6Mfe +r8Q==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=exSAgWiH; arc=pass (i=1 dkim=pass dkdomain=infradead.org); spf=pass (google.com: domain of linux-kernel+bounces-135293-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-135293-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id xx21-20020a05620a5d9500b0078be0312c07si8082525qkn.728.2024.04.08.04.58.56 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 08 Apr 2024 04:58:56 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-135293-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=exSAgWiH; arc=pass (i=1 dkim=pass dkdomain=infradead.org); spf=pass (google.com: domain of linux-kernel+bounces-135293-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-135293-linux.lists.archive=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 31DC81C219A9 for ; Mon, 8 Apr 2024 11:58:56 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 7712B6A337; Mon, 8 Apr 2024 11:58:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="exSAgWiH" Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D3AD06A328 for ; Mon, 8 Apr 2024 11:58:48 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=90.155.50.34 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712577530; cv=none; b=G6SQIW1d/xlOjVFsbF0I47ULPYN9invWXc9VG+waX1/DGsiIiXM3u5w0BKn3807OTaydcsD71ToDIn13a/M3WdYRAfefFgsIddctzh9JgW70B0A4nBI5QkqfXEa99mnFbTsDn2uJYoMHFF+wwxwKCSKqBVwLFsNDBaEiiNvLHp0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712577530; c=relaxed/simple; bh=vfP6aSYaUOR89SNo33iDBJOiy2nShSuA0qK1RBew/Yw=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=e1CdwMZWWa9/sNaO540q99IOhhR0K2JlunJzl+wDSZZWNfQOK+rR3/TZBRuLxvBMkWumeNB4kBD5NbFp2pSKmsA8d6ol+yUeIaqTX68Fc0/BtbUPpsh9cQVcmjNI4i7/tYgsQzLEoOU74qeN7R3HRkOPSRzb9wD/ukvgUHz2o0Q= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org; spf=none smtp.mailfrom=infradead.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b=exSAgWiH; arc=none smtp.client-ip=90.155.50.34 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=infradead.org 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=ijMJyTNW0bbtVuJy5mr07gclVu+CJ/ZwMsLdwX+81G0=; b=exSAgWiHittm2rotyeM+vUq0Hn eu1msBW8szONUp3LXdSQzFGdEX/DQQulqcgI7+AQKBt8ZQtcCG8CTqvfeEDlAVk2gvaEIpUoCH60y GVM0TgW6rhty5ZGUta2vSFB9/KGVQrLx1gFNiBqSxuyPXvgV+PSoFI5inoRHDdbeXjmhsIRaSpTxb NTag0D1BuwVt/YpGhTKAYKyjVcqW4F2AX4CfOTn4+ovN+njdm8z8fCYo0G8cKhEr2VUHKiYrHTXo/ FzfpPFQrtwN1sNOFe2A+jeY1q5DYKGh0zKI9rmfa1NPcyKBbnIZPLW0tnNxpIrvpJZuwWxnF4Q8Bz H49qOVWQ==; Received: from j130084.upc-j.chello.nl ([24.132.130.84] helo=noisy.programming.kicks-ass.net) by casper.infradead.org with esmtpsa (Exim 4.97.1 #2 (Red Hat Linux)) id 1rtndy-0000000HN5j-0MdQ; Mon, 08 Apr 2024 11:58:34 +0000 Received: by noisy.programming.kicks-ass.net (Postfix, from userid 1000) id BE29630046F; Mon, 8 Apr 2024 13:58:33 +0200 (CEST) Date: Mon, 8 Apr 2024 13:58:33 +0200 From: Peter Zijlstra To: Abel Wu Cc: Chen Yu , Ingo Molnar , Vincent Guittot , Juri Lelli , Tim Chen , Tiwei Bie , Honglei Wang , Aaron Lu , Chen Yu , linux-kernel@vger.kernel.org, kernel test robot Subject: Re: [RFC PATCH] sched/eevdf: Return leftmost entity in pick_eevdf() if no eligible entity is found Message-ID: <20240408115833.GF21904@noisy.programming.kicks-ass.net> References: <20240226082349.302363-1-yu.c.chen@intel.com> <758ebf4e-ee84-414b-99ec-182537bcc168@bytedance.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <758ebf4e-ee84-414b-99ec-182537bcc168@bytedance.com> On Thu, Feb 29, 2024 at 05:00:18PM +0800, Abel Wu wrote: > > According to the log, vruntime is 18435852013561943404, the > > cfs_rq->min_vruntime is 763383370431, the load is 629 + 2048 = 2677, > > thus: > > s64 delta = (s64)(18435852013561943404 - 763383370431) = -10892823530978643 > > delta * 2677 = 7733399554989275921 > > that is to say, the multiply result overflow the s64, which turns the > > negative value into a positive value, thus eligible check fails. > > Indeed. From the data presented it looks like min_vruntime is wrong and needs update. If you can readily reproduce this, dump the vruntime of all tasks on the runqueue and see if min_vruntime is indeed correct. > > So where is this insane huge vruntime 18435852013561943404 coming from? > > My guess is that, it is because the initial value of cfs_rq->min_vruntime > > is set to (unsigned long)(-(1LL << 20)). If the task(watchdog in this case) > > seldom scheduled in, its vruntime might not move forward too much and > > remain its original value by previous place_entity(). > > So why not just initialize to 0? The (unsigned long)(-(1LL << 20)) > thing is dangerous as it can easily blow up lots of calculations in > lag, key, avg_vruntime and so on. The reason is to ensure the wrap-around logic works -- which it must, because with the weighting thing, the vruntime can wrap quite quickly, something like one day IIRC (20 bit for precision etc.) Better to have the wrap around happen quickly after boot and have everybody suffer, rather than have it be special and hard to reproduce.