public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: dragoran <drago01@gmail.com>
To: Andi Kleen <andi@firstfloor.org>
Cc: linux-kernel@vger.kernel.org
Subject: Re: allow non root users to set io priority "idle" ?
Date: Mon, 06 Aug 2007 12:26:37 +0200	[thread overview]
Message-ID: <46B6F75D.1070808@gmail.com> (raw)
In-Reply-To: <p73zm14lxyy.fsf@bingen.suse.de>

Andi Kleen wrote:
> dragoran <drago01@gmail.com> writes:
>
>   
>> Its possible to set the io priority using tools like ionice and syscalls.
>> But this works only as root.
>> Why can't a non root user change the priority of his processes to idle?
>> I understand that realtime priority requires root but why idle?
>> For instance the beagle trys to set its priority to idle but fails
>> because it does not run as root.
>> Any reason for this that I have missed? I can't think of a case where
>> setting the io priority to idle would have a negative impact for other
>> users or the whole system.
>>     
>
> Very low priority can starve others when it holds some kernel resource
> needed by another task.  
>
> Consider three tasks: one very low priority, one high priority: Low
> priority task holds some kernel resource, middle task eats as much CPU
> as it gets; high priority task wants to get the resource. High
> priority will need to wait for low running, which could take a long
> time. With true SCHED_IDLE (i believe the current implementation is
> not true) this could be never or at least a very long time.
>
> There are ways to defend against this problem (known as priority inheritance),
> but the kernel doesn't do them consistently. The same issue could also
> happen for user space managed resources.
>
> For IO I suppose the same could happen too. e.g. low priority
> task wants to write out a page and keeps it locked until the IO 
> is finished. High priority task wants to access the page and has
> to wait until it is unlocked. Middle task generates an endless
> stream of IO that makes the idle priority writeout never finish.
couldn't this be fixed by bumping idle tasks to middle while they hold a 
pagelock?
ex:
task A - hp
task B - mp
task C - lp (idle)
task C locks a page -> becomes a mp (middle prio) task until its finished
task C unlocks the page -> back to idle

> In general idle priorities are quite risky, even for root.
>
> -Andi
>
>   


  reply	other threads:[~2007-08-06 10:26 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-08-06  9:45 allow non root users to set io priority "idle" ? dragoran
2007-08-06 11:11 ` Andi Kleen
2007-08-06 10:26   ` dragoran [this message]
2007-08-06 10:35     ` Andi Kleen
2007-08-06 11:06       ` dragoran
2007-08-07 20:44       ` Jens Axboe
2007-08-07 21:35         ` dragoran
2007-08-07 22:18           ` dragoran
2007-08-08  0:04             ` Andi Kleen
2007-08-08  5:06             ` Jens Axboe
2007-08-08  9:37               ` dragoran
2007-08-08  2:26   ` Lee Revell
2007-08-08 10:17     ` Andi Kleen
2007-08-08  9:51   ` Sheplyakov Alexei
2007-08-08 10:20     ` Andi Kleen
2007-08-08 11:49       ` Sheplyakov Alexei
2007-08-08 11:55         ` Andi Kleen
2007-08-08 10:52     ` Jens Axboe
     [not found] <8P7nW-2Jc-7@gated-at.bofh.it>
     [not found] ` <8P7QZ-3AR-17@gated-at.bofh.it>
     [not found]   ` <8P80L-3N5-25@gated-at.bofh.it>
     [not found]     ` <8P8ak-3Yr-9@gated-at.bofh.it>
2007-08-07 18:21       ` Bodo Eggert

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=46B6F75D.1070808@gmail.com \
    --to=drago01@gmail.com \
    --cc=andi@firstfloor.org \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox