Received: by 2002:a05:6a10:9e8c:0:0:0:0 with SMTP id y12csp519632pxx; Thu, 29 Oct 2020 08:04:37 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzoFBYv7XT5+tpjvFu1tni3CnoPsoiwfAJDrI3a/gS/WCHraaYP1pYmETrr9PqHOIjjri9V X-Received: by 2002:adf:fdc7:: with SMTP id i7mr6541693wrs.198.1603983875928; Thu, 29 Oct 2020 08:04:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1603983875; cv=none; d=google.com; s=arc-20160816; b=hPkxvYiwwSWsN9KoLSBYGQpLPz1bbZuCgTS94fdZn8alVVIzySeLQ8UorN0IDRXNEy YMatuBPJs9V5YUYZb8xKl9L9EvSzwPILw71hiFfALDLJLwqFxfsL97gjHxWozkDm9DH4 UvW5RchyQZl9bYgC7q90rIWIZcwgxagnnkEr2cLpDN/el7+2r6VWNNygT99YmDy19OIS D5RRxQeRS3tnDrEqye/abUd84qIXfTKDPSoQ4L2+qveyCQii3L0EhHr/TbK2AfdAuZrP /24PKGDpP7K5HD5tiERMathO8OgUC+50tH0pf2R2frfF23aJ0nmX2I7TdKfBQn3I1c3k ahpw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:message-id:date:references :in-reply-to:subject:cc:to:dkim-signature:dkim-signature:from; bh=pTsyIcVnDD6a7iWer5GKbvGB1SiRAC/OHn/Z/nzgsBM=; b=TBmJNEtdbFmC2skp73lj2KL0DMlGMZ4Z6nxtN4HnkQtd5fWHM6ggvx6fFKz351bkLL DlrJcaAh3tynBQ99k+w6jf9SnJHyhfQOVA+G0OqpIuIGJ3kW/N+1lfMux7jdOlXBHYc/ +/M6OxV6D8VTJkx0RtMapiV8TUe6BWURPtPmNQqlP08Z1ssSLAyAr7fAKTHLxkMMWy+Y KXmM5HUlcsWRkVvYbhqTGTbfy0wiUkErwJ8toXa5tVE24EmOUyPIL87rzvb4Q61CBs+k 2v4+0PWZksd73910iH4U6JgHW8rU35Rm2FnYSkteuZKN9qCeG4XMF7ipYzn3iU2vWN7Z 7xvw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=wzbC3+nJ; dkim=neutral (no key) header.i=@linutronix.de; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id y1si2049619edp.57.2020.10.29.08.04.10; Thu, 29 Oct 2020 08:04:35 -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=pass header.i=@linutronix.de header.s=2020 header.b=wzbC3+nJ; dkim=neutral (no key) header.i=@linutronix.de; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727864AbgJ2PCh (ORCPT + 99 others); Thu, 29 Oct 2020 11:02:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41970 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726375AbgJ2PCh (ORCPT ); Thu, 29 Oct 2020 11:02:37 -0400 Received: from galois.linutronix.de (Galois.linutronix.de [IPv6:2a0a:51c0:0:12e:550::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EE2CCC0613D2 for ; Thu, 29 Oct 2020 08:01:47 -0700 (PDT) From: Thomas Gleixner DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1603983706; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=pTsyIcVnDD6a7iWer5GKbvGB1SiRAC/OHn/Z/nzgsBM=; b=wzbC3+nJdulBhl05Zn6UXjTe+7dRCQC0QsOeeoH655yD/ZusW9UPH3l1lxQvmPTt5xOjm9 HvuSHjhNY09Be+wx6X3EtVHVwSQglJDnSf3Tk47RGuW/QVcsp7aLe+RoNdYWMWh/FE2fHp fK+XhyIvlkrjEAqy6jpMh3OBc40PQDeGwlxoRUapDyIjBBoLaYixpFOnSHdmsgqMZLt+wC FoaG7Urk62MYqQ1gRU7UhJugEJx/nkk842XFnnRplvRyY+zaqARvNjDhPkfvQgIdWiIbFS UxR65aBWAWqtDzNdG4wuP2DpJmCFTNHKQHJjzXJnaGNdQSfjudi28+mLnY96/w== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1603983706; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=pTsyIcVnDD6a7iWer5GKbvGB1SiRAC/OHn/Z/nzgsBM=; b=ayt7gsTDXllXYCrfopjZCoP2aGe3djg+/6dr3HBdW/DejAF6a4j0c+A2XH7cL08jEXIcMM aOFZbQKQK2NeZdBQ== To: Petr Mladek Cc: "Zhang\, Qiang" , "tj\@kernel.org" , "akpm\@linux-foundation.org" , "linux-mm\@kvack.org" , "linux-kernel\@vger.kernel.org" Subject: Re: [PATCH v2] kthread_worker: re-set CPU affinities if CPU come online In-Reply-To: <20201029130818.GC16774@alley> References: <20201028073031.4536-1-qiang.zhang@windriver.com> <874kme21nv.fsf@nanos.tec.linutronix.de> <871rhi1z7j.fsf@nanos.tec.linutronix.de> <874kmdfndd.fsf@nanos.tec.linutronix.de> <20201029130818.GC16774@alley> Date: Thu, 29 Oct 2020 16:01:46 +0100 Message-ID: <87pn51dqjp.fsf@nanos.tec.linutronix.de> MIME-Version: 1.0 Content-Type: text/plain Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Oct 29 2020 at 14:08, Petr Mladek wrote: > On Thu 2020-10-29 09:27:26, Thomas Gleixner wrote: >> The expected semantics of a cpu bound kthread_worker are completely >> unclear and undocumented. This needs to be fixed first and once this is >> established and agreed on then the gaps in the implementation can be >> closed. > > I thought about some sane semantic and it goes down to > the following problem: > > The per-CPU kthread workers are created by explicitly calling > kthread_create_worker_on_cpu() on each CPU. > > The API does _not_ store the information how to start the worker. > As a result, it is not able to start a new one when the CPU > goes online "for the first time". I mean when the CPU was offline > when the API user created the workers. > > It means that the API user is responsible for handling CPU hotplug > on its own. We probably should just document it and do nothing else [*] > [*] IMHO, it does not even make sense to manipulate the affinity. > It would just give a false feeling that it is enough. Agreed on both. > Alternative solution would be to extend the API and allow to create > kthread_worker on each online CPU. It would require to store > parameters needed to create the kthread only new online CPUs. > Then we might think about some sane semantic for CPU hotplug. That facility already exists: smpboot_register_percpu_thread() So "all" you'd need to do is to provide a kthread_worker variant which utilizes that. It's straight forward, but not sure whether it's worth the trouble. > Well, it might be hard to define a sane semantic unless there are > more users of the API. So, I tend to keep it simple and just > document the status quo. Ack. Thanks, tglx