Re: [PATCH v2] chrt: Make priority optional for policies that don't use it

Madadi Vineeth Reddy <[email protected]>
Newsgroups org.kernel.vger.util-linux
Message-ID <[email protected]>
On 18/06/25 14:48, Karel Zak wrote:
> On Wed, Jun 18, 2025 at 10:18:29AM +0200, Benno Schulenberg wrote:
>>
>> Op 17-06-2025 om 20:24 schreef Madadi Vineeth Reddy:
>>> Currently, chrt requires a priority argument even for scheduling
>>> policies like SCHED_OTHER and SCHED_BATCH, which ignore it.
>>>
>>> This change relaxes that requirement. Now, priority is only expected
>>> for SCHED_FIFO and SCHED_RR. For other policies, a default value of 0
>>> is set internally and no argument is required on the command line.
>>
>> Doesn't this alter the "show-the-current-policy-and-priority" behavior
>> when no priority is given?  Currently `./chrt --help` says (trimmed):
>  
> Very good point. The priority policy (--{other,...}) should be
> required to ensure that the user wants to alter the setting rather
> than print the current situation. Madadi, what do you think?
> 
>>   Set policy:
>>    chrt [options] --pid <priority> <pid>
>>
>>   Get policy:
>>    chrt [options] -p <pid>
> 
> I really don't like the use of "-p." We should use "--pid" everywhere  
> (in --help, man page, and examples).

I can spin off a separate patch to consistently use --pid instead of -p
in the help text, man page, and examples.

Thanks,
Madadi Vineeth Reddy

> 
>> Without the proposed change, running `chrt --other --pid $$` says:
>>
>>   pid 1427's current scheduling policy: SCHED_OTHER
>>   pid 1427's current scheduling priority: 0
>>
>> After the change, that same command outputs nothing.  Maybe that is
>> fine, but it would require some adjustment of the docs.
> 
> This is bug.
> 
>     Karel
>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.