From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) (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 8B9A62E7379 for ; Thu, 18 Jun 2026 03:53:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=148.163.156.1 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1781754830; cv=none; b=baKt8sPhU1g0moxi5H4KXyuk76qipUbJuGyxkItXOeGo4mPtfl0PZCA9g3odp0pv0UlcpMREjC0EjwkO8TNEF2g1rC/H6ITmXtErK80NdIGJ+4pNicSv37HlEHOQm+l2gLaaHbQdtoLRlckKulVJtUlwvfLeWeMT8xidOHBh85U= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1781754830; c=relaxed/simple; bh=v0QHW6/oW7i1nB+yvC2riA6k3AW2Z8xPHzYz+2qUolE=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=SGgGlw4+l71TRqsa03laSAw8sfexrX4ME8qhRKMEwRfV1e+UKLWGn+oeEbh0pJD54VgW1KvekxypM7p1oknYSPn4FcUYyq94x0mMmiZZ+pK4gkPnZGyneDjBNag0FZRoVHVr4Db97dR7D3oC3aV7g/3o6uIWSuNtf3NAc9r/PSk= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.ibm.com; spf=pass smtp.mailfrom=linux.ibm.com; dkim=pass (2048-bit key) header.d=ibm.com header.i=@ibm.com header.b=Ei0Ky7q8; arc=none smtp.client-ip=148.163.156.1 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.ibm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.ibm.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=ibm.com header.i=@ibm.com header.b="Ei0Ky7q8" Received: from pps.filterd (m0353729.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 65HHmcWL1251164; Thu, 18 Jun 2026 03:53:29 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=cc :content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=pp1; bh=ThvA4J LC1fAl7NgA9WxUPVK1kZMZ9rDxJEIsX6+rhkY=; b=Ei0Ky7q8ZpY66rcbNsAemA xlBnkjXqVcyopBBGob/AKtJfZQvcaI1xS5UuOyQ28b96g02Rhdjd0xcum1HQhnTn GOgm0C4SpBv1WJDLGgiTQzjIi9IXIWULD9496KWM/WKOlQlGCcqxFMkkzbUT7I/B LwQwpKfAzDmB4oSlanw5+/WGBn6Xfaw3jWKSt1uR5BU1cp1RvJyi8ABxt1RfipAL tE5BxOFOOIQjKoB4xE55tfGqqcX7gdvBVlYlCc+zdKObbvtN5IzedUEMxxNglh0A jY+6XMpGL8xEjEAPVgSGV9ASB3PF3xzOPoownyzhHN5pzVSXMx8AYZBqugNQsCsg == Received: from ppma12.dal12v.mail.ibm.com (dc.9e.1632.ip4.static.sl-reverse.com [50.22.158.220]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 4euequ65by-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 18 Jun 2026 03:53:29 +0000 (GMT) Received: from pps.filterd (ppma12.dal12v.mail.ibm.com [127.0.0.1]) by ppma12.dal12v.mail.ibm.com (8.18.1.7/8.18.1.7) with ESMTP id 65I3nnex018881; Thu, 18 Jun 2026 03:53:28 GMT Received: from smtprelay03.fra02v.mail.ibm.com ([9.218.2.224]) by ppma12.dal12v.mail.ibm.com (PPS) with ESMTPS id 4ev1721t4e-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 18 Jun 2026 03:53:27 +0000 (GMT) Received: from smtpav02.fra02v.mail.ibm.com (smtpav02.fra02v.mail.ibm.com [10.20.54.101]) by smtprelay03.fra02v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 65I3rOC938666636 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 18 Jun 2026 03:53:24 GMT Received: from smtpav02.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 618972004B; Thu, 18 Jun 2026 03:53:24 +0000 (GMT) Received: from smtpav02.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 18B4F20040; Thu, 18 Jun 2026 03:53:18 +0000 (GMT) Received: from [9.123.5.233] (unknown [9.123.5.233]) by smtpav02.fra02v.mail.ibm.com (Postfix) with ESMTP; Thu, 18 Jun 2026 03:53:17 +0000 (GMT) Message-ID: <0f90bdcc-857f-4ffa-91a5-60965fae3d8f@linux.ibm.com> Date: Thu, 18 Jun 2026 09:23:17 +0530 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v4 04/20] cpumask: Introduce cpu_preferred_mask To: Yury Norov Cc: linux-kernel@vger.kernel.org, mingo@kernel.org, peterz@infradead.org, juri.lelli@redhat.com, vincent.guittot@linaro.org, kprateek.nayak@amd.com, iii@linux.ibm.com, tglx@kernel.org, gregkh@linuxfoundation.org, pbonzini@redhat.com, seanjc@google.com, vschneid@redhat.com, huschle@linux.ibm.com, rostedt@goodmis.org, dietmar.eggemann@arm.com, mgorman@suse.de, bsegall@google.com, maddy@linux.ibm.com, srikar@linux.ibm.com, hdanton@sina.com, chleroy@kernel.org, vineeth@bitbyteword.org, frederic@kernel.org, arighi@nvidia.com, pauld@redhat.com, christian.loehle@arm.com, tj@kernel.org, tommaso.cucinotta@gmail.com, maz@kernel.org, rafael@kernel.org References: <20260617174139.155540-1-sshegde@linux.ibm.com> <20260617174139.155540-5-sshegde@linux.ibm.com> From: Shrikanth Hegde Content-Language: en-US In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-TM-AS-GCONF: 00 X-Proofpoint-Reinject: loops=2 maxloops=12 X-Proofpoint-Spam-Info: AW1haW4tMjYwNjE4MDAzMCBTYWx0ZWRfX2YmrsdFUgKAV feU8nQY2dCuRNTqdyp7XSvZwRBCIW2BohgtL8bOAl5Gj9nP7mgtnKs/OZpVorvF8n+2PsGri+3F TTX4fU/aZGrlpy9NtYGtEirvLhK0uXU= X-Proofpoint-ORIG-GUID: yhIwVku_qnkdJk0sTy310XB6FpYWDZgY X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwNjE4MDAzMCBTYWx0ZWRfX4kvsl7xd9HYq bF0gewRRU8NM5Rjc9ALgxXYv6j44/wZrECi4aarLnYgwCyCgY72faO0CKLAixLeGn7+mP6jIUHK f0bqAUp2lVwUUuMjRhXaLD1S68eHSMDO27T20z7ZdTLQ5JBFAmFMrQzGGERdcK2t7eSG2I2H5/v CjWMs4ogviwou8cq03+JPSPM5FAto8eZuvtyVS3na1CZ38dK63ihirp67+YbImlIeQNHpm2cIWX aNjIFNmlqHlwabNS4Tl1LgtlGgmpeVjbcDuFyaKomHBEHV4r/q+UBWgwtxAZa8ulCqMojNIxxgA hVldJoTuhu+zHn6WEOQq8FnOQfWPiP9gKuupdqEIEpCJveubv982oxULO0ddRjhas0xYiDC3k5t /Zbyxo+rmGhi9IfagqLVls5riMHKcWpEtuQP8Oa9xEwvRiGBGJrXh7HDQoRYiv02eXmJ3UMny6d WHO07UC/5YPHN2ZOelg== X-Proofpoint-GUID: NZqxEzCIxT43x5RWvtunW1xKRtJKggOl X-Authority-Analysis: v=2.4 cv=L9gtheT8 c=1 sm=1 tr=0 ts=6a336bb9 cx=c_pps a=bLidbwmWQ0KltjZqbj+ezA==:117 a=bLidbwmWQ0KltjZqbj+ezA==:17 a=IkcTkHD0fZMA:10 a=FelO9ux0wxsA:10 a=VkNPw1HP01LnGYTKEx00:22 a=RnoormkPH1_aCDwRdu11:22 a=uAbxVGIbfxUO_5tXvNgY:22 a=ebO9dBi2-JJPdT0v41cA:9 a=QEXdDO2ut3YA:10 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1143,Hydra:6.1.125,FMLib:17.12.100.49 definitions=2026-06-17_02,2026-06-17_03,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 bulkscore=0 impostorscore=0 malwarescore=0 clxscore=1015 adultscore=0 phishscore=0 lowpriorityscore=0 suspectscore=0 priorityscore=1501 spamscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2606150000 definitions=main-2606180030 Hi Yury. >> +void set_cpu_preferred(unsigned int cpu, bool preferred) >> +{ >> + if (!IS_ENABLED(CONFIG_PREFERRED_CPU)) >> + return; >> + >> + assign_cpu((cpu), &__cpu_preferred_mask, (preferred)); >> +} > > set_cpu_xxx() is a macro on purpose - it improves code generation > quite a lot. See 5c563ee90a22d. Can you keep set_cpu_preferred aligned > with the other set_cpu(), i.e. make it a macro? > Ok. only reason was to avoid ifdeffery there. you mean below? #ifdef CONFIG_PREFERRED_CPU #else #endif >> + >> /* >> * Activate the first processor. >> */ >> @@ -3164,6 +3177,7 @@ void __init boot_cpu_init(void) >> /* Mark the boot cpu "present", "online" etc for SMP and UP case */ >> set_cpu_online(cpu, true); >> set_cpu_active(cpu, true); >> + set_cpu_preferred(cpu, true); >> set_cpu_present(cpu, true); >> set_cpu_possible(cpu, true); >> >> diff --git a/kernel/sched/core.c b/kernel/sched/core.c >> index 2f4530eb543f..9e16946c9d62 100644 >> --- a/kernel/sched/core.c >> +++ b/kernel/sched/core.c >> @@ -8685,6 +8685,9 @@ int sched_cpu_activate(unsigned int cpu) >> */ >> sched_set_rq_online(rq, cpu); >> >> + /* preferred is subset of active and follows its state */ >> + set_cpu_preferred(cpu, true); > > Did you put it at the end of the function on purpose? If yes, please > add a comment. If no, I'd prefer to have it immediately after > set_cpu_active(). /* * Put the rq online, if not already. This happens: * * 1) In the early boot process, because we build the real domains * after all CPUs have been brought up. * 2) At runtime, if cpuset_cpu_active() fails to rebuild the * domains. */ sched_set_rq_online(rq, cpu); This was the reason. I wanted active related functionality to complete. > >> + >> return 0; >> } >> >> @@ -8698,6 +8701,8 @@ int sched_cpu_deactivate(unsigned int cpu) >> if (ret) >> return ret; >> >> + set_cpu_preferred(cpu, false); >> + >> /* >> * Remove CPU from nohz.idle_cpus_mask to prevent participating in >> * load balancing when not active >> -- >> 2.47.3