Received: by 2002:ab2:7903:0:b0:1fb:b500:807b with SMTP id a3csp800398lqj; Mon, 3 Jun 2024 00:34:11 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWrhG88j+vArS097qGYrKReHmtn3t16dMIxihjvYTiVnnatt7B86JInHfxfxeXsTjEAEhNsjAza2fMgLMPX80HLO1z1x4kw9WFWVvSp6Q== X-Google-Smtp-Source: AGHT+IGuaE4RcO2BDQOAcrAsqSwTe1Lguna5LTBUWcbOoQTAA/GBeCQu+cBsSQ64vJSOfVrz+tXE X-Received: by 2002:a05:6870:f617:b0:22a:5ffd:5e40 with SMTP id 586e51a60fabf-2508bcba59amr8576459fac.59.1717400051429; Mon, 03 Jun 2024 00:34:11 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1717400051; cv=pass; d=google.com; s=arc-20160816; b=kZ4++d8fooZdPfOtrdVnbHRTucF02d1w7KU4MlCDj65rayAzAhLBCnQg0p/hEpsGyX ypLoX22ox5to3Iqb1Y704dDvU3ctrVOl6XxuecnHax3Mu98XnpXBzG9IyGqGcJIUQ3ZI YD/XNprNg1gBNUffEu2aLDSTGZoG/mFWHLhO3JEF9S+lHze06m4jSsvtqXq7yj1v0wYP 5jLEYb4kgrNCon7l+mzovxdNG6lkOd0OtIpI0RlG9Aq/k+Tq/JI7AfSSGBbk4vouWV4u yrLGhmtF8UmIK5G19joJp6hzYcfjR1hlAJyjtktshcOI5aCk9LMeUKsa24UYNg5kyW+M vjMQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:date:message-id; bh=WVeiociUuhesx6GVg0udbKZvV9Omb7jKnCN4S2rSA9Y=; fh=0h44EYvEZbYUs2pnX8NKzdqtBqow1rIxMt8eYvkG8MI=; b=VP87xdXh3lO0SyQT5W5KuoVHHCVaodB2vDEo/TTlH6nY5MkUBRKAjJtKmZ++ZHfalS X6vW6cWWGOxVcUvtZjL/5XFxaAfHkEvlQMN7P7E/QR0/OyP/uvEX+YcHC53q4gGlO6Y9 zGiabWdTPgcMKv+IAMBiqkBMIBJkjgJYhtzOerBp2TJ3ouuPpsOG63b4yT0xGkO3BjFv Fy1re2vO0GPqpjVwsVVpAbqfUlNh8/xHE/SWi0Ghm6LN8ryN5aoY7aGNaq/9PsEYyIQG M/i2suzapHQXz+cRPj20bhXw2ovupGe5myyo3I1E0pYTM1M4IYxWeUAcnIRa/KbHQ+zM lucg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=arm.com dmarc=pass fromdomain=arm.com); spf=pass (google.com: domain of linux-kernel+bounces-198716-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-198716-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id 41be03b00d2f7-6c355157dfesi5956458a12.197.2024.06.03.00.34.11 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 03 Jun 2024 00:34:11 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-198716-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=arm.com dmarc=pass fromdomain=arm.com); spf=pass (google.com: domain of linux-kernel+bounces-198716-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-198716-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id CDDB22836AE for ; Mon, 3 Jun 2024 07:34:10 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 77F1A482E2; Mon, 3 Jun 2024 07:34:00 +0000 (UTC) Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by smtp.subspace.kernel.org (Postfix) with ESMTP id C7FAB63D5; Mon, 3 Jun 2024 07:33:57 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.140.110.172 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717400040; cv=none; b=I+K9srFyvtZjmrGKcs+jU2v5G+IvgZqndZvJ+gmT8cBej9iNdKoGwFeuH9zjVHd5V3BoLdKl333dcu1M6T9KdsMAt4Chw4PG6N+pWibzbjX3TqXusYWlcBrH5m/IBhl8KyY+s1zLEGA1qye3f0OLOrj0D+4xNMu25N54PtgKCM8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717400040; c=relaxed/simple; bh=bMwHq1gbaaHFe+5rDN7x7ihdVSCPg5KBQmDrKPdlJ5w=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=DNd1P20TbGs3J6iVwGUaMZXYWigs9NoLLOVvvFTXz0PcOI1ZRnsAhPVzwMQHQ8lXn2GqR3JodA8Sj0CY0hHfNx6K90PiEly/syb71/SrfmoprxOmYyq/8xWVsfre1PDc9NrqpVvrwRSlhNJU4zMXnVX/uKjwNa2QH2QVEncXDFc= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com; spf=pass smtp.mailfrom=arm.com; arc=none smtp.client-ip=217.140.110.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=arm.com 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 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 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 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); > }