From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.2 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1929CC2D0A3 for ; Mon, 16 Nov 2020 16:43:00 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id DE2EA221F8 for ; Mon, 16 Nov 2020 16:42:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732215AbgKPQmj (ORCPT ); Mon, 16 Nov 2020 11:42:39 -0500 Received: from outbound-smtp45.blacknight.com ([46.22.136.57]:47783 "EHLO outbound-smtp45.blacknight.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731041AbgKPQmi (ORCPT ); Mon, 16 Nov 2020 11:42:38 -0500 Received: from mail.blacknight.com (pemlinmail03.blacknight.ie [81.17.254.16]) by outbound-smtp45.blacknight.com (Postfix) with ESMTPS id 58CA2FAF48 for ; Mon, 16 Nov 2020 16:42:36 +0000 (GMT) Received: (qmail 3516 invoked from network); 16 Nov 2020 16:42:36 -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 16:42:35 -0000 Date: Mon, 16 Nov 2020 16:42:32 +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: <20201116164232.GT3371@techsingularity.net> References: <20201116091054.GL3371@techsingularity.net> <20201116114938.GN3371@techsingularity.net> <20201116125355.GB3121392@hirez.programming.kicks-ass.net> <20201116125803.GB3121429@hirez.programming.kicks-ass.net> <20201116152946.GR3371@techsingularity.net> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-15 Content-Disposition: inline In-Reply-To: <20201116152946.GR3371@techsingularity.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 03:29:46PM +0000, Mel Gorman wrote: > I did, it was the on_cpu ordering for the blocking case that had me > looking at the smp_store_release and smp_cond_load_acquire in arm64 in > the first place thinking that something in there must be breaking the > on_cpu ordering. I'm re-reading it every so often while trying to figure > out where the gap is or whether I'm imagining things. > > Not fully tested but did not instantly break either > > diff --git a/kernel/sched/core.c b/kernel/sched/core.c > index d2003a7d5ab5..877eaeba45ac 100644 > --- a/kernel/sched/core.c > +++ b/kernel/sched/core.c > @@ -4459,14 +4459,26 @@ static void __sched notrace __schedule(bool preempt) > if (signal_pending_state(prev_state, prev)) { > prev->state = TASK_RUNNING; > } else { > - prev->sched_contributes_to_load = > + int acct_load = > (prev_state & TASK_UNINTERRUPTIBLE) && > !(prev_state & TASK_NOLOAD) && > !(prev->flags & PF_FROZEN); > > - if (prev->sched_contributes_to_load) > + prev->sched_contributes_to_load = acct_load; > + if (acct_load) { > rq->nr_uninterruptible++; > > + /* > + * Pairs with p->on_cpu ordering, either a > + * smp_load_acquire or smp_cond_load_acquire > + * in the ttwu path before ttwu_do_activate > + * p->sched_contributes_to_load. It's only > + * after the nr_interruptible update happens > + * that the ordering is critical. > + */ > + smp_wmb(); > + } > + > /* > * __schedule() ttwu() > * prev_state = prev->state; if (p->on_rq && ...) > This passed the test. Load averages taken once a minute after the test completed showed 950.21 977.17 990.69 1/853 2117 349.00 799.32 928.69 1/859 2439 128.18 653.85 870.56 1/861 2736 47.08 534.84 816.08 1/860 3029 17.29 437.50 765.00 1/865 3357 6.35 357.87 717.13 1/865 3653 2.33 292.74 672.24 1/861 3709 0.85 239.46 630.17 1/859 3711 0.31 195.87 590.73 1/857 3713 0.11 160.22 553.76 1/853 3715 With 5.10-rc3, it got stuck with a load average of 244 after the test completed even though the machine was idle. -- Mel Gorman SUSE Labs From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.2 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id C7658C4742C for ; Mon, 16 Nov 2020 16:43:09 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 66B3F20E65 for ; Mon, 16 Nov 2020 16:43:09 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="Ofi1bSIh" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 66B3F20E65 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=techsingularity.net Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References:Message-ID: Subject:To:From:Date:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=jZuI+vFw+q6+sAeE8URekBpg5BSGYoiCdfDRlPs7nJ4=; b=Ofi1bSIh0IaaCy0DowE+djcNp /dX2RUzRyRDAGJPoJtQiBmSB+IcphHlnzE7DelAX5uOqcTgph6JwqKmFlcpDrtkySpRjUc28iIOx2 IeH7U7p3qAjzmhuStGw7dkckcY38riwMl3sjZBel8eoJc1fDQXVdbr9ePjNU4IHXX1mNqkwYxV6/l WvrPmUVuA9IjZqLpe0ZZ38K5GkQ3M6w0n4UFUiwmTP0UG9qLVmvN2Y8c+7vgFQDaMDDg9Wf7W2tGs 5q8JCboxeQoUBYByJQh3wVx4Zst99iDrpve5Okie/V1IiOIl0IUq+nYZc1Q9axZjNZuGvW+c3q+Vp 0ecSuTPCQ==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kehaU-0000wJ-E7; Mon, 16 Nov 2020 16:42:44 +0000 Received: from outbound-smtp16.blacknight.com ([46.22.139.233]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kehaR-0000v9-CJ for linux-arm-kernel@lists.infradead.org; Mon, 16 Nov 2020 16:42:40 +0000 Received: from mail.blacknight.com (pemlinmail03.blacknight.ie [81.17.254.16]) by outbound-smtp16.blacknight.com (Postfix) with ESMTPS id 56D2F1C45DA for ; Mon, 16 Nov 2020 16:42:36 +0000 (GMT) Received: (qmail 3516 invoked from network); 16 Nov 2020 16:42:36 -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 16:42:35 -0000 Date: Mon, 16 Nov 2020 16:42:32 +0000 From: Mel Gorman To: Peter Zijlstra Subject: Re: Loadavg accounting error on arm64 Message-ID: <20201116164232.GT3371@techsingularity.net> References: <20201116091054.GL3371@techsingularity.net> <20201116114938.GN3371@techsingularity.net> <20201116125355.GB3121392@hirez.programming.kicks-ass.net> <20201116125803.GB3121429@hirez.programming.kicks-ass.net> <20201116152946.GR3371@techsingularity.net> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20201116152946.GR3371@techsingularity.net> User-Agent: Mutt/1.10.1 (2018-07-13) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20201116_114239_560160_0F1ADD6C X-CRM114-Status: GOOD ( 18.99 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Davidlohr Bueso , Will Deacon , linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Mon, Nov 16, 2020 at 03:29:46PM +0000, Mel Gorman wrote: > I did, it was the on_cpu ordering for the blocking case that had me > looking at the smp_store_release and smp_cond_load_acquire in arm64 in > the first place thinking that something in there must be breaking the > on_cpu ordering. I'm re-reading it every so often while trying to figure > out where the gap is or whether I'm imagining things. > > Not fully tested but did not instantly break either > > diff --git a/kernel/sched/core.c b/kernel/sched/core.c > index d2003a7d5ab5..877eaeba45ac 100644 > --- a/kernel/sched/core.c > +++ b/kernel/sched/core.c > @@ -4459,14 +4459,26 @@ static void __sched notrace __schedule(bool preempt) > if (signal_pending_state(prev_state, prev)) { > prev->state = TASK_RUNNING; > } else { > - prev->sched_contributes_to_load = > + int acct_load = > (prev_state & TASK_UNINTERRUPTIBLE) && > !(prev_state & TASK_NOLOAD) && > !(prev->flags & PF_FROZEN); > > - if (prev->sched_contributes_to_load) > + prev->sched_contributes_to_load = acct_load; > + if (acct_load) { > rq->nr_uninterruptible++; > > + /* > + * Pairs with p->on_cpu ordering, either a > + * smp_load_acquire or smp_cond_load_acquire > + * in the ttwu path before ttwu_do_activate > + * p->sched_contributes_to_load. It's only > + * after the nr_interruptible update happens > + * that the ordering is critical. > + */ > + smp_wmb(); > + } > + > /* > * __schedule() ttwu() > * prev_state = prev->state; if (p->on_rq && ...) > This passed the test. Load averages taken once a minute after the test completed showed 950.21 977.17 990.69 1/853 2117 349.00 799.32 928.69 1/859 2439 128.18 653.85 870.56 1/861 2736 47.08 534.84 816.08 1/860 3029 17.29 437.50 765.00 1/865 3357 6.35 357.87 717.13 1/865 3653 2.33 292.74 672.24 1/861 3709 0.85 239.46 630.17 1/859 3711 0.31 195.87 590.73 1/857 3713 0.11 160.22 553.76 1/853 3715 With 5.10-rc3, it got stuck with a load average of 244 after the test completed even though the machine was idle. -- Mel Gorman SUSE Labs _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel