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 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id B4A2AC3DA7F for ; Mon, 5 Aug 2024 23:59:53 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 41B3A6B0083; Mon, 5 Aug 2024 19:59:53 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 3CAC26B0085; Mon, 5 Aug 2024 19:59:53 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 26BC56B0088; Mon, 5 Aug 2024 19:59:53 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id 071D56B0083 for ; Mon, 5 Aug 2024 19:59:53 -0400 (EDT) Received: from smtpin19.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id B651F81DCE for ; Mon, 5 Aug 2024 23:59:52 +0000 (UTC) X-FDA: 82419862224.19.642DF62 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by imf21.hostedemail.com (Postfix) with ESMTP id 0D8EA1C001A for ; Mon, 5 Aug 2024 23:59:50 +0000 (UTC) Authentication-Results: imf21.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=NzVbKjsL; spf=pass (imf21.hostedemail.com: domain of frederic@kernel.org designates 139.178.84.217 as permitted sender) smtp.mailfrom=frederic@kernel.org; dmarc=pass (policy=none) header.from=kernel.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1722902308; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=ULCc4UIU4iK5YJUQVVz4ovT6t20fnS5LRf+sHFeDbLg=; b=EhbMNNfwIu04dsa4Yy1wlDS/LNEIBxsfWR1aJd2mjSNw8ehAIg1E/8vpsF+a5i+sVvwbGJ 25z3tNr/gKzgwxLCzqgjbNmCZVwfFV9pFa6Z/19F8TWP6BLHlgpwxaU6lHNLlo94ul7ApE xW28/zDQ3V8gLzdy8iBAyOtBcxrDVgQ= ARC-Authentication-Results: i=1; imf21.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=NzVbKjsL; spf=pass (imf21.hostedemail.com: domain of frederic@kernel.org designates 139.178.84.217 as permitted sender) smtp.mailfrom=frederic@kernel.org; dmarc=pass (policy=none) header.from=kernel.org ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1722902308; a=rsa-sha256; cv=none; b=Z5xUyPhUgMLn4C4Oa+T36W5JS4Mal6R9BTGGUD6ijm2PiMGiSPdN00E1Qm4jL18psHoVAB DbvJmn4FC4WQkzAC2SOHmtRt2L8CV5hKQzXvECI+jHcxVCa9nkEj6cqOgi8OO8Q9MltG9v Rr3EUSj0bqZhMOYnWydy4gKahYsV6Xo= Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by dfw.source.kernel.org (Postfix) with ESMTP id D46D060C63; Mon, 5 Aug 2024 23:59:49 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 18476C32782; Mon, 5 Aug 2024 23:59:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1722902389; bh=qPipzIqpOFeYTGpyUGvCyLbP2YXb2Z1WH0dgber+cC4=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=NzVbKjsLb08FPak/EQhMiOfmR6o9vTANUK5rqxkhBNJhzxpkEzV1Ht4LK7ubkyJa9 pua2YfKNs5pXY74XcqQ3itgR2ZwwlCrheSmoPcnL4Po+FCOVr2hbKPGx3jM70xjLwR zYYxGXnuxSeGZ3MvOZSetPkRoTMZnFPfZ8zKGzPA3W7l6lIDQKLWYK2vyFVeXtDolZ e+kNoH2iDiTaQzcp+zVBQLyPpahu+SNI0fjlNeCySEYe/U1cuLJXo/8hKN1rjE/8QP gxHSM7iYffi5its8fgUBDw4/jN0COKBKLpXrDIvzC2LECNqr07kvCaTsmMZ7ZZcGvY HpfmvoHvx3tDw== Date: Tue, 6 Aug 2024 01:59:46 +0200 From: Frederic Weisbecker To: Vlastimil Babka Cc: LKML , Andrew Morton , Kees Cook , Peter Zijlstra , Thomas Gleixner , Michal Hocko , linux-mm@kvack.org, "Paul E. McKenney" , Neeraj Upadhyay , Joel Fernandes , Boqun Feng , Zqiang , rcu@vger.kernel.org Subject: Re: [RFC PATCH 12/20] kthread: Implement preferred affinity Message-ID: References: <20240726215701.19459-1-frederic@kernel.org> <20240726215701.19459-13-frederic@kernel.org> <4e9d1f6d-9cd8-493c-9440-b46a99f1c8af@suse.cz> <00914d25-f0ae-4b00-9608-2457821c071c@suse.cz> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Rspamd-Server: rspam06 X-Rspamd-Queue-Id: 0D8EA1C001A X-Stat-Signature: 3tgp3hwdxs15ui9coeuiumutff36g8ub X-Rspam-User: X-HE-Tag: 1722902390-27281 X-HE-Meta: U2FsdGVkX1/qxfOJgLSUftAH/53WVKFcMjjxYND/CvAgFqiMHDu2VmeYmtV6n/8KqjI8JahKKkcSnrzRVzmq9ZtHUmcsJdp3S13RFyGQg98BEvTXc3mdXFkE7h+4OHuUcemFxLnuwT3C8kODvGgkJrHT2FNLsmZnoxxsj1jeCDyY55IaPB93qu0+A7J+3z6dE5bZjbMvdQeDTuyv4KfynS12Rjz0PHJQVBTiHDvLaUeX5NlFtTr8OuxkGg4AQLrhZMG+ZA9znfQ+eUQmI7PWtGfDOKsZfsguz22/IuDmfS0fRMD+ixd+IeAF4AaUbe6ftD6efFfw3JlJ+cku/QxnMaXacwiHC38PtLhONoDWC22UJNg48oMR/W3hDXyKPIeSWOppyvLh3ukNFtzF8zycH86EEp2kSFKo1LPnxO0lVwUM1B/sA+X1PP+CxR81wz7TM5lZk+RGNBMQiE87fxC7CSjMXHsjoMddvbMJ80ij8NbT11WGAyKf012+5Ur8KUVlAAhyQiIN2E+447iznOhlzMG4AXxZansC9WlqnAZ99IabfRmJphBTItqQNIqY18EZIS8GTWPDBXDfeYdDn6E5xfR1EBoigUeC07v2vmLmsUwzUO8JUmLULNcKPxp/8Cjxnnv302ZG9lWi+yPapFuFx087xdc+7JDDP02/I98W9bGvqL4W6rP5Amgj4NFU1foTvHwrpvOD7fHPaLDGhCxwMML76yWTioUEdwe5PZXeftkrhrkl5y3jFX+AixNSe2ohRZ9jvHWbgKj3I09jamQMIn07pqdcpqDqc+K6Omk90p2zfEBVAp37R1TdgWrDKplQeNB+vmxZYzZ8KCN/9HAPT5vKT0iauudiCQNxzCtv6ghiHbumdKS9ntuKhUq9ADy76H7FdY0wwZHcGzqybQyAxYNxTFFWrpbC/1mnuNCF5egbHtB299iYM8efP3AGxqS61JVxz52mVDI6lBANyPO jxYk+EGK zsm2ocWaFQ3I8olaPOraDipj0xfXP7J7XXNwHbcouW5OHYz2NyTQm11mNi+U6ILlND7y8cEyczNl0xB0Lzw+9xMuIO2wI6nsOrNle+qOXDfu7ver458HFTFDTK8GCb/31Y8sjblego8n8+Yse8ce2sSScg6taa8iWV9vb1O1+IbJ+bxp/8XAIN0IxVP7TifwpPW8Sq9QDtrnZRI9vMiB72jRqFJZP/fD0kw7cb2WdDAnsMrF8A+ATG2oa4d9x1qgm4Bcphj9GPynSK9jvOImYuxyU8FPiK3JpI+58 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: List-Subscribe: List-Unsubscribe: On Mon, Aug 05, 2024 at 11:25:59PM +0200, Vlastimil Babka wrote: > > It's too bad we don't have a way to have a cpumask_possible_of_node(). I've > > looked into the guts of numa but that doesn't look easy to do. > > That was my impression as well. Maybe not even possible because exact cpu > ids might not be pre-determined like this? Probably. > > > Or there could be kthread_set_preferred_node()... ? > > Possible instead of the callback idea suggested above? > kthreads_hotplug_update() could check if this is set and construct the mask > accordingly. Or even better, callers of kthread_create_on_node() with actual node passed (!NUMA_NO_NODE) can be preferrably affined to the corresponding node by default unless told otherwise (that is unless kthread_bind() or kthread_set_preferred_affinity() has been called before the first wake up, and that includes kthread_create_on_cpu()). There are a few callers concerned: kswapd, kcompactd, some drivers: drivers/block/mtip32xx/mtip32xx.c, drivers/firmware/stratix10-svc.c, kernel/dma/map_benchmark.c, net/sunrpc/svc.c After all kthread_create_on_cpu() affines to the corresponding CPU. So it sounds natural that kthread_create_on_node() affines to the corresponding node. And then it's handled on hotplug just as a special case of preferred affinity. Or is there something that wouldn't make that work? Thanks. > > > Thanks. > > > >> > >> > Thanks. > >> >