From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (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 6165B39E6F0 for ; Mon, 11 May 2026 12:53:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.133.124 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778504035; cv=none; b=mKyCQ5txr0Vi7yrFN0xeoZbsU1ygyW83lm2kcVDiUlUF4A4iNSy3KE9T9CXOuuS96ZV/6TDcAAisP+7biBjGeKZqjtooFcUvmofF70Eg4+bqnv1H+evbsARHa41azYY0BtAEBryotfOZc/1Y+iPQ8cIqNxgZLyYho4jmonQ6OGs= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778504035; c=relaxed/simple; bh=TzRqJiq75lyBJzbhuaEvF0EOqyYy33yA2H+AbmjlmqU=; h=From:To:Cc:Subject:In-Reply-To:References:Date:Message-ID: MIME-Version:Content-Type; b=A+Rs0iyQ5vqH+d7aJSpPdFiwJG/xDETj3J9SIlK8rYsEz7JZtH1Q2Tcz84+MEW/rVCCQUpf5SvpJkwlTbCdt+Q5nsje21BqAfVLmUPpJWLS+HfkDBax+PyhZ3OeT9Dp6QKFWbnTVWjQmS9UQ1Wf9xy1CYveAhoDxpeN3YXTX4Qc= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=LHnhN4Cw; dkim=pass (2048-bit key) header.d=redhat.com header.i=@redhat.com header.b=VAqyl5Xo; arc=none smtp.client-ip=170.10.133.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="LHnhN4Cw"; dkim=pass (2048-bit key) header.d=redhat.com header.i=@redhat.com header.b="VAqyl5Xo" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1778504031; 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=vjfSvezF9U43WAXLMcTgGCAYUoiNYZYToqtr7i58NvE=; b=LHnhN4CwCzYo21x1A78KzAVFQPSeurCJtNj0mJGbyNeoloXUbrESqJKmjX0V0UMDTCn2Ck wFOXDdHoSco5NsjYZ5C4hmjLe6rYdba/EYU3VbpCcdpdOwtQL9aed3Gs/JmaPoCW45/e6/ W9OONEi8DfrLk9RZU686jp5LzrlZcWI= Received: from mail-wr1-f71.google.com (mail-wr1-f71.google.com [209.85.221.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-436-5WDktmjsPyCkaKX8MUAokg-1; Mon, 11 May 2026 08:53:50 -0400 X-MC-Unique: 5WDktmjsPyCkaKX8MUAokg-1 X-Mimecast-MFC-AGG-ID: 5WDktmjsPyCkaKX8MUAokg_1778504029 Received: by mail-wr1-f71.google.com with SMTP id ffacd0b85a97d-44ffa15dc8cso2798411f8f.1 for ; Mon, 11 May 2026 05:53:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=google; t=1778504029; x=1779108829; darn=vger.kernel.org; h=mime-version:message-id:date:references:in-reply-to:subject:cc:to :from:from:to:cc:subject:date:message-id:reply-to; bh=vjfSvezF9U43WAXLMcTgGCAYUoiNYZYToqtr7i58NvE=; b=VAqyl5XoqtbSukQPLLIBA27a8GI28sB417NL2gJpyKCoPimbySmtR05IA5EVqeQQkg WUWzG6Q4s69nuRcDkGHtcifeZ7ZTGEwulBjNiT6d376gThHvvgHUI+gqdKyUpTIImlXv d1pse2al6x7HssDXGv0Q4gTUznigt+y6OgB+n5W72RSsEVBjHdm5xWxnabAnCHwPoIeu 3GYYvsNBiLn5JusandppoXTBi95NiZc+BKG/XDURECwX9cfQDNRkBmwYYINsLkvgfENu o2M9o9XylOa88ZMpP0dVzNCJc4KsCIOtrzqachU5NSREjGozajaCesJ576Cw4aZNd3TV REHw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1778504029; x=1779108829; h=mime-version:message-id:date:references:in-reply-to:subject:cc:to :from:x-gm-gg:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=vjfSvezF9U43WAXLMcTgGCAYUoiNYZYToqtr7i58NvE=; b=JMSjQPwxqhFoBjH9zhnqs4OP+Rs0qt8fJCLaoTpW3fdOdUr1A621EwDE7tqH81l0GY gfO9EkuYlkzbGG9k7Vz3I4lmA2LwqeTlFvoMbsLDNi6wIaH9MsA+htRi+9++6OoJyYAf LTSpAZrNa93zKW5WEf4EBZOcdTM9CEDLpq8B76b9hVodolqNKMVWMnocxLU87JSF6CRz EWGEeWbq1V3lZYD85MGT5EpJb/oS8hcZfn6by9By0htgxlqSiR1HI5JVZYxc0y3Go/aQ KFlS/8cGZUn1qVSQpGDmCn48UaajRIlqlq+JVIi2cBTLCyHJnJhD7Y0d0s8xd8NA5iWc TFRQ== X-Forwarded-Encrypted: i=1; AFNElJ/+5dLoazgw9Z+8ZzBm6ic1iUchyBzDs3eKno3N0V7Oz/bJRLenHcwft9gyJA+cIJys5Hasisz8+rrj3rw=@vger.kernel.org X-Gm-Message-State: AOJu0YzCeI0vKlMsah2Am4ZalT+MUwndYgpcBkH+QjpDyYGUsP/6pJZX IR5j2vK2JjSUp6H9NplfDODQrJl8MWmWS/wleaKEg2MGC8yzXcczZq6pra+K+eB9mYKj5K71EEo gAHrTmFR+XV6Ujqo+SegwiZYbkNUSvYGqpK33Vnu52e1ZVmCyVmBkRiFePg4Ixlm9IQ== X-Gm-Gg: Acq92OFkPe9pkhdLUwlMYjqrykJT51PWtAMdh0AEgLfTZa/9L5oJ16sowdW6nn3fahg V5Wa3jRRLG7X7/4giA8rRkNK3/0wFRyJtWmIP0ZrPmgfeNfV0QX0P2Xq6ctp/h3tYHn3dGu9os2 brkGvFjd3oxyNpWOwqr26ScLKkAQ59WiZZInmmI2YA5S2POR1xmV6UfyGLRU21QNHzMnQfbD0ro z6tEd2xdtWU+5F67obHDNrXf8N5uN2gVDZr6RwZ39m7MS+OZpa0FwIvtf9QCQdXAVaqxeuRcpR/ WP0ZpHexZszOGrSQjR9HwF0NdOLBnB1mz9Ujc7d1zpQqdhJrE/Q0iF5c48549RlBrB7Uh61lqrX 6CPCGzWyAZPLOgcXbJw8QuhMmqs+1XQOe8iG9pkZecfysyU8rcqocAxlesb8xEhIH7aELxFzR1L EmJ4zSblU= X-Received: by 2002:a05:6000:26c9:b0:44b:cb31:b767 with SMTP id ffacd0b85a97d-4515d2e6d77mr37685622f8f.36.1778504029107; Mon, 11 May 2026 05:53:49 -0700 (PDT) X-Received: by 2002:a05:6000:26c9:b0:44b:cb31:b767 with SMTP id ffacd0b85a97d-4515d2e6d77mr37685559f8f.36.1778504028567; Mon, 11 May 2026 05:53:48 -0700 (PDT) Received: from vschneid-thinkpadt14sgen2i.remote.csb (213-44-135-146.abo.bbox.fr. [213.44.135.146]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-45492271510sm30542214f8f.37.2026.05.11.05.53.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 11 May 2026 05:53:47 -0700 (PDT) From: Valentin Schneider To: Shrikanth Hegde , mingo@kernel.org, peterz@infradead.org, vincent.guittot@linaro.org, linux-kernel@vger.kernel.org Cc: sshegde@linux.ibm.com, kprateek.nayak@amd.com, juri.lelli@redhat.com, dietmar.eggemann@arm.com, tj@kernel.org, rostedt@goodmis.org, tglx@kernel.org, mgorman@suse.de, bsegall@google.com, arighi@nvidia.com Subject: Re: [PATCH 2/3] sched: Simplify ifdeffery around cpu_smt_mask In-Reply-To: <20260506110052.9974-3-sshegde@linux.ibm.com> References: <20260506110052.9974-1-sshegde@linux.ibm.com> <20260506110052.9974-3-sshegde@linux.ibm.com> Date: Mon, 11 May 2026 14:53:45 +0200 Message-ID: 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 06/05/26 16:30, Shrikanth Hegde wrote: > Now, that cpu_smt_mask is defined as cpumask_of(cpu) for > CONFIG_SCHED_SMT=n, it is possible to get rid of the ifdeffery. > > Effectively, > - This makes sched_smt_present is defined always > > - cpumask_weight(cpumask_of(cpu)) == 1. So sched_smt_present_inc/dec > will never enable the sched_smt_present. Which is expected. > > - Paths that were compile-time eliminated become runtime guarded > using static keys. > > - Defines set_idle_cores, test_idle_cores etc which could likely benefit > the CONFIG_SCHED_SMT=n systems to use the same optimizations within the > LLC at wakeups. > > - This will expose sched_smt_present,stop_core_cpuslocked symbol for > CONFIG_SCHED_SMT=n. Likely not a concern. > > - There a bloat of code CONFIG_SCHED_SMT=n. (NR_CPUS=2048) > add/remove: 25/18 grow/shrink: 26/19 up/down: 6696/-3064 (3632) > Total: Before=30771823, After=30775455, chg +0.01% > > - No code bloat for CONFIG_SCHED_SMT=y, which is expected. > Some nitpicks below, otherwise this LGTM except the sched_ext bits which I'm not familiar enough with. > @@ -8703,9 +8699,7 @@ int sched_cpu_deactivate(unsigned int cpu) > */ > sched_smt_present_dec(cpu); > > -#ifdef CONFIG_SCHED_SMT > sched_core_cpu_deactivate(cpu); > -#endif That ends up grabbing @core_lock, arguably this is during hotplug but still seems a bit wasteful when, with CONFIG_SCHED_SMT=1, we know the mask weight will never exceed 1. Probably worth adding a sched_smt_active() check within the callee. > @@ -632,7 +632,6 @@ int stop_machine(cpu_stop_fn_t fn, void *data, const struct cpumask *cpus) > } > EXPORT_SYMBOL_GPL(stop_machine); > > -#ifdef CONFIG_SCHED_SMT > int stop_core_cpuslocked(unsigned int cpu, cpu_stop_fn_t fn, void *data) That seems to be only used by the INTEL_IFS selftest stuff which does some wait_for_sibling_cpu() loop; at a quick glance it seems to do the right thing for weight := 1 but IMO worth a proper look. That or have the IFS code not run that when there is no SMT. > { > const struct cpumask *smt_mask = cpu_smt_mask(cpu);