[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <107bd666-dbcf-7fa5-ff9c-f79358899712@mellanox.com>
Date: Tue, 30 Aug 2016 14:17:27 -0400
From: Chris Metcalf <cmetcalf@...lanox.com>
To: Frederic Weisbecker <fweisbec@...il.com>
CC: Christoph Lameter <cl@...ux.com>,
Gilad Ben Yossef <giladb@...lanox.com>,
Steven Rostedt <rostedt@...dmis.org>,
Ingo Molnar <mingo@...nel.org>,
"Peter Zijlstra" <peterz@...radead.org>,
Andrew Morton <akpm@...ux-foundation.org>,
Rik van Riel <riel@...hat.com>, Tejun Heo <tj@...nel.org>,
Thomas Gleixner <tglx@...utronix.de>,
"Paul E. McKenney" <paulmck@...ux.vnet.ibm.com>,
Viresh Kumar <viresh.kumar@...aro.org>,
Catalin Marinas <catalin.marinas@....com>,
Will Deacon <will.deacon@....com>,
Andy Lutomirski <luto@...capital.net>,
Michal Hocko <mhocko@...e.com>, <linux-mm@...ck.org>,
<linux-doc@...r.kernel.org>, <linux-api@...r.kernel.org>,
<linux-kernel@...r.kernel.org>
Subject: Re: [PATCH v14 04/14] task_isolation: add initial support
On 8/30/2016 1:36 PM, Chris Metcalf wrote:
>>> See the other thread with Peter Z for the longer discussion of this.
>>> At this point I'm leaning towards replacing the set_tsk_need_resched() with
>>>
>>> set_current_state(TASK_INTERRUPTIBLE);
>>> schedule();
>>> __set_current_state(TASK_RUNNING);
>> I don't see how that helps. What will wake the thread up except a signal?
>
> The answer is that the scheduler will keep bringing us back to this
> point (either after running another runnable task if there is one,
> or else just returning to this point immediately without doing a
> context switch), and we will then go around the "prepare exit to
> userspace" loop and perhaps discover that enough time has gone
> by that the last dyntick interrupt has triggered and the kernel has
> quiesced the dynticks. At that point we stop calling schedule()
> over and over and can return normally to userspace.
Oops, you're right that if I set TASK_INTERRUPTIBLE, then if I call
schedule(), I never get control back. So I don't want to do that.
I suppose I could do a schedule_timeout() here instead and try
to figure out how long to wait for the next dyntick. But since we
don't expect anything else running on the core anyway, it seems
like we are probably working too hard at this point. I don't think
it's worth it just to go into the idle task and (possibly) save some
power for a few microseconds.
The more I think about this, the more I think I am micro-optimizing
by trying to poke the scheduler prior to some external thing setting
need_resched, so I think the thing to do here is in fact, nothing.
I won't worry about rescheduling but will just continue going around
the prepare-exit-to-userspace loop until the last dyn tick fires.
--
Chris Metcalf, Mellanox Technologies
http://www.mellanox.com
Powered by blists - more mailing lists