From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mx0b-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) (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 E0CE938F253 for ; Thu, 18 Jun 2026 08:27:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=148.163.158.5 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1781771271; cv=none; b=PX5ZHOz/omFnt2n/Hw7sObbhMsBpcSMx5kVCSCnfhVsWcFGqDkK/TX05xxgDKkYdMqSZz3M4pX+oH4yYJyFt0/1ETO9Kub8TOWoHGNuiJ6KZ4TFnUzomsdHcGngpw/jHvwVUelLjHS+9P01EAb8zht+eI7IZYUycc14XFPEM8Hc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1781771271; c=relaxed/simple; bh=sQROm6ggbootm3TLAciRIIOS4fIU76bT8w5iK5oyMS4=; h=Message-ID:Date:MIME-Version:Subject:From:To:Cc:References: In-Reply-To:Content-Type; b=mbRNa2+xWXtmOUH0FzFsh9dKf2rrlOEF36G/fryt4BP6FRNFJGIl44RjbEtCMXOLtkic2JKcXNESgCA2w0kvlg4ejxqdiaMM71kffFy43ncRgz7eiE1oPsYOHtIqCI11eg7mumRjY2N7dJcgPhP45b3BEI4DcuwswVzYPour118= 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=jUW1iSXL; arc=none smtp.client-ip=148.163.158.5 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="jUW1iSXL" Received: from pps.filterd (m0360072.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 65I8IViN2776000; Thu, 18 Jun 2026 08:27:23 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=Ibf8Xe C8KFRLYhsaBpFJ9zvznZ6JFe/kw/afe9PwS0k=; b=jUW1iSXLqff5IqS+fQ68FN pRI71CZqKAA6AqP6OVEDwmXh/o7cY6r3tgCzy3J2eKznGvLNYwZYsRq4FWR/7AVK LzuxPUAMbFdVV2+bSCOqvahVr8GKsu3yeSPZPn4GgwyEpRFXwkJP9zlUedhA6LNN rZk6lrB5Nluybhq637+cGWu5TKYFPq3cEwCdBIS2a9AkajAPq/5TpUv7q1EBRRUn xYrA3ZBKsEIi7R97HdKuP5e6jFaHyqMXzmMwRBJ3o1iu/Sx5OPyHzxe6OLEKcZNr U0fBr8CS4L/TKgXwcLwOUEtItgB+5js12pJDaJkgEDmIt1yjkmYcjov+1lPNw93A == Received: from ppma22.wdc07v.mail.ibm.com (5c.69.3da9.ip4.static.sl-reverse.com [169.61.105.92]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 4eueqx717w-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 18 Jun 2026 08:27:22 +0000 (GMT) Received: from pps.filterd (ppma22.wdc07v.mail.ibm.com [127.0.0.1]) by ppma22.wdc07v.mail.ibm.com (8.18.1.7/8.18.1.7) with ESMTP id 65I8Jvu0017096; Thu, 18 Jun 2026 08:27:22 GMT Received: from smtprelay06.fra02v.mail.ibm.com ([9.218.2.230]) by ppma22.wdc07v.mail.ibm.com (PPS) with ESMTPS id 4ev172as6d-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 18 Jun 2026 08:27:21 +0000 (GMT) Received: from smtpav02.fra02v.mail.ibm.com (smtpav02.fra02v.mail.ibm.com [10.20.54.101]) by smtprelay06.fra02v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 65I8RIIS14746008 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 18 Jun 2026 08:27:18 GMT Received: from smtpav02.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 0F9792004B; Thu, 18 Jun 2026 08:27:18 +0000 (GMT) Received: from smtpav02.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 951FB20043; Thu, 18 Jun 2026 08:27:11 +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 08:27:11 +0000 (GMT) Message-ID: <3e07e244-b3be-44a1-a541-b9dafd0ec314@linux.ibm.com> Date: Thu, 18 Jun 2026 13:57:10 +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 From: Shrikanth Hegde 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> <0f90bdcc-857f-4ffa-91a5-60965fae3d8f@linux.ibm.com> Content-Language: en-US In-Reply-To: <0f90bdcc-857f-4ffa-91a5-60965fae3d8f@linux.ibm.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-TM-AS-GCONF: 00 X-Proofpoint-Reinject: loops=2 maxloops=12 X-Proofpoint-GUID: J2d2jGNWjT1_-lprodIrLAbukkb2j6TI X-Authority-Analysis: v=2.4 cv=Le0MLDfi c=1 sm=1 tr=0 ts=6a33abeb cx=c_pps a=5BHTudwdYE3Te8bg5FgnPg==:117 a=5BHTudwdYE3Te8bg5FgnPg==:17 a=IkcTkHD0fZMA:10 a=FelO9ux0wxsA:10 a=VkNPw1HP01LnGYTKEx00:22 a=RnoormkPH1_aCDwRdu11:22 a=RzCfie-kr_QcCd8fBx8p:22 a=ojd724w1NyXcDuoGghAA:9 a=3ZKOabzyN94A:10 a=QEXdDO2ut3YA:10 X-Proofpoint-Spam-Info: AW1haW4tMjYwNjE4MDA3NSBTYWx0ZWRfX304A4zcljAp2 jl/rPEgY33X6cEzHwwPyMnPZA42LQF5P0rRgIwx2jyqzlAZJJWY4UXKEJ3O6dXDbULpLFGyCZR1 jqyh+itXCvAL2gCmspQavUGNrSY5uQY= X-Proofpoint-ORIG-GUID: Aek-_vOfe1P1DTxDF4EKARcbtecEmHpK X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwNjE4MDA3NSBTYWx0ZWRfXxvym/VlxEh+H a7CRwdEbQEWljYPrhGR8t3BSJSwgnV6SuZMxHh9WclKAkU+fHph9FLNghIdGhnH6nPQ4Y8Miv9E Bxp2icfHU0tNR94Ot3sAWRDFb79t8O6eUOicEqFPkRSsxew8nXH/APD6UgvY0Al8sDmTAKXrrTM teZsUqsnRuimW9KZ9HvBS+EtyGP0IXK2l9XjFuEfD/qcDP40vCWMoMoVvwi6jOifgory/qYM3+z RHSyRrlOU4KdT1tYK3VgsCDjyvYjkPfTL2f95ywXj7GH2eiGp7es9lQanZVTQguKYbDqhX6hrNh tkzY5VF7jnX7h7czVY63qJOBRtHC5SK+2nCw2bEqjAEQ7zhfyNTjdyWK90niVh12zpeUCZSnC6M HMHKQtn3zdIHX3uGX7+4jL0GT9XD0+uJAbVVBynduWEoBNcEwi3aNVb/86kJ+8yvyxOvqg7UZxP zbDSD6JxRiPt9+/BUZQ== 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-18_01,2026-06-17_03,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 clxscore=1015 priorityscore=1501 malwarescore=0 spamscore=0 suspectscore=0 impostorscore=0 phishscore=0 lowpriorityscore=0 bulkscore=0 adultscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2606150000 definitions=main-2606180075 On 6/18/26 9:23 AM, Shrikanth Hegde wrote: > 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 > Ok. I misread your comment. I believe you meant to do like below. preferred mask is always defined, either same as active or allocated. diff --git a/include/linux/cpumask.h b/include/linux/cpumask.h index 30ea64cc1656..5a643d608ea6 100644 --- a/include/linux/cpumask.h +++ b/include/linux/cpumask.h @@ -1169,10 +1169,10 @@ void init_cpu_possible(const struct cpumask *src); #define set_cpu_present(cpu, present) assign_cpu((cpu), &__cpu_present_mask, (present)) #define set_cpu_active(cpu, active) assign_cpu((cpu), &__cpu_active_mask, (active)) #define set_cpu_dying(cpu, dying) assign_cpu((cpu), &__cpu_dying_mask, (dying)) +#define set_cpu_preferred(cpu, preferred) assign_cpu((cpu), &__cpu_preferred_mask, (preferred)) void set_cpu_online(unsigned int cpu, bool online); void set_cpu_possible(unsigned int cpu, bool possible); -void set_cpu_preferred(unsigned int cpu, bool preferred); /** * to_cpumask - convert a NR_CPUS bitmap to a struct cpumask * diff --git a/kernel/cpu.c b/kernel/cpu.c index c196ba5d8b2a..d623a9c5554a 100644 --- a/kernel/cpu.c +++ b/kernel/cpu.c @@ -3159,14 +3159,6 @@ void set_cpu_possible(unsigned int cpu, bool possible) } } -void set_cpu_preferred(unsigned int cpu, bool preferred) -{ - if (!IS_ENABLED(CONFIG_PREFERRED_CPU)) - return; - - assign_cpu((cpu), &__cpu_preferred_mask, (preferred)); -} - /* * Activate the first processor. */