Received: by 2002:a05:6a10:9e8c:0:0:0:0 with SMTP id y12csp434326pxx; Thu, 29 Oct 2020 06:13:16 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzpMQxgYOpeWc8sdBQxIjoJCOo+e92xkV6SzUjy8HPsIKuXmkGlyaXe7PWlynLV9i1A+M45 X-Received: by 2002:a17:906:3789:: with SMTP id n9mr4059658ejc.273.1603977195835; Thu, 29 Oct 2020 06:13:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1603977195; cv=none; d=google.com; s=arc-20160816; b=qE7zv5zowFZMzztq7DrjL/X7fIH9O12ro5HWF/ssyG4++sYI1T+3sYLwb3HBTvW8fX kLekFXR9pOFTenHH8wzWz/RolvGBap4UoYVjZTHltvXBaT74kfwkVtwWPggbvvJv/WnA IZP0xlBtuQmZ85NSsfQnxAcYiAJi1Ly8JTRuMDxyt3zqqX9zCXsZSlx60VRw0HqKsQ2B VcHb7KcnOQMrSAAMte6rP97Ypeyj5gQATDGIegKaw3Oz/r3DbaveigOPPDQiHcnFQrYM xnAcKqOc37qW1eekPd6HBiGmGTK0arNNLAdpcf4etKcaSfP+zM1zLS6ovh/iFJbxrsBM hcjA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=qW8sAaNoNwfxzYhk+EkdOmpVblS2Sq1VgsLtN6wfi/U=; b=kN1F74eLfN3SJD8+M+QgMqwJKi5YU2XREYak7S/59TT2FudqzUeGARF2qM6/SPSgEZ QrR/9J756OngwxpwjZcBenEkTn8XCXqJrynh5IqHgdhMCcmiD6qPwxml/xmdvmnKYqbm lgKWNXkjuayvN3PXvDBrGCZIi7Q6VYFBOouF6tUwiTE29ExfIUc477qqNXQqK9Y9s4lx 3udQFNp59pKgj0z/d4t7fIKcTaqtGDIzNy1rId3PnAIU0oLQ1BSB5FMmp2aQNQvdGdcL 89e9oCwmm9wMguqPIqXqNowh1eMqvPl5uxqolux+vNcaog2bEZ8eV2rsy52cjML+YTr4 4DIw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.com header.s=susede1 header.b=qB5H84Ro; 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=NONE dis=NONE) header.from=suse.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id n13si1759594eji.447.2020.10.29.06.12.50; Thu, 29 Oct 2020 06:13:15 -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=@suse.com header.s=susede1 header.b=qB5H84Ro; 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=NONE dis=NONE) header.from=suse.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726073AbgJ2NIW (ORCPT + 99 others); Thu, 29 Oct 2020 09:08:22 -0400 Received: from mx2.suse.de ([195.135.220.15]:59432 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725554AbgJ2NIV (ORCPT ); Thu, 29 Oct 2020 09:08:21 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1603976899; 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=qW8sAaNoNwfxzYhk+EkdOmpVblS2Sq1VgsLtN6wfi/U=; b=qB5H84Ro4kMRHNMfnMv0jg/PKVI4gMgv8QZJU+uFc7jqamugdPOHIFKYqNTKKuNiNbFoRF OO47fBqgC/Yo9GR+wLIiKMDJj+SifNWtVTNUHHlIH28feimEdIQP3MULwTm4s9up4YCGLs uagj0sYwd14Pyi3E+38Rhnzzu6JwVOo= Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id C7D36B8F3; Thu, 29 Oct 2020 13:08:19 +0000 (UTC) Date: Thu, 29 Oct 2020 14:08:18 +0100 From: Petr Mladek To: Thomas Gleixner 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 Message-ID: <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> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <874kmdfndd.fsf@nanos.tec.linutronix.de> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 [*] 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. 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. Any ideas? [*] IMHO, it does not even make sense to manipulate the affinity. It would just give a false feeling that it is enough. Best Regards, Petr