From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 43B622EC081 for ; Tue, 7 Jul 2026 23:17:44 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1783466266; cv=none; b=s1AUY69wfMHW9fBFvTrM9+AMY6ksXroB4zjRZI2QddVDG4lvlgOfrQ4qSpcfhDJNBc/jy0QQcf6UiIyDpdpyWOBblGF3lPhJ0L2f7O7Cy0symCp2mwa47oqfY61b2qJEvKj3n1TqNSDUMZuN8pD8IuksVeSWRdeXgsGzNrJlYTM= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1783466266; c=relaxed/simple; bh=nS4hlhZWDIJerMYw3m5OR49MjCASMwDmlOH4xI0y0u0=; h=From:To:Cc:Subject:In-Reply-To:References:Date:Message-ID: MIME-Version:Content-Type; b=czJlqCyXXMCL0hRiTNWm5Ft7HFxqzoWDnJ3eh0TWSpw/XrxKfr0EC+ueuxCK0kVim+SSi2jGm23p4r7RBHiLVaWaSp2+IxHxscm34TTjzzKWY8TxMbNR6SkZM5vf3902aZTY+/pdnc4jD8K2Nu5ZiHowiBjjMoaCEQRZ0rW7trs= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=hqF7hpjr; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="hqF7hpjr" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3AD971F000E9; Tue, 7 Jul 2026 23:17:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1783466264; bh=drJYh3GpxY8sAKb55UejnibevW+9DK5ytvPZ824Twxw=; h=From:To:Cc:Subject:In-Reply-To:References:Date; b=hqF7hpjrrPNcfl9B+zPhQw3unJNDD5y1vYLp1H+hyM8ZnmFtKK4OdcEsAQ7CVBD7V angdtqWs4d5pS1/iGCc8hwERsgS+8nTPhS0fzg0ZU50EANRafPUyDBccHgU4t4skMJ kvhhvWz9GKvqQR9BqYxVUMMEzNWmkOPBRVOk/K7XPhtQTd/A7k75VxMxiU66cHFUwM NLDbr2X2tywU23l7Eq3EW5FVlNIhzEwCJ4DZ5LMrkKczrBNrJs8aTvKlu5KFpbC56v BdG66Qsy90SI8KVolXrOHBFqg7Scf5ToXpk44sb4C0X553X6aBQ6LnP6z4V4mUqBdH /jnQ+Zw4f+WCw== From: Thomas Gleixner To: Chuyi Zhou , mingo@redhat.com, luto@kernel.org, peterz@infradead.org, paulmck@kernel.org, muchun.song@linux.dev, bp@alien8.de, dave.hansen@linux.intel.com, pbonzini@redhat.com, bigeasy@linutronix.de, clrkwllms@kernel.org, rostedt@goodmis.org, nadav.amit@gmail.com, vkuznets@redhat.com Cc: linux-kernel@vger.kernel.org, Chuyi Zhou Subject: Re: [PATCH v9 04/14] smp: Use task-local IPI cpumask in smp_call_function_many_cond() In-Reply-To: <20260630111008.2034376-5-zhouchuyi@bytedance.com> References: <20260630111008.2034376-1-zhouchuyi@bytedance.com> <20260630111008.2034376-5-zhouchuyi@bytedance.com> Date: Wed, 08 Jul 2026 01:17:42 +0200 Message-ID: <87ik6qs82x.ffs@fw13> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain On Tue, Jun 30 2026 at 19:09, Chuyi Zhou wrote: > The memory cost is explicit: one word is added to task_struct. When > cpumask_size() fits in that word, the mask is stored inline and no > separate allocation is needed. Larger systems allocate cpumask_size() per > task; on x86-64 NR_CPUS=8192 this is about 1 KiB per task. For context, It's not about. It's one kilobyte, no? > @@ -1364,6 +1364,12 @@ struct task_struct { > struct list_head perf_event_list; > struct perf_ctx_data __rcu *perf_ctx_data; > #endif > +#if defined(CONFIG_SMP) && defined(CONFIG_PREEMPTION) > + union { > + cpumask_t *ipi_mask_ptr; > + unsigned long ipi_mask_val; > + }; > +#endif Aside of this horrible ifdeffery, this construct makes me more than nervous as it's too trivial to add code which deferences the pointer directly. The proper thing to do is: #if defined(CONFIG_SMP) && defined(CONFIG_PREEMPTION) struct task_ipi_mask { union { cpumask_t *ipi_mask_ptr; unsigned long ipi_mask_val; }; }; #else struct task_ipi_mask { }; #endif struct task_struct { ... struct task_ipi_mask __private ipi_mask; and have the magic accessors use ACCESS_PRIVATE(t->ipi_mask.member); That allows static analysis to catch any incidential direct references. Thanks, tglx