Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp2151065ybt; Fri, 3 Jul 2020 02:05:17 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwE45STKNvV5GypjMv4Apzg6acvFuqawYl/92hG2WigqWCDdM1cGkPaed+1btYH0eAz0epD X-Received: by 2002:a17:906:ca43:: with SMTP id jx3mr20233917ejb.208.1593767117064; Fri, 03 Jul 2020 02:05:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1593767117; cv=none; d=google.com; s=arc-20160816; b=zwbLe9aUasHLx3eX6bbQLRJUbEmpS8LMM3iPNqTWe/CR957OE9HAvoI/cZid95x4/V ilV7FiwWyUKmlWMFD+ZzdxoHdwmxHBQV2u4hQv3A0BO6a1JgoFny05luN2WR10qFoQt/ DejbzCZR44fEY9dRMqr1izev6WobnDCQLWH+6V09O60ix6Hwtj0cutbYRhw9vD9PW0pj f7VlKSsWnZWkgrGqgeoyea5sLV/j/pqJmZiqSdBaNCbRYbTN7/R9ZnciG9XnRoHgC3ko 6qgFI+OUF/DRkEFelpDHhzqqfoCwA4w8dkQR+bOrO5bAPY6kJpdPCBu+vd4kPbRWjksh Ns5g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=TR87TYbOJPVddeAI363WO0ZDHvRAdSQLPveW9L3ReRs=; b=GYY6mL4eDDPmf9nRnlqdQniCC/CnTpG5dd+C0Alu6VPwsZfhgk9EgBIk0/iJNqhpRq 47s6BjkhODufZvXCPGWGDmKyy2pQQxR/8uFzNgZTLjuiW9TMWQaUVBIJYcgeICUz5ov3 eU9LNMwdhQcSRhwW7WqzMv6jz1HmYDimV5unmx+dUSzUcPF/CYD/tOxKnOYCD34lhk4x gw4lodmxy/mZlyyiMpJus+ahr47TYDafjwVsBjdBC5e+72RndZUJIAhEBdEDJ/qGtqEP JNGRwE8iHcrqFaQcBXBRo73mGcn4TlYTKd2B8/sga0a2NHYKPKrmJ8c1LN6qfdnHtIKR KfsA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=merlin.20170209 header.b=EmuP6Jyo; 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 g19si8351198edv.174.2020.07.03.02.04.53; Fri, 03 Jul 2020 02:05:17 -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=fail header.i=@infradead.org header.s=merlin.20170209 header.b=EmuP6Jyo; 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 S1725891AbgGCJCg (ORCPT + 99 others); Fri, 3 Jul 2020 05:02:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49392 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725648AbgGCJCg (ORCPT ); Fri, 3 Jul 2020 05:02:36 -0400 Received: from merlin.infradead.org (merlin.infradead.org [IPv6:2001:8b0:10b:1231::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2EA74C08C5C1 for ; Fri, 3 Jul 2020 02:02:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=merlin.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=TR87TYbOJPVddeAI363WO0ZDHvRAdSQLPveW9L3ReRs=; b=EmuP6JyoP5AddLYU++0xWDDucU ntbrGzdXGCS+xNvFO2WA2oLfnCSWM59oEAJdgE8sCJEIrspjrt4r3m0NOB6EzSXlGA+dAmzuzodmM Risqb2jO4BoCCPefwNMFL32Cx2Q/ZNPsIYm96WFV/JEiLyYIVt3iHWwDr6dKMync+U5njxwb+/oXL m1ixu1aMg4OZfZMuN1FoM4YLX966QDH0W0RT6HN8/H5HlsUh3BYBc/aQySqYc/9Fiypp9liLJjhYS k+ujxk6zguXFzNNZyIY0wjdELxtX6OWT4UPVaPK3jQN3bLTKAkwXfMfGsVbLMv/CESw4BFRzMlw/x elNKp5qg==; Received: from j217100.upc-j.chello.nl ([24.132.217.100] helo=noisy.programming.kicks-ass.net) by merlin.infradead.org with esmtpsa (Exim 4.92.3 #3 (Red Hat Linux)) id 1jrHaY-0003ar-1J; Fri, 03 Jul 2020 09:02:30 +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 318E8301124; Fri, 3 Jul 2020 11:02:26 +0200 (CEST) Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id 18CAB2010865A; Fri, 3 Jul 2020 11:02:26 +0200 (CEST) Date: Fri, 3 Jul 2020 11:02:26 +0200 From: Peter Zijlstra To: Mel Gorman Cc: Dave Jones , Linux Kernel , mingo@kernel.org, Linus Torvalds Subject: Re: weird loadavg on idle machine post 5.7 Message-ID: <20200703090226.GV4800@hirez.programming.kicks-ass.net> References: <20200702171548.GA11813@codemonkey.org.uk> <20200702213627.GF3183@techsingularity.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200702213627.GF3183@techsingularity.net> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Jul 02, 2020 at 10:36:27PM +0100, Mel Gorman wrote: > > commit c6e7bd7afaeb3af55ffac122828035f1c01d1d7b (refs/bisect/bad) > > Author: Peter Zijlstra > Peter, I'm not supremely confident about this but could it be because > "p->sched_contributes_to_load = !!task_contributes_to_load(p)" potentially > happens while a task is still being dequeued? In the final stages of a > task switch we have > > prev_state = prev->state; > vtime_task_switch(prev); > perf_event_task_sched_in(prev, current); > finish_task(prev); > > finish_task is when p->on_cpu is cleared after the state is updated. > With the patch, we potentially update sched_contributes_to_load while > p->state is transient so if the check below is true and ttwu_queue_wakelist > is used then sched_contributes_to_load was based on a transient value > and potentially wrong. I'm not seeing it. Once a task hits schedule(), p->state doesn't change, except through wakeup. And while dequeue depends on p->state, it doesn't change it. At this point in ttwu() we know p->on_rq == 0, which implies dequeue has started, which means we've (at least) stopped executing the task -- we started or finished schedule(). Let me stare at this more...