Received: by 2002:a05:7412:d8a:b0:e2:908c:2ebd with SMTP id b10csp809438rdg; Wed, 11 Oct 2023 06:16:34 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGLZR4SJB5tpIIZinA5+2QAaV2shfr2fqcl9tnVTIFYMS5uWUpwGxfMz4CR10UZ3X8RV5E4 X-Received: by 2002:a17:903:192:b0:1c8:9bc6:2a09 with SMTP id z18-20020a170903019200b001c89bc62a09mr10567413plg.15.1697030193878; Wed, 11 Oct 2023 06:16:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697030193; cv=none; d=google.com; s=arc-20160816; b=YHGO9FdRc8g/QdbVvYLqHcMdk46HkFLHimF0hTPpJIdaUKdQ1GGqSAs6PyhusoI/Ve YMzSRIxdCh/9p7TM3LMcgCXVkxoP8LG2hOSFlP+YDzcXKMwZeJYYraBzCasjaaYr5DZH fhNWda6Y8wItQjucNhvJ+oLpxxYuWLCDN2m869ybAqFNigdyL5tYZO738ttX+Qjdpsub rgBSpWVlPNZj9CrPFR9ijDY4gDne3VcSEC6hCn9PZ9iRRtY7YZ3KbBW+PrX08woM4f8l UBrL4anNTu+gE+W5QTGB61mnNINRuTgkSqCxHiPWy2q2MSu8XU6+NCfvHUt4Yze7gNfa uA7A== 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=wylDPGSbHiTs2Q0e0qTsSFcSCa3RyAKkf9nWVpyjUCY=; fh=83vR4EsV7jzK9SCNfCNq+85kifr+rXsmjG7hifsgFkM=; b=UsK6eSBZe+tlKbnvg6xmOVLw648wHOigzIhse9Myo5tYxKiJ2hhimUnxpRQb2kOEa2 4D4hPdbt8iJZn1i+xH7Teue4CCxu4IUxrS+EyVw8YxKeWVq2V4fGDlS0aNkBa09Pe4UY jPqrHHGqV35LmS6iLIyPZEqQYZOzCuvkwj5KldpemxbkPAm3Ihi6F4V7pRbg8KWcOCK+ NlKrhSouz70JU0vqitWL3LCPqqBwl7skZZEMdvBMe2SHGnpvDo0wU8uttwqenOC84xQE 7ZsTiopXHjNU1EWdxgA3Kq4vBglIJ5yPWJKi4yoeH15Dphl7nD2p3jCqrLMjppD3xmZ+ Q+zw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=mebrz071; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from morse.vger.email (morse.vger.email. [23.128.96.31]) by mx.google.com with ESMTPS id w9-20020a170902e88900b001c753d6b95fsi2568066plg.315.2023.10.11.06.16.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 11 Oct 2023 06:16:33 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 as permitted sender) client-ip=23.128.96.31; Authentication-Results: mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=mebrz071; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by morse.vger.email (Postfix) with ESMTP id 062DB805F2DA; Wed, 11 Oct 2023 06:16:09 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at morse.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234972AbjJKNP4 (ORCPT + 99 others); Wed, 11 Oct 2023 09:15:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36552 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234958AbjJKNPy (ORCPT ); Wed, 11 Oct 2023 09:15:54 -0400 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id ACE2593 for ; Wed, 11 Oct 2023 06:15:52 -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=wylDPGSbHiTs2Q0e0qTsSFcSCa3RyAKkf9nWVpyjUCY=; b=mebrz071sEeYDPh0ZW+qz0ZUqG YdF8RkDeylhLVNWiJfMteUPHUpVlCv4WW3P3uCEFj7NoUjAf5WaeBOLDX0XTZLYn+OtL/+JpA7T/j PWJZ/ZupdCvw5rmm/0cKXDKwL+DUQ9cLvCMb7kyFrKoRezs9GD4LLkGBAJRsQ/0l7AhBceaAN71Hi 6ZPhbBGzfz0PQs3WOkNlaDcqcBZNVum4GyqoHcmm5gOZEBpZ2gGY4QSIuLOYkighRFFlHJIsxFdyW g/9oGE7j4qPELHoetP85krpMOeSm0JDVHZrG99N6opUzDUEnPaGNAGPGGEPIXxtgNL0UmzjzjJgjy ru1weJBw==; 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.94.2 #2 (Red Hat Linux)) id 1qqZ38-00AwZW-Sw; Wed, 11 Oct 2023 13:14:54 +0000 Received: by noisy.programming.kicks-ass.net (Postfix, from userid 1000) id 8BB9730036C; Wed, 11 Oct 2023 15:14:54 +0200 (CEST) Date: Wed, 11 Oct 2023 15:14:54 +0200 From: Peter Zijlstra To: Abel Wu Cc: Benjamin Segall , mingo@kernel.org, vincent.guittot@linaro.org, linux-kernel@vger.kernel.org, juri.lelli@redhat.com, dietmar.eggemann@arm.com, rostedt@goodmis.org, mgorman@suse.de, bristot@redhat.com, corbet@lwn.net, qyousef@layalina.io, chris.hyser@oracle.com, patrick.bellasi@matbug.net, pjt@google.com, pavel@ucw.cz, qperret@google.com, tim.c.chen@linux.intel.com, joshdon@google.com, timj@gnu.org, kprateek.nayak@amd.com, yu.c.chen@intel.com, youssefesmat@chromium.org, joel@joelfernandes.org, efault@gmx.de, tglx@linutronix.de Subject: Re: [PATCH] sched/fair: fix pick_eevdf to always find the correct se Message-ID: <20231011131454.GN14330@noisy.programming.kicks-ass.net> References: <20230531115839.089944915@infradead.org> <20230531124603.931005524@infradead.org> <6b606049-3412-437f-af25-a4c33139e2d8@bytedance.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <6b606049-3412-437f-af25-a4c33139e2d8@bytedance.com> X-Spam-Status: No, score=2.7 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, RCVD_IN_SBL_CSS,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on morse.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (morse.vger.email [0.0.0.0]); Wed, 11 Oct 2023 06:16:10 -0700 (PDT) X-Spam-Level: ** On Wed, Oct 11, 2023 at 08:12:09PM +0800, Abel Wu wrote: > The implementation of __pick_eevdf() now is quite complicated which > makes it really hard to maintain. I'm trying my best to refactor this > part, hopefully can do some help. Below is only for illustration, I > need to test more. Well, the form it has now is somewhat close to the one in the paper. I think Ben added one early break it doesn't have or something. As the paper explains, you get two walks, one down the eligibility path, and then one down the heap. I think the current code structure represents that fairly well. Very vague memories seem to suggest I thought to be clever some 10+ years ago when I wrote that other decent loop that Ben showed to be broken (and woe on me for not verifying it when I resurrected the patches, I rewrote pretty much everything else, except this lookup :/).