Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id DE6FCC64ED8 for ; Mon, 27 Feb 2023 17:00:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230364AbjB0RA2 (ORCPT ); Mon, 27 Feb 2023 12:00:28 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40610 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230335AbjB0RAQ (ORCPT ); Mon, 27 Feb 2023 12:00:16 -0500 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 70E7C1CACE for ; Mon, 27 Feb 2023 09:00:13 -0800 (PST) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id F0BE7C14; Mon, 27 Feb 2023 09:00:55 -0800 (PST) Received: from [192.168.178.6] (unknown [172.31.20.19]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id EF8433F881; Mon, 27 Feb 2023 09:00:10 -0800 (PST) Message-ID: Date: Mon, 27 Feb 2023 18:00:09 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.7.1 Subject: Re: [PATCH v3] sched/fair: sanitize vruntime of entity being placed Content-Language: en-US To: Vincent Guittot , Roman Kagan , Peter Zijlstra , linux-kernel@vger.kernel.org, Valentin Schneider , Zhang Qiao , Ben Segall , Waiman Long , Steven Rostedt , Mel Gorman , Daniel Bristot de Oliveira , Ingo Molnar , Juri Lelli References: <20230209193107.1432770-1-rkagan@amazon.de> From: Dietmar Eggemann In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 27/02/2023 15:37, Vincent Guittot wrote: > On Mon, 27 Feb 2023 at 09:43, Roman Kagan wrote: >> >> On Tue, Feb 21, 2023 at 06:26:11PM +0100, Vincent Guittot wrote: >>> On Tue, 21 Feb 2023 at 17:57, Roman Kagan wrote: >>>> What scares me, though, is that I've got a message from the test robot >>>> that this commit drammatically affected hackbench results, see the quote >>>> below. I expected the commit not to affect any benchmarks. >>>> >>>> Any idea what could have caused this change? >>> >>> Hmm, It's most probably because se->exec_start is reset after a >>> migration and the condition becomes true for newly migrated task >>> whereas its vruntime should be after min_vruntime. >>> >>> We have missed this condition >> >> Makes sense to me. >> >> But what would then be the reliable way to detect a sched_entity which >> has slept for long and risks overflowing in .vruntime comparison? > > For now I don't have a better idea than adding the same check in > migrate_task_rq_fair() Don't we have the issue that we could have a non-up-to-date rq clock in migrate? No rq lock held in `!task_on_rq_migrating(p)`. Also deferring `se->exec_start = 0` from `migrate` into `enqueue -> place entity` doesn't seem to work since the rq clocks of different CPUs are not in sync.