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=-3.9 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=no 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 33D8DC4363A for ; Thu, 29 Oct 2020 15:02:22 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 7EC7020756 for ; Thu, 29 Oct 2020 15:02:21 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="wzbC3+nJ"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="ayt7gsTD" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 7EC7020756 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linutronix.de Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id B3FE96B0070; Thu, 29 Oct 2020 11:02:20 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id AC8606B0071; Thu, 29 Oct 2020 11:02:20 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 98FAE6B0073; Thu, 29 Oct 2020 11:02:20 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0039.hostedemail.com [216.40.44.39]) by kanga.kvack.org (Postfix) with ESMTP id 69E6B6B0070 for ; Thu, 29 Oct 2020 11:02:20 -0400 (EDT) Received: from smtpin01.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id F0C5F824999B for ; Thu, 29 Oct 2020 15:02:19 +0000 (UTC) X-FDA: 77425278840.01.slave17_521566f2728e Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin01.hostedemail.com (Postfix) with ESMTP id 4C9F01004AF9E for ; Thu, 29 Oct 2020 15:01:49 +0000 (UTC) X-HE-Tag: slave17_521566f2728e X-Filterd-Recvd-Size: 4079 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) by imf43.hostedemail.com (Postfix) with ESMTP for ; Thu, 29 Oct 2020 15:01:48 +0000 (UTC) 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 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: 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