Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp368049pxk; Fri, 11 Sep 2020 09:04:34 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz2ZjZPxbdERivGOJOoXptcph6it7nucHG3AssGX5C05W3s3fPxLWWrFFrYf2vcpjn0SF3f X-Received: by 2002:aa7:c9ce:: with SMTP id i14mr2949812edt.186.1599840274066; Fri, 11 Sep 2020 09:04:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1599840274; cv=none; d=google.com; s=arc-20160816; b=RrQoa+XiAxSBfmDkKTLczz2sefyvNopFn9G5juHzuZHNX1dvlZyUO006THZnIPlExY PfcnAuNgBWDywLU6ApwyB+xG3m9u0qobVZlNfYKHPxQAE8+/mqFfJJvHabV1vsufckEx t51mDu7ENXrJzAYPkAuHx0I1cXkIXuBeRtWXCjKAyuyUG3LHsN52m1Ttb7W1TJQWi7pp jcOesZ0qvFo3fTMoEEsYasZ6bHqA9Zkz4dKkKdJ2/JaW7MGW4FvAdLUEm53jW919dEv+ SfAEX4qZiHv99X4M8lh/u/p8lv7L3oxi0jQtqk1JlBlhYmHNoinTwojhAZVfnGd9aCXI uVYQ== 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=kV/mM/HrIvubyiP1xC+e66CxhCWPeOydinCQRnwq7OI=; b=HpllyJIpXMEK3PRk0SVDNEhujpe0s/ooJJCnCNeZLvFJhOUY44k7zcWRUpteX4UZaE kNDXY3U9LRw7TiORTmFd61xy2/LaaQG95e1IeSp8ClYN6Q5sXpTQituIoDM0tkDGress 7T9rOHo4blPjpB5VrodRLrs8fNjiIY2ljBzHK+had5B9+g9SUMIpHmUVOg7pnx7SnuIP xzPktP2cwPCos1ZhXhliBATmQTXuDNrSjFO+y+shFyTvlT9fh1d8ZQgTK6PL3bOhYsKU q4NAqN/TZRwUE7zGD62KkZMMH2VddP9j7RWxm5aj6fTiwmglVtFhJ/A7RiBrWDOhQd99 PAhQ== 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 c13si1508177edv.328.2020.09.11.09.04.10; Fri, 11 Sep 2020 09:04:34 -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; 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 S1726205AbgIKQDC (ORCPT + 99 others); Fri, 11 Sep 2020 12:03:02 -0400 Received: from foss.arm.com ([217.140.110.172]:37906 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726580AbgIKQAS (ORCPT ); Fri, 11 Sep 2020 12:00:18 -0400 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 50DA5106F; Fri, 11 Sep 2020 06:48:54 -0700 (PDT) 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 F41E53F73C; Fri, 11 Sep 2020 06:48:52 -0700 (PDT) References: <20200911081745.214686199@infradead.org> <20200911082536.528661716@infradead.org> <20200911122922.GJ1362448@hirez.programming.kicks-ass.net> User-agent: mu4e 0.9.17; emacs 26.3 From: Valentin Schneider To: peterz@infradead.org Cc: mingo@kernel.org, vincent.guittot@linaro.org, tglx@linutronix.de, linux-kernel@vger.kernel.org, dietmar.eggemann@arm.com, rostedt@goodmis.org, bristot@redhat.com, swood@redhat.com, Vincent Donnefort Subject: Re: [PATCH 2/2] sched/hotplug: Ensure only per-cpu kthreads run during hotplug In-reply-to: <20200911122922.GJ1362448@hirez.programming.kicks-ass.net> Date: Fri, 11 Sep 2020 14:48:50 +0100 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 11/09/20 13:29, peterz@infradead.org wrote: > On Fri, Sep 11, 2020 at 01:17:45PM +0100, Valentin Schneider wrote: > >> > @@ -6968,6 +7064,8 @@ int sched_cpu_deactivate(unsigned int cp >> > */ >> > synchronize_rcu(); >> > >> > + balance_push_set(cpu, true); >> > + >> >> IIUC this is going to make every subsequent finish_lock_switch() >> migrate the switched-to task if it isn't a pcpu kthread. So this is going >> to lead to a dance of >> >> switch_to() -> switch_to() -> switch_to() -> switch_to() ... >> >> Wouldn't it be better to batch all those in a migrate_tasks() sibling that >> skips pcpu kthreads? > > That's 'difficult', this is hotplug, performance is not a consideration. > Aye aye. The reason I'm trying to care about this is (don't wince too hard) for that CPU pause thing [1]. Vincent's been the one doing all the actual work so I should let him pitch in, but TL;DR if we could "relatively quickly" migrate all !pcpu tasks after clearing the active bit, we could stop hotplug there and have our "CPU pause" thing. [1]: https://lwn.net/Articles/820825/ > Basically we don't have an iterator for the runqueues, so finding these > tasks is hard. Mmph right, we'd pretty much have to "enjoy" iterating & skipping pcpu threads every __pick_migrate_task() call...