Received: by 2002:a05:6a10:16a7:0:0:0:0 with SMTP id gp39csp3063988pxb; Mon, 16 Nov 2020 05:02:30 -0800 (PST) X-Google-Smtp-Source: ABdhPJw8JJHW91S8DTGm9FqYAiHnI+6b7/pw60GEbOJlTcZEU8YjVf9fuzJeYDkD4l3mxX2McgX4 X-Received: by 2002:a05:6402:3066:: with SMTP id bs6mr15201306edb.79.1605531750448; Mon, 16 Nov 2020 05:02:30 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1605531750; cv=none; d=google.com; s=arc-20160816; b=u1/OKx0WcsxH0rOUdeWCAazLqArapnRTOrT0J9pucn650zSm5sP9R2Vels6ylxGBi1 Fz7h86yoFpi+VbEBnn0XZPPTrEQhqlJhMADUuMY7LRzDNzN+yaTRsM6Xe4suSs0Gf6NS 50QmZeqYlr8E+ES0nqUfpYEnvwQmddx35dIaeWNz9MBODSV54GINQ5aEsDJwSqAOWtEO /tR4jkB1inIXg6YETXscaynfuhU3sBu4RTZriMAZJWDvB6Nrz7LkH0zf3OBTcOoU8uDv 6PJ/zNjvhcZKTJ3iDCsun8w+m52r3lpfjQO2DC3h3Alif2PN3xHVJyYgKrJ7jdq7WQEY ZOlg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date; bh=1p5GfTxNDbzNw3oXrI72JBQqQEqnAuRHJYx3+bofXr8=; b=h3fGC5jehwph2F4g47IpIcFkpufjaHyLnPMOjpGVB8jZiamD+U0Ef3I8qmXtn8BU+c jDt3gQZ11B3N8T3kqbxjiFxmNltSRmghcN4yspWW66hw19pr7PJaG+0+2j/ljUvl9m2W GC49nIgO++FrGq71S1fy7jDfPKuI5tYlyCrAzBwxPlYfzM3jiwxR2F74qkFBow5aSQLE KWuD/AJL0+lf67ZKTyRtw9x4vE39cNt8aevNlEt6zZdxk4sUYetpuZd9ovyyI8tsMyja 9WzbNW3BwMIqiVZf04rngv2xMm2b2ZkOvXyacZoLTU6N3jn2OleLxvQedWadyxBJ/MkI rpzA== ARC-Authentication-Results: i=1; mx.google.com; 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 u23si11978889ejj.163.2020.11.16.05.02.05; Mon, 16 Nov 2020 05:02:30 -0800 (PST) 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; 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 S1727820AbgKPM6O (ORCPT + 99 others); Mon, 16 Nov 2020 07:58:14 -0500 Received: from outbound-smtp55.blacknight.com ([46.22.136.239]:57543 "EHLO outbound-smtp55.blacknight.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727740AbgKPM6O (ORCPT ); Mon, 16 Nov 2020 07:58:14 -0500 Received: from mail.blacknight.com (pemlinmail02.blacknight.ie [81.17.254.11]) by outbound-smtp55.blacknight.com (Postfix) with ESMTPS id 7F27DFA9A8 for ; Mon, 16 Nov 2020 12:58:12 +0000 (GMT) Received: (qmail 17723 invoked from network); 16 Nov 2020 12:58:12 -0000 Received: from unknown (HELO techsingularity.net) (mgorman@techsingularity.net@[84.203.22.4]) by 81.17.254.9 with ESMTPSA (AES256-SHA encrypted, authenticated); 16 Nov 2020 12:58:11 -0000 Date: Mon, 16 Nov 2020 12:58:09 +0000 From: Mel Gorman To: Peter Zijlstra Cc: Will Deacon , Davidlohr Bueso , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: Re: Loadavg accounting error on arm64 Message-ID: <20201116125809.GP3371@techsingularity.net> References: <20201116091054.GL3371@techsingularity.net> <20201116124657.GA3121392@hirez.programming.kicks-ass.net> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-15 Content-Disposition: inline In-Reply-To: <20201116124657.GA3121392@hirez.programming.kicks-ass.net> User-Agent: Mutt/1.10.1 (2018-07-13) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Nov 16, 2020 at 01:46:57PM +0100, Peter Zijlstra wrote: > On Mon, Nov 16, 2020 at 09:10:54AM +0000, Mel Gorman wrote: > > Similarly, it's not clear why the arm64 implementation > > does not call smp_acquire__after_ctrl_dep in the smp_load_acquire > > implementation. Even when it was introduced, the arm64 implementation > > differed significantly from the arm implementation in terms of what > > barriers it used for non-obvious reasons. > > This is because ARM64's smp_cond_load_acquire() implementation uses > smp_load_aquire() directly, as opposed to the generic version that uses > READ_ONCE(). > > This is because ARM64 has a load-acquire instruction, which is highly > optimized, and generally considered cheaper than the smp_rmb() from > smp_acquire__after_ctrl_dep(). > > Or so I've been led to believe. Fair enough. Either way, barriering sched_contributes_to_load "works" but it's clumsy and may not be guaranteed to be correct. The bits should have been protected by the rq lock but sched_remote_wakeup updates outside of the lock which might be leading to the adject fields (like sched_contributes_to_load) getting corrupted as per the "anti guarantees" in memory-barriers.txt. The rq lock could be conditionally acquired __ttwu_queue_wakelist for WF_MIGRATED and explicitly cleared in sched_ttwu_pending (not tested if this works) but it would also suck to acquire a remote lock when that's what we're explicitly trying to avoid in that path. -- Mel Gorman SUSE Labs