idle task check
Mustafa Hussain
mustafa.hussain93 at gmail.com
Thu Jun 4 09:35:54 EDT 2015
Ok everything is clear now thanks for your time, i will search a while and
try to code that syscall :)
Thanks again.
On 4 Jun 2015 16:18, "nick" <xerofoify at gmail.com> wrote:
>
>
> On 2015-06-04 09:16 AM, Mustafa Hussain wrote:
> > I mean how can we use the pid in the scenario of finding the process that
> > is not used.
> Just check if the process is in the TASK_RUNNING state if it is then
> it's in a runnable state, waiting to run on the queue. Otherwise
> it's idling waiting for something or has completed its work.
> Nick
> > On 4 Jun 2015 16:00, "nick" <xerofoify at gmail.com> wrote:
> >
> >>
> >>
> >> On 2015-06-04 08:52 AM, Mustafa Hussain wrote:
> >>> Ok, everything is clear except one thing what we will do exactly with
> >> (pid)
> >>> s?
> >>> On 4 Jun 2015 15:40, "nick" <xerofoify at gmail.com> wrote:
> >>>
> >> Its used in task struct to create a doubly linked list with init/systemd
> >> being the head or first process and the others linked in other of their
> >> hierarchy.
> >> Nick
> >>>>
> >>>>
> >>>> On 2015-06-04 08:34 AM, Mustafa Hussain wrote:
> >>>>> great, How can I check if this running task is used or not.. I mean
> by
> >>>> not
> >>>>> used that the task is running but not used by the user
> >>>>>
> >>>>>
> >>>> Here is the issue through in order to find out what tasks the user is
> >>>> running we
> >>>> need to known the exact pid(s) each time. This is next to impossible
> to
> >> do
> >>>> without
> >>>> writing a syscall and that’s a little beyond you if your asking about
> >> the
> >>>> scheduler.
> >>>> However, there may be a debugging feature in perf or other tool that
> >> does
> >>>> this, you
> >>>> can google to see if something wrote a tool or kernel module for this.
> >>>> Nick
> >>>>> On June 4, 2015 8:22:03 AM EDT, Mustafa Hussain <
> >>>> mustafa.hussain93 at gmail.com>
> >>>>> wrote:
> >>>>>> So I was just thinking about if i did this i can close apps that is
> >>>>>> running
> >>>>>> and user don't use them..
> >>>>>> On 4 Jun 2015 14:59, "Nicholas Krause" <xerofoify at gmail.com> wrote:
> >>>>>>
> >>>>> That's not a idle task, that's a task in the
> >>>>> TASK_INTERRUPTIBLE or TASK_RUNNING phase.
> >>>>> Nick
> >>>>>>>
> >>>>>>>
> >>>>>>> On June 4, 2015 7:56:30 AM EDT, Mustafa Hussain <
> >>>>>>> mustafa.hussain93 at gmail.com> wrote:
> >>>>>>>> All i am trying to do is to detect idle task and remove it from
> the
> >>>>>>>> running
> >>>>>>>> queue or deactivate it.
> >>>>>>> There is no reason for that. The idle tasks are only ever
> scheduled
> >>>>>> when
> >>>>>>> there is no other processes able to
> >>>>>>> run. So trying to remove them is a
> >>>>>>> bad idea.
> >>>>>>> Nick
> >>>>>>>> Thank you for your patience :)
> >>>>>>>> On 4 Jun 2015 14:51, "Nicholas Krause" <xerofoify at gmail.com>
> wrote:
> >>>>>>>>
> >>>>>>>>>
> >>>>>>>>>
> >>>>>>>>> On June 4, 2015 3:35:25 AM EDT, Mustafa Hussain <
> >>>>>>>>> mustafa.hussain93 at gmail.com> wrote:
> >>>>>>>>>> System crashes, system can not start
> >>>>>>>>>>
> >>>>>>>>> I was not thinking and this schedules the idle thread. What are
> >>>>>> you
> >>>>>>>> trying
> >>>>>>>>> to accomplish through.
> >>>>>>>>> Nick
> >>>>>>>>>>
> >>>>>>>>>> On June 3, 2015 9:41:52 PM EDT, Mustafa Hussain
> >>>>>>>>>> <mustafa.hussain93 at gmail.com>
> >>>>>>>>>> wrote:
> >>>>>>>>>>> i want to dequeue the idle task how can i do this ?
> >>>>>>>>>> Why there is no point. Clearly your asking questions in order
> to
> >>>>>>>> learn
> >>>>>>>>>> the
> >>>>>>>>>> scheduler.
> >>>>>>>>>> If your interested in learning it I can help but, you need to
> >>>>>>>> think
> >>>>>>>>>> about
> >>>>>>>>>> what you
> >>>>>>>>>> trying to accomplish first.
> >>>>>>>>>> Nick
> >>>>>>>>>>
> >>>>>>>>>>> On Thu, Jun 4, 2015 at 3:40 AM, Mustafa Hussain
> >>>>>>>>>>> <mustafa.hussain93 at gmail.com
> >>>>>>>>>>>> wrote:
> >>>>>>>>>>>
> >>>>>>>>>>>> Hi nick,
> >>>>>>>>>>>> i applied your suggested edit and i got "bad: scheduling from
> >>>>>> the
> >>>>>>>>>>> idle
> >>>>>>>>>>>> thread!"
> >>>>>>>>>>>> how can i solve this ?
> >>>>>>>>>>>>
> >>>>>>>>>>>> On Wed, Jun 3, 2015 at 12:29 AM, nick <xerofoify at gmail.com>
> >>>>>>>> wrote:
> >>>>>>>>>>>>
> >>>>>>>>>>>>>
> >>>>>>>>>>>>>
> >>>>>>>>>>>>> On 2015-06-02 06:25 PM, Valdis.Kletnieks at vt.edu wrote:
> >>>>>>>>>>>>>> On Tue, 02 Jun 2015 23:38:48 +0200, Mustafa Hussain said:
> >>>>>>>>>>>>>>
> >>>>>>>>>>>>>>>> /*Check if the pointer pointing to the idle class is
> >>>>>> equal
> >>>>>>>> to
> >>>>>>>>>>> prev's
> >>>>>>>>>>>>>>>> sched_class*/
> >>>>>>>>>>>>>>>> if(prev->sched_class == idle)
> >>>>>>>>>>>>>>>> After this condition you can just:
> >>>>>>>>>>>>>>>> printk(KERN_INFO "Prev is equal to idle_sched_class,now
> >>>>>>>> running
> >>>>>>>>>>> the
> >>>>>>>>>>>>> idle
> >>>>>>>>>>>>>>>> sched_class\n");
> >>>>>>>>>>>>>>
> >>>>>>>>>>>>>> Hopefully, you didn't take Nick's advice without thinking
> >>>>>>>> about
> >>>>>>>>>>> it....
> >>>>>>>>>>>>>>
> >>>>>>>>>>>>>> As I type this, powertop tells me:
> >>>>>>>>>>>>>>
> >>>>>>>>>>>>>> Summary: 821.8 wakeups/second, 0.0 GPU ops/seconds, 0.0
> >>>>>> VFS
> >>>>>>>>>>> ops/sec
> >>>>>>>>>>>>> and 18.8% CPU use
> >>>>>>>>>>>>>>
> >>>>>>>>>>>>>> That printk is going to spam your dmesg pretty hard.
> >>>>>>>>>>>>>>
> >>>>>>>>>>>>>> A better question is:
> >>>>>>>>>>>>>>
> >>>>>>>>>>>>>> If prev is about to go idle, *what do you want to do*?
> >>>>>> (Hint:
> >>>>>>>>>>> newer
> >>>>>>>>>>>>>> kernels already do a bunch of stuff when a cpu/core goes
> >>>>>> idle,
> >>>>>>>>>> you
> >>>>>>>>>>>>>> probably want to make sure you're not working against
> >>>>>>>> something
> >>>>>>>>>>> here...)
> >>>>>>>>>>>>>>
> >>>>>>>>>>>>> I didn't account for rate limiting the debug messages, forgot
> >>>>>>>> about
> >>>>>>>>>>> that
> >>>>>>>>>>>>> . :)
> >>>>>>>>>>>>> I do agree his question is not the best but he wanted a
> >>>>>> answer
> >>>>>>>> so I
> >>>>>>>>>>>>> decided
> >>>>>>>>>>>>> to just give him a answer that works for his learning.
> >>>>>>>>>>>>> Nick
> >>>>>>>>>>>>>
> >>>>>>>>>>>>
> >>>>>>>>>>>>
> >>>>>>>>>>
> >>>>>>>>>> --
> >>>>>>>>>> Sent from my Android device with K-9 Mail. Please excuse my
> >>>>>> brevity.
> >>>>>>>>>
> >>>>>>>>> --
> >>>>>>>>> Sent from my Android device with K-9 Mail. Please excuse my
> >>>>>> brevity.
> >>>>>>>>>
> >>>>>>>
> >>>>>>> --
> >>>>>>> Sent from my Android device with K-9 Mail. Please excuse my
> brevity.
> >>>>>>>
> >>>>>
> >>>>> --
> >>>>> Sent from my Android device with K-9 Mail. Please excuse my brevity.
> >>>>>
> >>>>
> >>>
> >>
> >
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20150604/392d5d59/attachment-0001.html
More information about the Kernelnewbies
mailing list