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 EC423C25B75 for ; Mon, 3 Jun 2024 07:34:01 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 7E2A76B009A; Mon, 3 Jun 2024 03:34:01 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 7915F6B009B; Mon, 3 Jun 2024 03:34:01 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 658336B009C; Mon, 3 Jun 2024 03:34:01 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id 458D26B009A for ; Mon, 3 Jun 2024 03:34:01 -0400 (EDT) Received: from smtpin05.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id B2152C083B for ; Mon, 3 Jun 2024 07:34:00 +0000 (UTC) X-FDA: 82188763440.05.185EA05 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by imf29.hostedemail.com (Postfix) with ESMTP id E113612000D for ; Mon, 3 Jun 2024 07:33:57 +0000 (UTC) Authentication-Results: imf29.hostedemail.com; dkim=none; spf=pass (imf29.hostedemail.com: domain of metin.kaya@arm.com designates 217.140.110.172 as permitted sender) smtp.mailfrom=metin.kaya@arm.com; dmarc=pass (policy=none) header.from=arm.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1717400038; a=rsa-sha256; cv=none; b=78WtIo1YxZy/vSJyS9zfwi+ulZngA8rBQSOsrzNTvGfbnBpCAR82l5cxbCYMNG9jvsmKkF wIa+OsUtQA43TAGiv+iljD5qJrMX58rnkzgxS9VVuYT9f1cLJg0A2aBZhWXLV01IB7ATlQ hpuqhI4Zh6VXHXrSTBqCfWYvWus0jbo= ARC-Authentication-Results: i=1; imf29.hostedemail.com; dkim=none; spf=pass (imf29.hostedemail.com: domain of metin.kaya@arm.com designates 217.140.110.172 as permitted sender) smtp.mailfrom=metin.kaya@arm.com; dmarc=pass (policy=none) header.from=arm.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1717400038; 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:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=WVeiociUuhesx6GVg0udbKZvV9Omb7jKnCN4S2rSA9Y=; b=8K0M9ZzaMQ1+NaJDgWEvsuOhmCba+tEvN06lOoPOZeStL24KpqHKhAia/+D2mWQISOHLqb 5Lt2sd/WvWvzM3oFavPeBoKod7pnBwC98c8kUMsxPNNGoR6luY3SZsozIypGviKxLXSaHl xqQsX7iEGUsZwcob8TtdsqU4y9I7y1E= Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 4A35E1042; Mon, 3 Jun 2024 00:34:21 -0700 (PDT) Received: from [10.57.5.79] (unknown [10.57.5.79]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 45BC03F762; Mon, 3 Jun 2024 00:33:54 -0700 (PDT) Message-ID: <417b39d1-8de8-4234-92dc-f1ef5fd95da7@arm.com> Date: Mon, 3 Jun 2024 08:33:53 +0100 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v4 2/2] sched/rt, dl: Convert functions to return bool To: Qais Yousef , Ingo Molnar , Peter Zijlstra , Juri Lelli , Steven Rostedt Cc: Vincent Guittot , Daniel Bristot de Oliveira , Thomas Gleixner , Sebastian Andrzej Siewior , Alexander Viro , Christian Brauner , Andrew Morton , Jens Axboe , linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-trace-kernel@vger.kernel.org, linux-mm@kvack.org References: <20240601213309.1262206-1-qyousef@layalina.io> <20240601213309.1262206-3-qyousef@layalina.io> Content-Language: en-US From: Metin Kaya In-Reply-To: <20240601213309.1262206-3-qyousef@layalina.io> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Rspamd-Queue-Id: E113612000D X-Rspam-User: X-Rspamd-Server: rspam12 X-Stat-Signature: fx3x4kc7f95hi7otyfyitpu5p1askfqj X-HE-Tag: 1717400037-440183 X-HE-Meta: U2FsdGVkX1/Odm3JnahwxJGt1Ftma8qwjRCQMy3ULlC1YAvHXWWK02pOkhC9NAyYAXEq1LIkvlWYSoK9FQ8SJXk/RSzIpd6ygbXgmtLosSZH4TXV4CLcmqhElWmKqdJIoDyGJv9BXo+Ory+JANDJlBFoixDSaZyKlZhgpFZASzwFvZH/+Av8qKFRCq0I5nmnjTET0yC+B4B4ndltuNx/MlVqslIIWOXIuRCHb8ksD3Bg4XQauQ5qCkX98jPAycS2XrtKjz4jwGFb2OvziN1Kwx5qv/TpTtg5GXYk7f5PGW8FbhF7A9oSlnwGx5gaF3QfWr1zei1HJA6bv5KRyabG/Zv1oW9fg6G6uA8/O8d7ScL0GIwl+G7ilumcvZi9f4fg3RXFbtsGYs7C6H4R6Y7zQMf28F3OkZ/MzxTUk/sOTIFt4ByXL+eC6JSuzrSG/S4DZNJCd+kOapKlVOydKRQfAHiIMcJFSBZEhKbIe9DT8Yy3jiKGfr55wtfyErBpaoH1+OHssqsKVlc+LdZZzHrGwkPtKqcr5Cf3Cd+t4B8MothuJKK03dbCyMgIg2XkFppHmXPZpFL6xpoaDc1890fPUO3qYOuEu8hu5O70NEOG9ZW67rX2GUvThGYr1dz18foj5K0kIM+yuD7TEgFLQjU4y1wTdkIUkXhXkDJ/DCT1JpXG3x4UcGMtX+NxueHWXc8u/gJXPwfEgo+rvuBDOTG9kwvg6KRp9q4NqCRAGOHyao+M1nmsRSjnmV6VI4CHohfnBcWsaTglW/7HxKmIo72KQ18CoMdfSvqwfHQgElaxDsg/WAdeduNet33Vvmbdqw51h5dO7/5fXv1fpapfBi3ek9eiU8WhSAB26Wk20ZYjnV/pNUmlCuisGPv6Dpy6ViJQ2j3kS6+oJTencIIvRMog6VdmH2Hj6j60u0drwwD6q5OSp6zf48vAMO9Qm4FoMThsTp0uVgdp4M3bskUd0GU 5doY59cl zgZCWf8a206kBqaeAQ1arg6c5mw9TOmuudmfJbbEQWKioEqNOxOGc4lA4UkVqhhAizaubce2OMJqIGdeuAgPy0DCEP4ByYYcUpnQv3Ld9cVSrzHoFNUmjSSy9ASf/Fh829h7y9kxLMtpugFyMOTJG0WvV2tk/6Thc/sEraXwnd7HWAtyAzBiF/VmucdDhU7EwfA2V9EILD/1kXbk= 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 01/06/2024 10:33 pm, Qais Yousef wrote: > {rt, realtime, dl}_{task, prio}() functions return value is actually > a bool. Convert their return type to reflect that. > > Suggested-by: Steven Rostedt (Google) > Signed-off-by: Qais Yousef > --- > include/linux/sched/deadline.h | 8 ++++---- > include/linux/sched/rt.h | 16 ++++++++-------- > 2 files changed, 12 insertions(+), 12 deletions(-) > > diff --git a/include/linux/sched/deadline.h b/include/linux/sched/deadline.h > index 5cb88b748ad6..f2053f46f1d5 100644 > --- a/include/linux/sched/deadline.h > +++ b/include/linux/sched/deadline.h > @@ -10,18 +10,18 @@ > > #include > > -static inline int dl_prio(int prio) > +static inline bool dl_prio(int prio) > { > if (unlikely(prio < MAX_DL_PRIO)) > - return 1; > - return 0; > + return true; > + return false; Nit: `return unlikely(prio < MAX_DL_PRIO)` would be simpler. The same can be applied to rt_prio() and realtime_prio(). This would make {dl, rt, realtime}_task() single-liner. Maybe further simplification can be done. > } > > /* > * Returns true if a task has a priority that belongs to DL class. PI-boosted > * tasks will return true. Use dl_policy() to ignore PI-boosted tasks. > */ > -static inline int dl_task(struct task_struct *p) > +static inline bool dl_task(struct task_struct *p) > { > return dl_prio(p->prio); > } > diff --git a/include/linux/sched/rt.h b/include/linux/sched/rt.h > index a055dd68a77c..efbdd2e57765 100644 > --- a/include/linux/sched/rt.h > +++ b/include/linux/sched/rt.h > @@ -6,25 +6,25 @@ > > struct task_struct; > > -static inline int rt_prio(int prio) > +static inline bool rt_prio(int prio) > { > if (unlikely(prio < MAX_RT_PRIO && prio >= MAX_DL_PRIO)) > - return 1; > - return 0; > + return true; > + return false; > } > > -static inline int realtime_prio(int prio) > +static inline bool realtime_prio(int prio) > { > if (unlikely(prio < MAX_RT_PRIO)) > - return 1; > - return 0; > + return true; > + return false; > } > > /* > * Returns true if a task has a priority that belongs to RT class. PI-boosted > * tasks will return true. Use rt_policy() to ignore PI-boosted tasks. > */ > -static inline int rt_task(struct task_struct *p) > +static inline bool rt_task(struct task_struct *p) > { > return rt_prio(p->prio); > } > @@ -34,7 +34,7 @@ static inline int rt_task(struct task_struct *p) > * PI-boosted tasks will return true. Use realtime_task_policy() to ignore > * PI-boosted tasks. > */ > -static inline int realtime_task(struct task_struct *p) > +static inline bool realtime_task(struct task_struct *p) > { > return realtime_prio(p->prio); > }