Received: by 2002:a25:c205:0:0:0:0:0 with SMTP id s5csp1362489ybf; Thu, 27 Feb 2020 09:31:20 -0800 (PST) X-Google-Smtp-Source: APXvYqxefRmIgpXf6XjtZ+QGFFtaZbD/+VXYT+Beh57vehsq4QkgPJ3QRyCUf+bprT0we3rjjQuG X-Received: by 2002:a9d:3df6:: with SMTP id l109mr12188otc.284.1582824679906; Thu, 27 Feb 2020 09:31:19 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1582824679; cv=none; d=google.com; s=arc-20160816; b=ur+cXAjl4kYKszTVe430/sVUEV4Yv4B0ZFDKSoRzK63F0tZSRb8NQfD1qPYwQ9JNs2 bfFnY7Fp9Zatny/6Vtd2Z7hUzlPdIyVpTioLQLYBzplWV+c7ph/LQRbsDYJYctNkBzLZ bKmoc0YxDttrym10yRBZq2eBMyV/Ic+7mMfVpjK0cLWWQ+twUHqIHTqpkBpKu36q+nu8 TMLZ6tNAoooxLYnVlfpPEnklAFQwib4U0lP1G5esdDsqJzJx9MkRmGFrstkvZXhn+3gS qLtsVhlXeBdnLUlM1w1fuV3e/ccS0IFB3fjFbpUXvTsG+8aZv6dEqL7spkrf28922faQ v43Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:message-id:date:in-reply-to :subject:cc:to:from:user-agent:references; bh=8jdxT0hpBNi21QRrN7kHzWNo1tVooHunSxJmpEdPBA0=; b=UYup9+jPdzMCdJu4TGiDrJnkWUlk5J93UoBmFVbHPYGxbxYESQJv0Ivq3UztnxZ1QS 7fl3LM324Ce88NEkpt1HNs1BYANFJ/QgWRiKrisvpEM8Wk0+KQARK9tv9shczArTboCW NWkPR7xyc6WFQBDEINPmZh6ZVYb1fFSjBd4qZrOhAfyidM17wDsRyQtx0hH653/LZ/0o fS6M8Ae3QUmb8lSUM4oTanKZFqQSjF0cSdAkCrrOql+ljrz6kD1fLC6pjN8M9unMydmq hCBS5EGbIJL1cp85i4NVbrsti0oOTfSkXyBkWZcs1ShEq8V7JwdYIoY8280BWGVW8YaB N6vQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id l63si261463oig.123.2020.02.27.09.31.08; Thu, 27 Feb 2020 09:31:19 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730247AbgB0Rax (ORCPT + 99 others); Thu, 27 Feb 2020 12:30:53 -0500 Received: from foss.arm.com ([217.140.110.172]:55242 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729948AbgB0Raw (ORCPT ); Thu, 27 Feb 2020 12:30:52 -0500 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 3C50C1FB; Thu, 27 Feb 2020 09:30:52 -0800 (PST) Received: from e113632-lin (e113632-lin.cambridge.arm.com [10.1.194.46]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 1E41E3F73B; Thu, 27 Feb 2020 09:30:51 -0800 (PST) References: <1582812549.7365.134.camel@lca.pw> <1582814862.7365.135.camel@lca.pw> <1582821327.7365.137.camel@lca.pw> <1582822024.7365.139.camel@lca.pw> <20200227171934.GI3818@techsingularity.net> User-agent: mu4e 0.9.17; emacs 26.3 From: Valentin Schneider To: Mel Gorman Cc: Qian Cai , Ingo Molnar , Peter Zijlstra , Juri Lelli , Steven Rostedt , paulmck@kernel.org, linux-kernel@vger.kernel.org Subject: Re: suspicious RCU due to "Prefer using an idle CPU as a migration target instead of comparing tasks" In-reply-to: <20200227171934.GI3818@techsingularity.net> Date: Thu, 27 Feb 2020 17:30:40 +0000 Message-ID: MIME-Version: 1.0 Content-Type: text/plain Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Feb 27 2020, Mel Gorman wrote: > Thanks for reporting this! > > The proposed fix would be a lot of rcu locks and unlocks. While they are > cheap, they're not free and it's a fairly standard pattern to acquire > the rcu lock when scanning CPUs during a domain search (load balancing, > nohz balance, idle balance etc). While in this context the lock is only > needed for SMT, I do not think it's worthwhile fine-graining this or > conditionally acquiring the rcu lock so will we keep it simple? > > > diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c > index 11cdba201425..d34ac4ea5cee 100644 > --- a/kernel/sched/fair.c > +++ b/kernel/sched/fair.c > @@ -1592,6 +1592,7 @@ static void update_numa_stats(struct task_numa_env *env, > memset(ns, 0, sizeof(*ns)); > ns->idle_cpu = -1; > > + rcu_read_lock(); > for_each_cpu(cpu, cpumask_of_node(nid)) { > struct rq *rq = cpu_rq(cpu); > > @@ -1611,6 +1612,7 @@ static void update_numa_stats(struct task_numa_env *env, > idle_core = numa_idle_core(idle_core, cpu); > } > } > + rcu_read_unlock(); > > ns->weight = cpumask_weight(cpumask_of_node(nid)); > That's closer to what I was trying to suggest (i.e. broaden the section rather than reduce it).